--- /dev/null
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/mit-copyright.h>.
+ *
+ * decoding glue routines.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_decode_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include <krb5/krb5.h>
+#include <errno.h>
+#include <krb5/isode_err.h>
+#include "encode.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+#include <stdio.h>
+
+krb5_error_code
+decode_generic(input, output, decoder, translator, free_translation)
+krb5_data *input;
+register krb5_pointer *output;
+int (*decoder) PROTOTYPE((PE, int, int, char *, krb5_pointer));
+krb5_pointer (*translator) PROTOTYPE((krb5_pointer, int * ));
+void (*free_translation) PROTOTYPE((krb5_pointer ));
+{
+ krb5_pointer isode_temp;
+ PE pe;
+ PS ps;
+ krb5_error_code error = 0;
+
+ if (!(ps = ps_alloc(str_open))) {
+ return(ENOMEM);
+ }
+ if (str_setup(ps, input->data, input->length, 1) != OK) {
+ error = ps->ps_errno + ISODE_50_PS_ERR_NONE;
+ ps_free(ps);
+ return(error);
+ }
+ if (!(pe = ps2pe(ps))) {
+ error = ps->ps_errno + ISODE_50_PS_ERR_NONE;
+ ps_free(ps);
+ return(error);
+ }
+ if ((*decoder)(pe, 1, 0, 0, &isode_temp) != OK) {
+ error = ISODE_50_LOCAL_ERR_BADDECODE;
+ pe_free(pe);
+ ps_free(ps);
+ return(error);
+ }
+ *output = (*translator)(isode_temp, &error);
+ pe_free(pe);
+ ps_free(ps);
+ free_translation(isode_temp);
+ return(error); /* may be error if output
+ failed above */
+}