*** empty log message ***
authorJohn Kohl <jtkohl@mit.edu>
Tue, 28 Aug 1990 10:23:28 +0000 (10:23 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 28 Aug 1990 10:23:28 +0000 (10:23 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1047 dc483132-0cff-0310-8789-dd5450dbe970

43 files changed:
src/lib/krb5/asn.1/adat2kadat.c [new file with mode: 0644]
src/lib/krb5/asn.1/addr2kaddr.c [new file with mode: 0644]
src/lib/krb5/asn.1/aprp2kaprp.c [new file with mode: 0644]
src/lib/krb5/asn.1/aprq2kaprq.c [new file with mode: 0644]
src/lib/krb5/asn.1/arep2karep.c [new file with mode: 0644]
src/lib/krb5/asn.1/auth2kauth.c [new file with mode: 0644]
src/lib/krb5/asn.1/ck2kck.c [new file with mode: 0644]
src/lib/krb5/asn.1/ekrp2kekrp.c [new file with mode: 0644]
src/lib/krb5/asn.1/enck2kkey.c [new file with mode: 0644]
src/lib/krb5/asn.1/err2kerr.c [new file with mode: 0644]
src/lib/krb5/asn.1/etpt2ketpt.c [new file with mode: 0644]
src/lib/krb5/asn.1/g2unix.c [new file with mode: 0644]
src/lib/krb5/asn.1/kadat2adat.c [new file with mode: 0644]
src/lib/krb5/asn.1/kaddr2addr.c [new file with mode: 0644]
src/lib/krb5/asn.1/kaprp2aprp.c [new file with mode: 0644]
src/lib/krb5/asn.1/kaprq2aprq.c [new file with mode: 0644]
src/lib/krb5/asn.1/karep2arep.c [new file with mode: 0644]
src/lib/krb5/asn.1/kauth2auth.c [new file with mode: 0644]
src/lib/krb5/asn.1/kck2ck.c [new file with mode: 0644]
src/lib/krb5/asn.1/kdcr2kkdcr.c [new file with mode: 0644]
src/lib/krb5/asn.1/kdcr2ktgsr.c [new file with mode: 0644]
src/lib/krb5/asn.1/kekrp2ekrp.c [new file with mode: 0644]
src/lib/krb5/asn.1/kerr2err.c [new file with mode: 0644]
src/lib/krb5/asn.1/ketpt2etpt.c [new file with mode: 0644]
src/lib/krb5/asn.1/kkdcr2kdcr.c [new file with mode: 0644]
src/lib/krb5/asn.1/kkey2enck.c [new file with mode: 0644]
src/lib/krb5/asn.1/klsrq2lsrq.c [new file with mode: 0644]
src/lib/krb5/asn.1/kprep2prep.c [new file with mode: 0644]
src/lib/krb5/asn.1/kprin2prin.c [new file with mode: 0644]
src/lib/krb5/asn.1/kpriv2priv.c [new file with mode: 0644]
src/lib/krb5/asn.1/ksafe2safe.c [new file with mode: 0644]
src/lib/krb5/asn.1/ktgrq2tgrq.c [new file with mode: 0644]
src/lib/krb5/asn.1/ktgsr2kdcr.c [new file with mode: 0644]
src/lib/krb5/asn.1/ktkt2tkt.c [new file with mode: 0644]
src/lib/krb5/asn.1/lsrq2klsrq.c [new file with mode: 0644]
src/lib/krb5/asn.1/prep2kprep.c [new file with mode: 0644]
src/lib/krb5/asn.1/prin2kprin.c [new file with mode: 0644]
src/lib/krb5/asn.1/priv2kpriv.c [new file with mode: 0644]
src/lib/krb5/asn.1/qbuf2data.c [new file with mode: 0644]
src/lib/krb5/asn.1/safe2ksafe.c [new file with mode: 0644]
src/lib/krb5/asn.1/tgrq2ktgrq.c [new file with mode: 0644]
src/lib/krb5/asn.1/tkt2ktkt.c [new file with mode: 0644]
src/lib/krb5/asn.1/u2gen.c [new file with mode: 0644]

diff --git a/src/lib/krb5/asn.1/adat2kadat.c b/src/lib/krb5/asn.1/adat2kadat.c
new file mode 100644 (file)
index 0000000..117d849
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_adat2kadat_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_authdata **
+KRB5_AuthorizationData2krb5_authdata(val, error)
+const struct type_KRB5_AuthorizationData *val;
+register int *error;
+{
+    register krb5_authdata **retval;
+    register int i;
+
+    /* plus one for null terminator */
+    retval = (krb5_authdata **) xcalloc(val->nelem + 1,
+                                       sizeof(krb5_authdata *));
+    if (!retval) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    }
+    for (i = 0; i < val->nelem; i++) {
+       if (qb_pullup(val->element_KRB5_2[i]->ad__data) != OK) {
+           xfree(retval);
+           goto nomem;
+       }
+       retval[i] = (krb5_authdata *) xmalloc(sizeof(*retval[i]));
+       if (!retval[i]) {
+           krb5_free_authdata(retval);
+           goto nomem;
+       }
+       retval[i]->contents = (unsigned char *)xmalloc(val->element_KRB5_2[i]->ad__data->qb_forw->qb_len);
+       if (!retval[i]->contents) {
+           xfree(retval[i]);
+           krb5_free_authdata(retval);
+           goto nomem;
+       }
+       retval[i]->ad_type = val->element_KRB5_2[i]->ad__type;
+       retval[i]->length = val->element_KRB5_2[i]->ad__data->qb_forw->qb_len;
+       xbcopy(val->element_KRB5_2[i]->ad__data->qb_forw->qb_data,
+             &retval[i]->contents[0], retval[i]->length);
+    }
+    retval[i] = 0;
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/addr2kaddr.c b/src/lib/krb5/asn.1/addr2kaddr.c
new file mode 100644 (file)
index 0000000..8d9888f
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_addr2kaddr_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+
+
+krb5_address **
+KRB5_HostAddresses2krb5_address(val, error)
+const struct type_KRB5_HostAddresses *val;
+register int *error;
+{
+    register krb5_address **retval;
+    register int i;
+
+    /* plus one for null terminator */
+    retval = (krb5_address **) xcalloc(val->nelem + 1, sizeof(krb5_address *));
+    if (!retval) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    }
+    for (i = 0; i < val->nelem; i++) {
+       if (qb_pullup(val->element_KRB5_0[i]->address) != OK) {
+           xfree(retval);
+           goto nomem;
+       }
+       retval[i] = (krb5_address *) xmalloc(sizeof(*retval[i]));
+       if (!retval[i]) {
+           krb5_free_address(retval);
+           goto nomem;
+       }
+       retval[i]->contents = (unsigned char *)xmalloc(val->element_KRB5_0[i]->address->qb_forw->qb_len);
+       if (!retval[i]->contents) {
+           xfree(retval[i]);
+           krb5_free_address(retval);
+           goto nomem;
+       }
+       retval[i]->addrtype = val->element_KRB5_0[i]->addr__type;
+       retval[i]->length = val->element_KRB5_0[i]->address->qb_forw->qb_len;
+       xbcopy(val->element_KRB5_0[i]->address->qb_forw->qb_data,
+             retval[i]->contents, retval[i]->length);
+    }
+    retval[i] = 0;
+    return(retval);
+}
+
diff --git a/src/lib/krb5/asn.1/aprp2kaprp.c b/src/lib/krb5/asn.1/aprp2kaprp.c
new file mode 100644 (file)
index 0000000..02af1dd
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_aprp2kaprp_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_ap_rep *
+KRB5_AP__REP2krb5_ap_rep(val, error)
+const register struct type_KRB5_AP__REP *val;
+register int *error;
+{
+    register krb5_ap_rep *retval;
+    krb5_data *temp;
+
+    retval = (krb5_ap_rep *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    temp = qbuf2krb5_data(val->enc__part, error);
+    if (temp) {
+       retval->enc_part = *temp;
+       xfree(temp);
+    } else {
+       xfree(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/aprq2kaprq.c b/src/lib/krb5/asn.1/aprq2kaprq.c
new file mode 100644 (file)
index 0000000..49bb90c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_aprq2kaprq_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_ap_req *
+KRB5_AP__REQ2krb5_ap_req(val, error)
+const register struct type_KRB5_AP__REQ *val;
+register int *error;
+{
+    register krb5_ap_req *retval;
+    krb5_data *temp;
+
+    retval = (krb5_ap_req *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+    
+    retval->ap_options = KRB5_APOptions2krb5_apoptions(val->ap__options,
+                                                      error);
+    retval->ticket = KRB5_Ticket2krb5_ticket(val->ticket, error);
+    if (!retval->ticket) {
+       krb5_free_ap_req(retval);
+       return(0);
+    }
+    temp = qbuf2krb5_data(val->authenticator, error);
+    if (temp) {
+       retval->authenticator = *temp;
+       xfree(temp);
+    } else {
+       krb5_free_ap_req(retval);
+       return(0);
+    }
+  
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/arep2karep.c b/src/lib/krb5/asn.1/arep2karep.c
new file mode 100644 (file)
index 0000000..4eff572
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_arep2karep_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_ap_rep_enc_part *
+KRB5_EncAPRepPart2krb5_ap_rep_enc_part(val, error)
+const register struct type_KRB5_EncAPRepPart *val;
+register int *error;
+{
+    register krb5_ap_rep_enc_part *retval;
+    retval = (krb5_ap_rep_enc_part *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    /* xbzero not needed, since structure is simple */
+    /* xbzero(retval, sizeof(*retval)); */
+
+    retval->ctime = gentime2unix(val->ctime, error);
+    if (*error) {
+       xfree(retval);
+       return(0);
+    }  
+    retval->cmsec = val->cmsec;
+
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/auth2kauth.c b/src/lib/krb5/asn.1/auth2kauth.c
new file mode 100644 (file)
index 0000000..606023d
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_auth2kauth_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_authenticator *
+KRB5_Authenticator2krb5_authenticator(val, error)
+const register struct type_KRB5_Authenticator *val;
+register int *error;
+{
+    register krb5_authenticator *retval;
+
+    retval = (krb5_authenticator *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+
+    xbzero(retval, sizeof(*retval));
+
+    retval->client = KRB5_PrincipalName2krb5_principal(val->cname,
+                                                      val->crealm,
+                                                      error);
+    if (!retval->client) {
+       xfree(retval);
+       return(0);
+    }
+
+    retval->checksum = KRB5_Checksum2krb5_checksum(val->cksum, error);
+    if (!retval->checksum) {
+       krb5_free_authenticator(retval);
+       return(0);
+    }
+    retval->cmsec = val->cmsec;
+    retval->ctime = gentime2unix(val->ctime, error);
+    if (*error) {
+       krb5_free_authenticator(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/ck2kck.c b/src/lib/krb5/asn.1/ck2kck.c
new file mode 100644 (file)
index 0000000..823cba3
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_ck2kck_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_checksum *
+KRB5_Checksum2krb5_checksum(val, error)
+const register struct type_KRB5_Checksum *val;
+register int *error;
+{
+    krb5_checksum *retval;
+
+    if (!val->checksum) {
+       *error = EINVAL;
+       return(0);
+    } else
+       *error = 0;
+    /* pull up, then play with the single string */
+    if (qb_pullup(val->checksum) != OK) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    }
+    retval = (krb5_checksum *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       goto nomem;
+    }
+    retval->contents = (unsigned char *)xmalloc(val->checksum->qb_forw->qb_len);
+    if (!retval->contents) {
+       xfree(retval);
+       goto nomem;
+    }
+    retval->checksum_type = val->cksumtype;
+    retval->length = val->checksum->qb_forw->qb_len;
+    xbcopy(val->checksum->qb_forw->qb_data, retval->contents,
+         val->checksum->qb_forw->qb_len);
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/ekrp2kekrp.c b/src/lib/krb5/asn.1/ekrp2kekrp.c
new file mode 100644 (file)
index 0000000..d3f4322
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_ekrp2kekrp_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_enc_kdc_rep_part *
+KRB5_EncKDCRepPart2krb5_enc_kdc_rep_part(val, error)
+const register struct type_KRB5_EncKDCRepPart *val;
+register int *error;
+{
+    register krb5_enc_kdc_rep_part *retval;
+
+    retval = (krb5_enc_kdc_rep_part *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->confounder = val->confounder;
+    retval->session = KRB5_EncryptionKey2krb5_keyblock(val->key, error);
+    if (!retval->session) {
+       xfree(retval);
+       return(0);
+    }
+
+    retval->last_req = KRB5_LastReq2krb5_last_req(val->last__req, error);
+    if (!retval->last_req) {
+    errout:
+       krb5_free_enc_kdc_rep_part(retval);
+       return(0);
+    }
+
+    retval->ctime = gentime2unix(val->ctime, error);
+    if (*error) {
+       goto errout;
+    }
+    retval->key_exp = gentime2unix(val->key__exp, error);
+    if (*error) {
+       goto errout;
+    }
+
+    retval->flags = KRB5_TicketFlags2krb5_flags(val->flags, error);
+    if (*error) {
+       goto errout;
+    }
+    retval->times.authtime = gentime2unix(val->authtime, error);
+    if (*error) {
+       goto errout;
+    }
+    retval->times.starttime = gentime2unix(val->starttime, error);
+    if (*error) {
+       goto errout;
+    }
+    retval->times.endtime = gentime2unix(val->endtime, error);
+    if (retval->flags & TKT_FLG_RENEWABLE) {
+       retval->times.renew_till = gentime2unix(val->renew__till, error);
+       if (*error) {
+           goto errout;
+       }
+    }
+    retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
+                                                      val->srealm,
+                                                      error);
+    if (!retval->server) {
+       goto errout;
+    }
+    retval->caddrs = KRB5_HostAddresses2krb5_address(val->caddr, error);
+    if (!retval->caddrs) {
+       goto errout;
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/enck2kkey.c b/src/lib/krb5/asn.1/enck2kkey.c
new file mode 100644 (file)
index 0000000..deb3897
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_enck2kkey_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+
+krb5_keyblock *
+KRB5_EncryptionKey2krb5_keyblock(val, error)
+const register struct type_KRB5_EncryptionKey *val;
+register int *error;
+{
+    krb5_keyblock *retval;
+
+    if (!val->session) {
+       *error = EINVAL;
+       return(0);
+    } else
+       *error = 0;
+    /* pull up, then play with the single string */
+    if (qb_pullup(val->session) != OK) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    }
+    retval = (krb5_keyblock *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       goto nomem;
+    }
+    retval->contents = (unsigned char *) xmalloc(val->session->qb_forw->qb_len);
+    if (!retval->contents) {
+       xfree(retval);
+       goto nomem;
+    }
+    retval->keytype = val->keytype;
+    retval->length = val->session->qb_forw->qb_len;
+    xbcopy(val->session->qb_forw->qb_data, retval->contents,
+         val->session->qb_forw->qb_len);
+    return(retval);
+}
+
diff --git a/src/lib/krb5/asn.1/err2kerr.c b/src/lib/krb5/asn.1/err2kerr.c
new file mode 100644 (file)
index 0000000..1355cdd
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_err2kerr_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_error *
+KRB5_KRB__ERROR2krb5_error(val, error)
+const register struct type_KRB5_KRB__ERROR *val;
+register int *error;
+{
+    register krb5_error *retval;
+    krb5_data *temp;
+
+    retval = (krb5_error *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+
+    retval->ctime = gentime2unix(val->ctime, error);
+    if (*error) {
+    errout:
+       krb5_free_error(retval);
+       return(0);
+    }  
+    retval->cmsec = val->cmsec;
+    retval->stime = gentime2unix(val->stime, error);
+    if (*error) {
+       goto errout;
+    }  
+    retval->smsec = val->smsec;
+    retval->error = val->error;
+    if (val->crealm) {
+       retval->client = KRB5_PrincipalName2krb5_principal(val->cname,
+                                                          val->crealm,
+                                                          error);
+       if (!retval->client) {
+           goto errout;
+       }
+    }
+    if (val->sname) {
+       retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
+                                                          val->srealm,
+                                                          error);
+       if (!retval->server) {
+           goto errout;
+       }
+    }
+    if (val->e__text) {
+       temp = qbuf2krb5_data(val->e__text, error);
+       if (temp) {
+           retval->text = *temp;
+           xfree(temp);
+       } else {
+           goto errout;
+       }
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/etpt2ketpt.c b/src/lib/krb5/asn.1/etpt2ketpt.c
new file mode 100644 (file)
index 0000000..4d09205
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_etpt2ketpt_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_enc_tkt_part *
+KRB5_EncTicketPart2krb5_enc_tkt_part(val, error)
+const register struct type_KRB5_EncTicketPart *val;
+register int *error;
+{
+    register krb5_enc_tkt_part *retval;
+    krb5_data *temp;
+
+    retval = (krb5_enc_tkt_part *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+
+    retval->confounder = val->confounder;
+    retval->flags = KRB5_TicketFlags2krb5_flags(val->flags, error);
+    if (*error) {
+       xfree(retval);
+       return(0);
+    }
+
+    retval->session = KRB5_EncryptionKey2krb5_keyblock(val->key, error);
+    if (!retval->session) {
+    errout:
+       krb5_free_enc_tkt_part(retval);
+       return(0);
+    }
+    retval->client = KRB5_PrincipalName2krb5_principal(val->cname,
+                                                      val->crealm,
+                                                      error);
+    if (!retval->client) {
+       goto errout;
+    }
+    temp = qbuf2krb5_data(val->transited, error);
+    if (temp) {
+       retval->transited = *temp;
+       xfree(temp);
+    } else {
+       goto errout;
+    }
+
+    retval->times.authtime = gentime2unix(val->authtime, error);
+    if (*error) {
+       goto errout;
+    }  
+    retval->times.starttime = gentime2unix(val->starttime, error);
+    if (*error) {
+       goto errout;
+    }  
+    retval->times.endtime = gentime2unix(val->endtime, error);
+    if (*error) {
+       goto errout;
+    }  
+    if (retval->flags & TKT_FLG_RENEWABLE) {
+       retval->times.renew_till = gentime2unix(val->renew__till, error);
+       if (*error) {
+           goto errout;
+       }       
+    }
+
+    retval->caddrs = KRB5_HostAddresses2krb5_address(val->caddr, error);
+    if (!retval->caddrs) {
+       goto errout;
+    }
+    if (val->authorization__data) {
+       retval->authorization_data =
+           KRB5_AuthorizationData2krb5_authdata(val->authorization__data,
+                                                error);
+       if (!retval->authorization_data) {
+           goto errout;
+       }
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/g2unix.c b/src/lib/krb5/asn.1/g2unix.c
new file mode 100644 (file)
index 0000000..fed12d0
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_g2unix_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+long
+gentime2unix(val, error)
+const struct type_UNIV_GeneralizedTime *val;
+register int *error;
+{
+    UTC utcp;
+    char *tmp;
+    long retval;
+
+    tmp = qb2str(val);
+    if (!tmp) {
+       *error = ENOMEM;
+       return(0);
+    } else
+       *error = 0;
+
+    utcp = str2gent(tmp, strlen(tmp));
+    if (utcp == NULLUTC) {
+       *error = EINVAL;
+       return(0);
+    }
+    retval = gtime(ut2tm(utcp));
+    if (retval == NOTOK) {
+       *error = EINVAL;
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kadat2adat.c b/src/lib/krb5/asn.1/kadat2adat.c
new file mode 100644 (file)
index 0000000..689f7db
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kadat2adat_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_AuthorizationData *
+krb5_authdata2KRB5_AuthorizationData(val, error)
+register krb5_authdata * const *val;
+register int *error;
+{
+    register struct type_KRB5_AuthorizationData *retval;
+    register krb5_authdata * const *temp;
+    register int i;
+
+    /* count elements */
+    for (i = 0, temp = val; *temp; temp++,i++);
+
+    retval = (struct type_KRB5_AuthorizationData *)
+       xmalloc(sizeof(*retval) + max(0,i-1)*sizeof(retval->element_KRB5_2[0]));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+    retval->nelem = i;
+    for (i = 0; i < retval->nelem; i++) {
+       retval->element_KRB5_2[i] = (struct element_KRB5_3 *)
+           xmalloc(sizeof(*(retval->element_KRB5_2[i])));
+       if (!retval->element_KRB5_2[i]) {
+       errout:
+           retval->nelem = i;
+           free_KRB5_AuthorizationData(retval);
+           *error = ENOMEM;
+           return(0);
+       }    
+       retval->element_KRB5_2[i]->ad__type = val[i]->ad_type;
+
+       retval->element_KRB5_2[i]->ad__data = str2qb((char *)(val[i])->contents,
+                                                      (val[i])->length, 1);
+       if (!retval->element_KRB5_2[i]->ad__data) {
+           /* clean up */
+           xfree(retval->element_KRB5_2[i]);
+           goto errout;
+       }
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kaddr2addr.c b/src/lib/krb5/asn.1/kaddr2addr.c
new file mode 100644 (file)
index 0000000..51a60cb
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kaddr2addr_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_HostAddresses *
+krb5_address2KRB5_HostAddresses(val, error)
+register krb5_address * const *val;
+register int *error;
+{
+    register struct type_KRB5_HostAddresses *retval;
+    register krb5_address * const *temp;
+    register int i;
+
+    /* count elements */
+    for (i = 0, temp = val; *temp; temp++,i++);
+
+    retval = (struct type_KRB5_HostAddresses *)
+       xmalloc(sizeof(*retval) + max(0,i-1)*sizeof(retval->element_KRB5_0[0]));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+    retval->nelem = i;
+    for (i = 0; i < retval->nelem; i++) {
+       retval->element_KRB5_0[i] = (struct element_KRB5_1 *)
+           xmalloc(sizeof(*(retval->element_KRB5_0[i])));
+       if (!retval->element_KRB5_0[i]) {
+       errout:
+           retval->nelem = i;
+           free_KRB5_HostAddresses(retval);
+           *error = ENOMEM;
+           return(0);
+       }           
+       retval->element_KRB5_0[i]->addr__type = (val[i])->addrtype;
+       retval->element_KRB5_0[i]->address = str2qb((char *)(val[i])->contents,
+                                                   (val[i])->length, 1);
+       if (!retval->element_KRB5_0[i]->address) {
+           /* clean up */
+           xfree(retval->element_KRB5_0[i]);
+           goto errout;
+       }
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kaprp2aprp.c b/src/lib/krb5/asn.1/kaprp2aprp.c
new file mode 100644 (file)
index 0000000..14bc90f
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kaprp2aprp_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_AP__REP *
+krb5_ap_rep2KRB5_AP__REP(val, error)
+const register krb5_ap_rep *val;
+register int *error;
+{
+    register struct type_KRB5_AP__REP *retval;
+    retval = (struct type_KRB5_AP__REP *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = KRB5_AP_REP;
+    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    if (!retval->enc__part) {
+       xfree(retval);
+       *error = ENOMEM;
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kaprq2aprq.c b/src/lib/krb5/asn.1/kaprq2aprq.c
new file mode 100644 (file)
index 0000000..6fde703
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kaprq2aprq_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_AP__REQ *
+krb5_ap_req2KRB5_AP__REQ(val, error)
+const register krb5_ap_req *val;
+register int *error;
+{
+    register struct type_KRB5_AP__REQ *retval;
+
+    retval = (struct type_KRB5_AP__REQ *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = KRB5_AP_REQ;
+
+    retval->ap__options = krb5_apoptions2KRB5_APOptions(val->ap_options,
+                                                       error);
+    if (!retval->ap__options) {
+       xfree(retval);
+       return(0);
+    }
+    retval->ticket = krb5_ticket2KRB5_Ticket(val->ticket, error);
+    if (!retval->ticket) {
+       free_KRB5_AP__REQ(retval);
+       return(0);
+    }
+    retval->authenticator = krb5_data2qbuf(&(val->authenticator));
+    if (!retval->authenticator) {
+       free_KRB5_AP__REQ(retval);
+       *error = ENOMEM;
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/karep2arep.c b/src/lib/krb5/asn.1/karep2arep.c
new file mode 100644 (file)
index 0000000..9cc4493
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_karep2arep_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_EncAPRepPart *
+krb5_ap_rep_enc_part2KRB5_EncAPRepPart(val, error)
+const register krb5_ap_rep_enc_part *val;
+register int *error;
+{
+    register struct type_KRB5_EncAPRepPart *retval;
+    retval = (struct type_KRB5_EncAPRepPart *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->ctime = unix2gentime(val->ctime, error);
+    if (!retval->ctime) {
+       xfree(retval);
+       return(0);
+    }
+
+    retval->cmsec = val->cmsec;
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kauth2auth.c b/src/lib/krb5/asn.1/kauth2auth.c
new file mode 100644 (file)
index 0000000..c4af89a
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kauth2auth_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_Authenticator *
+krb5_authenticator2KRB5_Authenticator(val, error)
+const register krb5_authenticator *val;
+register int *error;
+{
+    register struct type_KRB5_Authenticator *retval;
+
+    retval = (struct type_KRB5_Authenticator *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+
+    xbzero(retval, sizeof(*retval));
+    retval->authenticator__vno = (struct type_KRB5_AuthenticatorVersion *)
+       xmalloc(sizeof(*retval->authenticator__vno));
+    if (!retval->authenticator__vno) {
+       *error = ENOMEM;
+    errout:
+       free_KRB5_Authenticator(retval);
+       return(0);
+    }
+    retval->crealm = krb5_data2qbuf(val->client[0]);
+    if (!retval->crealm) {
+       *error = ENOMEM;
+       goto errout;
+    }
+    retval->cname = krb5_principal2KRB5_PrincipalName(val->client, error);
+    if (!retval->cname) {
+       goto errout;
+    }
+    retval->cksum = krb5_checksum2KRB5_Checksum(val->checksum, error);
+    if (!retval->cksum) {
+       goto errout;
+    }
+    retval->cmsec = val->cmsec;
+    retval->ctime = unix2gentime(val->ctime, error);
+    if (!retval->ctime) {
+       goto errout;
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kck2ck.c b/src/lib/krb5/asn.1/kck2ck.c
new file mode 100644 (file)
index 0000000..e7da997
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kck2ck_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_Checksum *
+krb5_checksum2KRB5_Checksum(val, error)
+const krb5_checksum *val;
+register int *error;
+{
+    PE pe;
+    register struct type_KRB5_Checksum *retval;
+    struct qbuf *temp;
+
+    pe = gens2prim(val->contents, val->length);
+    if (!pe) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    } else
+       *error = 0;
+
+    temp = prim2qb(pe);
+    if (!temp)
+       *error = pe->pe_errno + ISODE_50_PE_ERR_NONE;
+    (void) pe_free(pe);
+
+    if (!temp)
+       return(0);
+
+    retval = (struct type_KRB5_Checksum *) xmalloc(sizeof(*retval));
+    if (!retval) {
+       goto nomem;
+    }
+    retval->cksumtype = val->checksum_type;
+    retval->checksum = temp;
+    
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kdcr2kkdcr.c b/src/lib/krb5/asn.1/kdcr2kkdcr.c
new file mode 100644 (file)
index 0000000..4e8ee56
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kdcr2kkdcr_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_kdc_rep *
+KRB5_KDC__REP2krb5_kdc_rep(val, type, error)
+const register struct type_KRB5_KDC__REP *val;
+krb5_msgtype *type;
+register int *error;
+{
+    register krb5_kdc_rep *retval;
+    krb5_data *temp;
+
+    retval = (krb5_kdc_rep *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    *type = val->msg__type;
+
+    retval->client = KRB5_PrincipalName2krb5_principal(val->cname,
+                                                      val->crealm,
+                                                      error);
+    if (!retval->client) {
+       xfree(retval);
+       return(0);
+    }
+
+    retval->etype = val->etype;
+    retval->ckvno = val->ckvno;
+
+    retval->ticket = KRB5_Ticket2krb5_ticket(val->ticket, error);
+    if (!retval->ticket) {
+       krb5_free_kdc_rep(retval);
+       return(0);
+    }
+    temp = qbuf2krb5_data(val->enc__part, error);
+    if (temp) {
+       retval->enc_part = *temp;
+       xfree(temp);
+    } else {
+       krb5_free_kdc_rep(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kdcr2ktgsr.c b/src/lib/krb5/asn.1/kdcr2ktgsr.c
new file mode 100644 (file)
index 0000000..18deabc
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kdcr2ktgsr_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_kdc_rep *
+KRB5_KDC__REP2krb5_tgs_rep(val, error)
+const register struct type_KRB5_KDC__REP *val;
+register int *error;
+{
+    krb5_msgtype type;
+    register krb5_kdc_rep *retval;
+
+    retval = KRB5_KDC__REP2krb5_kdc_rep(val, &type, error);
+    if (retval && (type != KRB5_TGS_REP)) {
+       krb5_free_kdc_rep(retval);
+       *error = ISODE_50_LOCAL_ERR_BADMSGTYPE;
+       return 0;
+    }
+    return retval;
+}
diff --git a/src/lib/krb5/asn.1/kekrp2ekrp.c b/src/lib/krb5/asn.1/kekrp2ekrp.c
new file mode 100644 (file)
index 0000000..ca14290
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kekrp2ekrp_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_EncKDCRepPart *
+krb5_enc_kdc_rep_part2KRB5_EncKDCRepPart(val, error)
+const register krb5_enc_kdc_rep_part *val;
+register int *error;
+{
+    register struct type_KRB5_EncKDCRepPart *retval;
+
+    retval = (struct type_KRB5_EncKDCRepPart *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->confounder = val->confounder;
+    retval->key = krb5_keyblock2KRB5_EncryptionKey(val->session, error);
+    if (!retval->key) {
+       xfree(retval);
+       return(0);
+    }
+    retval->last__req = krb5_last_req2KRB5_LastReq(val->last_req, error);
+    if (!retval->last__req) {
+    errout:
+       free_KRB5_EncKDCRepPart(retval);
+       return(0);
+    }
+    retval->ctime = unix2gentime(val->ctime, error);
+    if (!retval->ctime) {
+       goto errout;
+    }
+    retval->key__exp = unix2gentime(val->key_exp, error);
+    if (!retval->key__exp) {
+       goto errout;
+    }
+    retval->flags = krb5_flags2KRB5_TicketFlags(val->flags, error);
+    if (!retval->flags) {
+       goto errout;
+    }
+    retval->authtime = unix2gentime(val->times.authtime, error);
+    if (!retval->authtime) {
+       goto errout;
+    }
+    retval->starttime = unix2gentime(val->times.starttime, error);
+    if (!retval->starttime) {
+       goto errout;
+    }
+    retval->endtime = unix2gentime(val->times.endtime, error);
+    if (!retval->endtime) {
+       goto errout;
+    }
+    if (val->flags & TKT_FLG_RENEWABLE) {
+       retval->renew__till = unix2gentime(val->times.renew_till, error);
+       if (!retval->renew__till) {
+           goto errout;
+       }
+    }
+    retval->srealm = krb5_data2qbuf(val->server[0]);
+    if (!retval->srealm) {
+       *error = ENOMEM;
+       goto errout;
+    }
+    retval->sname = krb5_principal2KRB5_PrincipalName(val->server, error);
+    if (!retval->sname) {
+       goto errout;
+    }
+    retval->caddr = krb5_address2KRB5_HostAddresses(val->caddrs, error);
+    if (!retval->caddr) {
+       goto errout;
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kerr2err.c b/src/lib/krb5/asn.1/kerr2err.c
new file mode 100644 (file)
index 0000000..44fca6a
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kerr2err_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_KRB__ERROR *
+krb5_error2KRB5_KRB__ERROR(val, error)
+const register krb5_error *val;
+register int *error;
+{
+    register struct type_KRB5_KRB__ERROR *retval;
+
+    retval = (struct type_KRB5_KRB__ERROR *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = KRB5_ERROR;
+
+    retval->ctime = unix2gentime(val->ctime, error);
+    if (!retval->ctime) {
+       xfree(retval);
+       return(0);
+    }
+    retval->cmsec = val->cmsec;
+
+    retval->stime = unix2gentime(val->stime, error);
+    if (!retval->stime) {
+    errout:
+       free_KRB5_KRB__ERROR(retval);
+       return(0);
+    }
+    retval->smsec = val->smsec;
+    retval->error = val->error;
+
+    if (val->client) {
+       retval->crealm = krb5_data2qbuf(val->client[0]);
+       if (!retval->crealm) {
+           *error = ENOMEM;
+           goto errout;
+       }
+       retval->cname = krb5_principal2KRB5_PrincipalName(val->client, error);
+       if (!retval->cname) {
+           goto errout;
+       }
+    }
+
+    if (val->server) {
+       retval->srealm = krb5_data2qbuf(val->server[0]);
+       if (!retval->srealm) {
+           *error = ENOMEM;
+           goto errout;
+       }
+       retval->sname = krb5_principal2KRB5_PrincipalName(val->server, error);
+       if (!retval->sname) {
+           goto errout;
+       }
+    }
+    if (val->text.data) {
+       retval->e__text = krb5_data2qbuf(&val->text);
+       if (!retval->e__text) {
+           *error = ENOMEM;
+           goto errout;
+       }
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/ketpt2etpt.c b/src/lib/krb5/asn.1/ketpt2etpt.c
new file mode 100644 (file)
index 0000000..ddd8388
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_ketpt2etpt_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+
+struct type_KRB5_EncTicketPart *
+krb5_enc_tkt_part2KRB5_EncTicketPart(val, error)
+const register krb5_enc_tkt_part *val;
+register int *error;
+{
+    register struct type_KRB5_EncTicketPart *retval;
+
+    retval = (struct type_KRB5_EncTicketPart *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->confounder = val->confounder;
+    retval->flags = krb5_flags2KRB5_TicketFlags(val->flags, error);
+    if (*error) {
+       xfree(retval);
+       return(0);
+    }
+    retval->key = krb5_keyblock2KRB5_EncryptionKey(val->session, error);
+    if (!retval->key) {
+    errout:
+       free_KRB5_EncTicketPart(retval);
+       return(0);
+    }
+    retval->crealm = krb5_data2qbuf(val->client[0]);
+    if (!retval->crealm) {
+       *error = ENOMEM;
+       goto errout;
+    }
+    retval->cname = krb5_principal2KRB5_PrincipalName(val->client, error);
+    if (!retval->cname) {
+       goto errout;
+    }
+    retval->transited = krb5_data2qbuf(&(val->transited));
+    if (!retval->transited) {
+       *error = ENOMEM;
+       goto errout;
+    }
+    retval->authtime = unix2gentime(val->times.authtime, error);
+    if (!retval->authtime) {
+       goto errout;
+    }
+    retval->starttime = unix2gentime(val->times.starttime, error);
+    if (!retval->starttime) {
+       goto errout;
+    }
+    retval->endtime = unix2gentime(val->times.endtime, error);
+    if (!retval->endtime) {
+       goto errout;
+    }
+    if (val->flags & TKT_FLG_RENEWABLE) {
+       retval->renew__till = unix2gentime(val->times.renew_till, error);
+       if (!retval->renew__till) {
+           goto errout;
+       }
+    }
+    retval->caddr = krb5_address2KRB5_HostAddresses(val->caddrs, error);
+    if (!retval->caddr) {
+       goto errout;
+    }
+    if (val->authorization_data && *val->authorization_data) {
+       retval->authorization__data =
+           krb5_authdata2KRB5_AuthorizationData(val->authorization_data, error);
+       if (!retval->authorization__data) {
+           goto errout;
+       }
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kkdcr2kdcr.c b/src/lib/krb5/asn.1/kkdcr2kdcr.c
new file mode 100644 (file)
index 0000000..617a3f0
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kkdcr2kdcr_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+static struct type_KRB5_KDC__REP *
+krb5_kdc_rep2KRB5_KDC__REP(val, type, error)
+const register krb5_kdc_rep *val;
+const krb5_msgtype type;
+register int *error;
+{
+    register struct type_KRB5_KDC__REP *retval;
+
+    retval = (struct type_KRB5_KDC__REP *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = type;
+
+    retval->crealm = krb5_data2qbuf(val->client[0]);
+    if (!retval->crealm) {
+       *error = ENOMEM;
+    errout:
+       free_KRB5_KDC__REP(retval);
+       return(0);
+    }
+    retval->cname = krb5_principal2KRB5_PrincipalName(val->client, error);
+    if (!retval->cname) {
+       goto errout;
+    }
+    retval->etype = val->etype;
+    retval->ckvno = val->ckvno;
+
+    retval->ticket = krb5_ticket2KRB5_Ticket(val->ticket, error);
+    if (!retval->ticket) {
+       goto errout;
+    }
+    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    if (!retval->enc__part) {
+       *error = ENOMEM;
+       goto errout;
+    }
+    return(retval);
+}
+
diff --git a/src/lib/krb5/asn.1/kkey2enck.c b/src/lib/krb5/asn.1/kkey2enck.c
new file mode 100644 (file)
index 0000000..cc61190
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kkey2enck_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_EncryptionKey *
+krb5_keyblock2KRB5_EncryptionKey(val, error)
+const krb5_keyblock *val;
+register int *error;
+{
+    PE pe;
+    register struct type_KRB5_EncryptionKey *retval;
+    struct qbuf *temp;
+
+    pe = gens2prim(val->contents, val->length);
+    if (!pe) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    } else
+       *error = 0;
+
+    temp = prim2qb(pe);
+    if (!temp)
+       *error = pe->pe_errno + ISODE_50_PE_ERR_NONE;
+    (void) pe_free(pe);
+
+    if (!temp)
+       return(0);
+
+    retval = (struct type_KRB5_EncryptionKey *) xmalloc(sizeof(*retval));
+    if (!retval) {
+       goto nomem;
+    }
+
+    retval->keytype = val->keytype;
+    retval->session = temp;
+    
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/klsrq2lsrq.c b/src/lib/krb5/asn.1/klsrq2lsrq.c
new file mode 100644 (file)
index 0000000..3a6cd0d
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_klsrq2lsrq_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_LastReq *
+krb5_last_req2KRB5_LastReq(val, error)
+register krb5_last_req_entry * const *val;
+register int *error;
+{
+    register struct type_KRB5_LastReq *retval;
+    register krb5_last_req_entry * const *temp;
+    register int i;
+
+    /* count elements */
+    for (i = 0, temp = val; *temp; temp++,i++);
+
+    retval = (struct type_KRB5_LastReq *)
+       xmalloc(sizeof(*retval) + max(0,i-1)*sizeof(retval->element_KRB5_4[0]));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+    retval->nelem = i;
+    for (i = 0; i < retval->nelem; i++) {
+       retval->element_KRB5_4[i] = (struct element_KRB5_5 *)
+           xmalloc(sizeof(*(retval->element_KRB5_4[i])));
+       if (!retval->element_KRB5_4[i]) {
+           retval->nelem = i;
+           free_KRB5_LastReq(retval);
+           *error = ENOMEM;
+           return(0);
+       }           
+       retval->element_KRB5_4[i]->lr__type = val[i]->lr_type;
+       retval->element_KRB5_4[i]->lr__value = val[i]->value;
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kprep2prep.c b/src/lib/krb5/asn.1/kprep2prep.c
new file mode 100644 (file)
index 0000000..d3747bd
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kprep2prep_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_EncKrbPrivPart *
+krb5_priv_enc_part2KRB5_EncKrbPrivPart(val, error)
+const register krb5_priv_enc_part *val;
+register int *error;
+{
+    register struct type_KRB5_EncKrbPrivPart *retval;
+    retval = (struct type_KRB5_EncKrbPrivPart *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->user__data = krb5_data2qbuf(&(val->user_data));
+    if (!retval->user__data) {
+       xfree(retval);
+       *error = ENOMEM;
+       return(0);
+    }
+    retval->timestamp = unix2gentime(val->timestamp, error);
+    if (!retval->timestamp) {
+       free_KRB5_EncKrbPrivPart(retval);
+       return(0);
+    }
+    retval->msec = val->msec;
+    retval->addresses = krb5_address2KRB5_HostAddresses(val->addresses, error);
+    if (!retval->addresses) {
+       free_KRB5_EncKrbPrivPart(retval);
+       return(0);
+    }
+
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kprin2prin.c b/src/lib/krb5/asn.1/kprin2prin.c
new file mode 100644 (file)
index 0000000..d0e47f4
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kprin2prin_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_PrincipalName *
+krb5_principal2KRB5_PrincipalName(val, error)
+const krb5_principal val;
+register int *error;
+{
+    register int i;
+    register struct type_KRB5_PrincipalName *retval;
+
+    /* count elements */
+    for (i = 0; val[i]; i++);
+
+    i--;                               /* skip the realm */
+
+    retval = (struct type_KRB5_PrincipalName *)
+       xmalloc(sizeof(*retval)+max(0,i-1)*sizeof(retval->GeneralString[0]));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    retval->nelem = i;
+    for (i = 1; i <= retval->nelem; i++) { /* still skipping realm */
+       retval->GeneralString[i-1] = krb5_data2qbuf(val[i]);
+       if (!retval->GeneralString[i-1]) {
+           /* clean up */
+           retval->nelem = i-1;
+           free_KRB5_PrincipalName(retval);
+           *error = ENOMEM;
+           return(0);
+       }
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kpriv2priv.c b/src/lib/krb5/asn.1/kpriv2priv.c
new file mode 100644 (file)
index 0000000..6226aa2
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kpriv2priv_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_KRB__PRIV *
+krb5_priv2KRB5_KRB__PRIV(val, error)
+const register krb5_priv *val;
+register int *error;
+{
+    register struct type_KRB5_KRB__PRIV *retval;
+    retval = (struct type_KRB5_KRB__PRIV *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = KRB5_PRIV;
+
+    retval->etype = val->etype;
+    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    if (!retval->enc__part) {
+       free_KRB5_KRB__PRIV(retval);
+       *error = ENOMEM;
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/ksafe2safe.c b/src/lib/krb5/asn.1/ksafe2safe.c
new file mode 100644 (file)
index 0000000..464693b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_ksafe2safe_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_KRB__SAFE *
+krb5_safe2KRB5_KRB__SAFE(val, error)
+const register krb5_safe *val;
+register int *error;
+{
+    register struct type_KRB5_KRB__SAFE *retval;
+    retval = (struct type_KRB5_KRB__SAFE *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = KRB5_SAFE;
+
+    retval->user__data = krb5_data2qbuf(&(val->user_data));
+    if (!retval->user__data) {
+       xfree(retval);
+       *error = ENOMEM;
+       return(0);
+    }
+    retval->timestamp = unix2gentime(val->timestamp, error);
+    if (!retval->timestamp) {
+    errout:
+       free_KRB5_KRB__SAFE(retval);
+       return(0);
+    }
+    retval->msec = val->msec;
+    retval->addresses = krb5_address2KRB5_HostAddresses(val->addresses, error);
+    if (!retval->addresses) {
+       goto errout;
+    }
+    retval->checksum = krb5_checksum2KRB5_Checksum(val->checksum, error);
+    if (!retval->checksum) {
+       goto errout;
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/ktgrq2tgrq.c b/src/lib/krb5/asn.1/ktgrq2tgrq.c
new file mode 100644 (file)
index 0000000..f85c207
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_ktgrq2tgrq_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_TGS__REQ *
+krb5_tgs_req2KRB5_TGS__REQ(val, error)
+const register krb5_tgs_req *val;
+register int *error;
+{
+    register struct type_KRB5_TGS__REQ *retval;
+    retval = (struct type_KRB5_TGS__REQ *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->header = krb5_data2qbuf(&(val->header));
+    if (!retval->header) {
+       xfree(retval);
+       *error = ENOMEM;
+       return(0);
+    }
+    retval->tgs__request = krb5_data2qbuf(&(val->tgs_request));
+    if (!retval->tgs__request) {
+       xfree(retval->header);
+       xfree(retval);
+       *error = ENOMEM;
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/ktgsr2kdcr.c b/src/lib/krb5/asn.1/ktgsr2kdcr.c
new file mode 100644 (file)
index 0000000..499e0ce
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_ktgsr2kdcr_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_KDC__REP *
+krb5_tgs_rep2KRB5_KDC__REP(val, error)
+const register krb5_kdc_rep *val;
+register int *error;
+{
+    return krb5_kdc_rep2KRB5_KDC__REP(val, KRB5_TGS_REP, error);
+}
diff --git a/src/lib/krb5/asn.1/ktkt2tkt.c b/src/lib/krb5/asn.1/ktkt2tkt.c
new file mode 100644 (file)
index 0000000..fecff7d
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_ktkt2tkt_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_Ticket *
+krb5_ticket2KRB5_Ticket(val, error)
+const register krb5_ticket *val;
+register int *error;
+{
+    register struct type_KRB5_Ticket *retval;
+
+    retval = (struct type_KRB5_Ticket *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->tkt__vno = KRB5_PVNO;
+    retval->srealm = krb5_data2qbuf(val->server[0]);
+    if (!retval->srealm) {
+       *error = ENOMEM;
+    errout:
+       free_KRB5_Ticket(retval);
+       return(0);
+    }
+    retval->sname = krb5_principal2KRB5_PrincipalName(val->server, error);
+    if (!retval->sname) {
+       goto errout;
+    }
+
+    retval->etype = val->etype;
+
+    retval->skvno = val->skvno;
+    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    if (!retval->enc__part) {
+       *error = ENOMEM;
+       goto errout;
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/lsrq2klsrq.c b/src/lib/krb5/asn.1/lsrq2klsrq.c
new file mode 100644 (file)
index 0000000..23f7bec
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_lsrq2klsrq_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_last_req_entry **
+KRB5_LastReq2krb5_last_req(val, error)
+const struct type_KRB5_LastReq *val;
+register int *error;
+{
+    register krb5_last_req_entry **retval;
+    register int i;
+
+    /* plus one for null terminator */
+    retval = (krb5_last_req_entry **) xcalloc(val->nelem + 1,
+                                             sizeof(krb5_last_req_entry *));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    for (i = 0; i < val->nelem; i++) {
+       retval[i] = (krb5_last_req_entry *) xmalloc(sizeof(*retval[i]));
+       if (!retval[i]) {
+           krb5_free_last_req(retval);
+           *error = ENOMEM;
+           return(0);
+       }
+       retval[i]->value = val->element_KRB5_4[i]->lr__value;
+       retval[i]->lr_type = val->element_KRB5_4[i]->lr__type;
+    }
+    retval[i] = 0;
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/prep2kprep.c b/src/lib/krb5/asn.1/prep2kprep.c
new file mode 100644 (file)
index 0000000..d04c541
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_prep2kprep_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_priv_enc_part *
+KRB5_EncKrbPrivPart2krb5_priv_enc_part(val, error)
+const register struct type_KRB5_EncKrbPrivPart *val;
+register int *error;
+{
+    register krb5_priv_enc_part *retval;
+    krb5_data *temp;
+
+    retval = (krb5_priv_enc_part *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    temp = qbuf2krb5_data(val->user__data, error);
+    if (temp) {
+       retval->user_data = *temp;
+       xfree(temp);
+    } else {
+       xfree(retval);
+       return(0);
+    }
+    retval->timestamp = gentime2unix(val->timestamp, error);
+    if (*error) {
+       krb5_free_priv_enc_part(retval);
+       return(0);
+    }
+    retval->msec = val->msec;
+    retval->addresses = KRB5_HostAddresses2krb5_address(val->addresses, error);
+    if (!retval->addresses) {
+       krb5_free_priv_enc_part(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/prin2kprin.c b/src/lib/krb5/asn.1/prin2kprin.c
new file mode 100644 (file)
index 0000000..d7a3176
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_prin2kprin_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_principal
+KRB5_PrincipalName2krb5_principal(val, realm, error)
+const struct type_KRB5_PrincipalName *val;
+const struct type_KRB5_Realm *realm;
+register int *error;
+{
+    register krb5_principal retval;
+    register int i;
+
+    /* plus one for the realm, plus one for null term */
+    retval = (krb5_principal) xcalloc(val->nelem + 2, sizeof(krb5_data *));
+                                            
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+
+    retval[0] = qbuf2krb5_data(realm, error);
+    if (!retval[0]) {
+       xfree(retval);
+       return(0);
+    }
+    for (i = 0; i < val->nelem; i++) {
+       retval[i+1] = qbuf2krb5_data(val->GeneralString[i], error);
+       if (!retval[i+1]) {
+           krb5_free_principal(retval);
+           return(0);
+       }
+    }
+    retval[i+1] = 0;
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/priv2kpriv.c b/src/lib/krb5/asn.1/priv2kpriv.c
new file mode 100644 (file)
index 0000000..e7d0acd
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_priv2kpriv_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_priv *
+KRB5_KRB__PRIV2krb5_priv(val, error)
+const register struct type_KRB5_KRB__PRIV *val;
+register int *error;
+{
+    register krb5_priv *retval;
+    krb5_data *temp;
+
+    retval = (krb5_priv *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    retval->etype = val->etype;
+
+    temp = qbuf2krb5_data(val->enc__part, error);
+    if (temp) {
+       retval->enc_part = *temp;
+       xfree(temp);
+    } else {
+       xfree(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/qbuf2data.c b/src/lib/krb5/asn.1/qbuf2data.c
new file mode 100644 (file)
index 0000000..cc81ba0
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_qbuf2data_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_data *
+qbuf2krb5_data(val, error)
+const struct qbuf *val;
+register int *error;
+{
+    krb5_data *retval;
+    if (qb_pullup(val) != OK) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    }
+    retval = (krb5_data *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       goto nomem;
+    }
+    retval->length = val->qb_forw->qb_len;
+    retval->data = (char *)xmalloc(val->qb_forw->qb_len);
+    if (!retval->data) {
+       xfree(retval);
+       goto nomem;
+    }
+    xbcopy(val->qb_forw->qb_data, retval->data,
+         val->qb_forw->qb_len);
+    return(retval);
+}
+
diff --git a/src/lib/krb5/asn.1/safe2ksafe.c b/src/lib/krb5/asn.1/safe2ksafe.c
new file mode 100644 (file)
index 0000000..118bec1
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_safe2ksafe_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_safe *
+KRB5_KRB__SAFE2krb5_safe(val, error)
+const register struct type_KRB5_KRB__SAFE *val;
+register int *error;
+{
+    register krb5_safe *retval;
+    krb5_data *temp;
+
+    retval = (krb5_safe *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    temp = qbuf2krb5_data(val->user__data, error);
+    if (temp) {
+       retval->user_data = *temp;
+       xfree(temp);
+    } else {
+       xfree(retval);
+       return(0);
+    }
+    retval->timestamp = gentime2unix(val->timestamp, error);
+    if (*error) {
+    errout:
+       krb5_free_safe(retval);
+       return(0);
+    }
+    retval->msec = val->msec;
+    retval->addresses = KRB5_HostAddresses2krb5_address(val->addresses, error);
+    if (!retval->addresses) {
+       goto errout;
+    }
+    retval->checksum = KRB5_Checksum2krb5_checksum(val->checksum, error);
+    if (!retval->checksum) {
+       goto errout;
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/tgrq2ktgrq.c b/src/lib/krb5/asn.1/tgrq2ktgrq.c
new file mode 100644 (file)
index 0000000..20de5b8
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_tgrq2ktgrq_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_tgs_req *
+KRB5_TGS__REQ2krb5_tgs_req(val, error)
+const register struct type_KRB5_TGS__REQ *val;
+register int *error;
+{
+    register krb5_tgs_req *retval;
+    krb5_data *temp;
+
+    retval = (krb5_tgs_req *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+    temp = qbuf2krb5_data(val->header, error);
+    if (temp) {
+       retval->header = *temp;
+       xfree(temp);
+    } else {
+       xfree(retval);
+       return(0);
+    }
+    temp = qbuf2krb5_data(val->tgs__request, error);
+    if (temp) {
+       retval->tgs_request = *temp;
+       xfree(temp);
+    } else {
+       xfree(retval->header.data);
+       xfree(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/tkt2ktkt.c b/src/lib/krb5/asn.1/tkt2ktkt.c
new file mode 100644 (file)
index 0000000..68ef43e
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_tkt2ktkt_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_ticket *
+KRB5_Ticket2krb5_ticket(val, error)
+const register struct type_KRB5_Ticket *val;
+register int *error;
+{
+    register krb5_ticket *retval;
+    krb5_data *temp;
+
+    retval = (krb5_ticket *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero(retval, sizeof(*retval));
+
+
+    retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
+                                                      val->srealm,
+                                                      error);
+    if (!retval->server) {
+       xfree(retval);
+       return(0);
+    }
+    retval->etype = val->etype;
+    retval->skvno = val->skvno;
+
+    temp = qbuf2krb5_data(val->enc__part, error);
+    if (temp) {
+       retval->enc_part = *temp;
+       xfree(temp);
+    } else {
+       krb5_free_ticket(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/u2gen.c b/src/lib/krb5/asn.1/u2gen.c
new file mode 100644 (file)
index 0000000..3e26b3f
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <krb5/copyright.h>.
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_u2gen_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/copyright.h>
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include "KRB5-types.h"
+#include "asn1glue.h"
+#include "asn1defs.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_UNIV_GeneralizedTime *
+unix2gentime(val, error)
+const int val;
+register int *error;
+{
+    UTCtime utc;
+    struct tm *tmp;
+    PE pe;
+    struct type_UNIV_GeneralizedTime *retval;
+    long val1 = (long) val;
+
+    tmp = gmtime(&val1);               /* convert long to tm struct */
+    if (tmp->tm_year < 1900)
+       tmp->tm_year += 1900;
+    tm2ut(tmp, &utc);                  /* convert tm struct to utc struct */
+    
+    pe = gent2prim(&utc);
+    if (!pe) {
+       *error = ENOMEM;
+       return((struct type_UNIV_GeneralizedTime *) 0);
+    } else
+       *error = 0;
+    retval = prim2qb(pe);
+    if (!retval)
+       *error = pe->pe_errno + ISODE_50_PE_ERR_NONE;
+    (void) pe_free(pe);
+    return(retval);
+}
+