Initial revision
authorTheodore Tso <tytso@mit.edu>
Thu, 3 Jun 1993 00:24:01 +0000 (00:24 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 3 Jun 1993 00:24:01 +0000 (00:24 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2564 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/asn.1/cred2kcred.c [new file with mode: 0644]
src/lib/krb5/asn.1/crep2kcrep.c [new file with mode: 0644]
src/lib/krb5/asn.1/kcred2cred.c [new file with mode: 0644]
src/lib/krb5/asn.1/kcrep2crep.c [new file with mode: 0644]
src/lib/krb5/free/f_cred.c [new file with mode: 0644]
src/lib/krb5/free/f_cred_enc.c [new file with mode: 0644]

diff --git a/src/lib/krb5/asn.1/cred2kcred.c b/src/lib/krb5/asn.1/cred2kcred.c
new file mode 100644 (file)
index 0000000..6fe6d2b
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America is assumed
+ *   to require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_cred2kcred_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include <krb5/asn1.h>
+#include "asn1glue.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_cred *
+KRB5_KRB__CRED2krb5_cred(val, error)
+const register struct type_KRB5_KRB__CRED *val;
+register int *error;
+{
+    register krb5_cred *retval;
+    register int i;
+    register struct element_KRB5_12 *rv;
+    krb5_enc_data *temp;
+
+    retval = (krb5_cred *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero((char *)retval, sizeof(*retval));
+
+    /* Count tickets */
+    for (i = 0, rv = val->tickets; rv; i++, rv = rv->next);
+
+    /* plus one for null terminator */
+    retval->tickets = (krb5_ticket **) xcalloc(i + 1, sizeof(*retval->tickets));
+    if (!retval->tickets) {
+       *error = ENOMEM;
+       xfree(retval);
+       return(0);
+    }
+    
+    /* Copy tickets */
+    for (i = 0, rv = val->tickets; rv; rv = rv->next, i++) {
+       retval->tickets[i] = (krb5_ticket *) xmalloc(sizeof(*retval->tickets[i]));
+       if (!retval->tickets[i]) {
+           krb5_free_tickets(retval->tickets);
+           *error = ENOMEM;
+           xfree(retval);
+           return(0);
+       }
+       xbzero((char *)retval->tickets[i], sizeof(*retval->tickets[i]));
+
+       retval->tickets[i] = KRB5_Ticket2krb5_ticket(rv->Ticket, error);
+       if (!retval->tickets[i]) {
+           krb5_free_tickets(retval->tickets);
+           xfree(retval);
+           return(0);
+       }
+    }
+    retval->tickets[i] = 0;
+
+    /* Copy encrypted part */
+    temp = KRB5_EncryptedData2krb5_enc_data(val->enc__part, error);
+    if (temp) {
+       retval->enc_part = *temp;
+       xfree(temp);
+    } else {
+       krb5_free_tickets(retval->tickets);
+       xfree(retval);
+       return(0);
+    }
+
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/crep2kcrep.c b/src/lib/krb5/asn.1/crep2kcrep.c
new file mode 100644 (file)
index 0000000..5775cb3
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America is assumed
+ *   to require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_crep2kcrep_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include <krb5/asn1.h>
+#include "asn1glue.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+krb5_cred_enc_part *
+KRB5_EncKrbCredPart2krb5_cred_enc_part(val, error)
+const register struct type_KRB5_EncKrbCredPart *val;
+register int *error;
+{
+    register krb5_cred_enc_part *retval;
+    register int i;
+    register const struct type_KRB5_EncKrbCredPart *rv;
+    register const struct element_KRB5_14 *rv2;
+
+    retval = (krb5_cred_enc_part *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero((char *)retval, sizeof(*retval));
+
+    for (i = 0, rv = val; rv; i++, rv = rv->next);
+
+    /* plus one for null terminator */
+    retval->creds = (krb5_cred_enc_struct **) xcalloc(i + 1, sizeof(*retval->creds));
+    if (!retval->creds) {
+    nomem:
+       *error = ENOMEM;
+       return(0);
+    }
+
+    for (i = 0, rv = val; rv; rv = rv->next, i++) {
+       rv2 = rv->element_KRB5_13;
+       retval->creds[i] = (krb5_cred_enc_struct *) xmalloc(sizeof(*retval->creds[i]));
+       if (!retval->creds[i]) {
+           krb5_free_cred_enc_part(retval);
+           goto nomem;
+       }
+       xbzero((char *)retval->creds[i], sizeof(*retval->creds[i]));
+
+       retval->creds[i]->session = KRB5_EncryptionKey2krb5_keyblock(rv2->key, error);
+       if (!retval->creds[i]->session) {
+           xfree(retval->creds[i]);
+           return(0);
+       }
+       
+       if (rv2->optionals & opt_KRB5_element_KRB5_14_nonce)
+         retval->creds[i]->nonce = rv2->nonce;
+       else
+         retval->creds[i]->nonce = 0;
+       
+       retval->creds[i]->timestamp = gentime2unix(rv2->timestamp, error);
+       if (*error) {
+         errout:
+           krb5_free_cred_enc_part(retval->creds[i]);
+           return(0);
+       }
+       retval->creds[i]->usec = rv2->usec;
+       
+       if (rv2->s__address) {
+           retval->creds[i]->s_address = KRB5_HostAddress2krb5_addr(rv2->s__address, 
+                                                                    error);
+           if (!retval->creds[i]->s_address) {
+               goto errout;
+           }
+       }
+       
+       if (rv2->r__address) {
+           retval->creds[i]->r_address = KRB5_HostAddress2krb5_addr(rv2->r__address, 
+                                                                    error); 
+           if (!retval->creds[i]->r_address) {
+               goto errout;
+           }
+       }
+       
+       if (rv2->pname && rv2->prealm) {
+           retval->creds[i]->client = KRB5_PrincipalName2krb5_principal(rv2->pname,
+                                                                        rv2->prealm,
+                                                                        error);
+           if (!retval->creds[i]->client) {
+               goto errout;
+           }
+       }
+       
+       if (rv2->sname && rv2->srealm) {
+           retval->creds[i]->server = KRB5_PrincipalName2krb5_principal(rv2->sname,
+                                                                        rv2->srealm,
+                                                                        error);
+           if (!retval->creds[i]->server) {
+               goto errout;
+           }
+       }
+       
+       if (rv2->flags) {
+           retval->creds[i]->flags = KRB5_TicketFlags2krb5_flags(rv2->flags, error);
+           if (*error) {
+               xfree(retval->creds[i]);
+               return(0);
+           }
+       }
+       
+       if (rv2->authtime) {
+           retval->creds[i]->times.authtime = gentime2unix(rv2->authtime, error);
+           if (*error) {
+               goto errout;
+           }   
+       }
+       
+       if (rv2->starttime) {
+           retval->creds[i]->times.starttime = gentime2unix(rv2->starttime, error);
+           if (*error) {
+               goto errout;
+           }   
+       }
+       
+       if (rv2->endtime) {
+           retval->creds[i]->times.endtime = gentime2unix(rv2->endtime, error);
+           if (*error) {
+               goto errout;
+           }   
+       }
+       
+       if ((retval->creds[i]->flags & TKT_FLG_RENEWABLE) && rv2->renew__till) {
+           retval->creds[i]->times.renew_till = gentime2unix(rv2->renew__till, error);
+           if (*error) {
+               goto errout;
+           }   
+       }
+       
+       if (rv2->caddr) {
+           retval->creds[i]->caddrs = KRB5_HostAddresses2krb5_address(rv2->caddr, 
+                                                                      error);
+           if (!retval->creds[i]->caddrs) {
+               goto errout;
+           }
+       }
+    }
+    retval->creds[i] = 0;
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kcred2cred.c b/src/lib/krb5/asn.1/kcred2cred.c
new file mode 100644 (file)
index 0000000..9b8427d
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America is assumed
+ *   to require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kcred2cred_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include <krb5/asn1.h>
+#include "asn1glue.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+
+struct type_KRB5_KRB__CRED *
+krb5_cred2KRB5_KRB__CRED(val, error)
+const register krb5_cred *val;
+register int *error;
+{
+    register struct type_KRB5_KRB__CRED *retval;
+    register struct element_KRB5_12 *rv1 = 0, *rv2;
+    register krb5_ticket * const *temp;
+    register int i;
+    retval = (struct type_KRB5_KRB__CRED *)xmalloc(sizeof(*retval));
+    if (!retval) {
+       *error = ENOMEM;
+       return(0);
+    }
+    xbzero((char *)retval, sizeof(*retval));
+
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = KRB5_CRED;
+
+    /* Copy tickets */
+    for (i = 0, temp = val->tickets; *temp; temp++, i++, rv1 = rv2) {
+
+        rv2 = (struct element_KRB5_12 *) xmalloc(sizeof(*rv2));
+        if (!rv2) {
+        errout:
+            while (retval->tickets) {
+                free_KRB5_Ticket(retval->tickets->Ticket);
+                rv1 = retval->tickets->next;
+                free(retval->tickets);
+                retval->tickets = rv1;
+            }
+            *error = ENOMEM;
+            return(0);
+        }
+        if (rv1)
+            rv1->next = rv2;
+        xbzero((char *)rv2, sizeof (*rv2));
+        if (!retval->tickets)
+            retval->tickets = rv2;
+
+        rv2->Ticket = (struct type_KRB5_Ticket *)
+            xmalloc(sizeof(*(rv2->Ticket)));
+        if (!rv2->Ticket)
+            goto errout;
+       
+       rv2->Ticket = krb5_ticket2KRB5_Ticket(val->tickets[i], error);
+       if (!rv2->Ticket) {
+           xfree(retval->tickets);
+           return(0);
+       }
+    }
+
+    if (!retval->tickets) {
+       xfree(retval);
+       return(0);
+    }
+
+    retval->enc__part = krb5_enc_data2KRB5_EncryptedData(&(val->enc_part),
+                                                        error);
+    if (!retval->enc__part) {
+       xfree(retval);
+       return(0);
+    }
+    return(retval);
+}
diff --git a/src/lib/krb5/asn.1/kcrep2crep.c b/src/lib/krb5/asn.1/kcrep2crep.c
new file mode 100644 (file)
index 0000000..45ed99e
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1989,1990 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America is assumed
+ *   to require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * Glue between Kerberos version and ISODE 6.0 version of structures.
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_kcrep2crep_c[] =
+"$Id$";
+#endif /* lint || saber */
+
+#include <krb5/krb5.h>
+
+/*#include <time.h> */
+#include <isode/psap.h>
+#include <krb5/asn1.h>
+#include "asn1glue.h"
+
+#include <krb5/ext-proto.h>
+
+/* ISODE defines max(a,b) */
+
+struct type_KRB5_EncKrbCredPart *
+krb5_cred_enc_part2KRB5_EncKrbCredPart(val, error)
+const register krb5_cred_enc_part *val;
+register int *error;
+{
+    register struct type_KRB5_EncKrbCredPart *retval = 0, *rv1 = 0, *rv2;
+    register krb5_cred_enc_struct * const *temp;
+    register int i;
+
+    for (i = 0, temp = val->creds; *temp; temp++, i++, rv1 = rv2) {
+       
+       rv2 = (struct type_KRB5_EncKrbCredPart *) xmalloc(sizeof(*rv2));
+       if (!rv2) {
+           if (retval)
+               free_KRB5_EncKrbCredPart(retval);
+           *error = ENOMEM;
+           return(0);
+       }
+        xbzero((char *)rv2, sizeof (*rv2));
+
+        if (rv1)
+            rv1->next = rv2;
+
+        if (!retval)
+            retval = rv2;
+
+       rv2->element_KRB5_13 = (struct element_KRB5_14 *)
+           xmalloc(sizeof(*(rv2->element_KRB5_13)));
+       if (!rv2->element_KRB5_13) {
+         errout:
+           if (retval)
+               free_KRB5_AuthorizationData(retval);
+           *error = ENOMEM;
+           return(0);
+       } 
+        xbzero((char *)rv2->element_KRB5_13, sizeof (*rv2->element_KRB5_13));
+       
+       rv2->element_KRB5_13->key =
+         krb5_keyblock2KRB5_EncryptionKey(val->creds[i]->session, error);
+       if (!rv2->element_KRB5_13->key) {
+           goto errout;
+       }
+       
+       if (val->creds[i]->nonce) {
+           rv2->element_KRB5_13->nonce = val->creds[i]->nonce;
+           rv2->element_KRB5_13->optionals |= opt_KRB5_element_KRB5_14_nonce;
+       }
+       
+       rv2->element_KRB5_13->timestamp = unix2gentime(val->creds[i]->timestamp, error);
+       if (!rv2->element_KRB5_13->timestamp) {
+           goto errout;
+       }
+       
+       rv2->element_KRB5_13->usec = val->creds[i]->usec;
+       
+       if (val->creds[i]->s_address) {
+           rv2->element_KRB5_13->s__address =
+             krb5_addr2KRB5_HostAddress(val->creds[i]->s_address, error); 
+           if (!rv2->element_KRB5_13->s__address) {
+               goto errout;
+           }
+       }
+       if (val->creds[i]->r_address) {
+           rv2->element_KRB5_13->r__address =
+             krb5_addr2KRB5_HostAddress(val->creds[i]->r_address, error); 
+           if (!rv2->element_KRB5_13->r__address) {
+               goto errout;
+           }
+       }
+       
+       if (val->creds[i]->client) {
+           rv2->element_KRB5_13->prealm =
+             krb5_data2qbuf(krb5_princ_realm(val->creds[i]->client)); 
+           if (!rv2->element_KRB5_13->prealm) {
+               goto errout;
+           }
+           rv2->element_KRB5_13->pname =
+             krb5_principal2KRB5_PrincipalName(val->creds[i]->client, error); 
+           if (!rv2->element_KRB5_13->pname) {
+               goto errout;
+           }
+       }
+       
+       if (val->creds[i]->flags) {
+           rv2->element_KRB5_13->flags =
+             krb5_flags2KRB5_TicketFlags(val->creds[i]->flags, error); 
+           if (!rv2->element_KRB5_13->flags) {
+               goto errout;
+           }
+       }
+       
+       rv2->element_KRB5_13->authtime =
+         unix2gentime(val->creds[i]->times.authtime, error); 
+       if (!rv2->element_KRB5_13->authtime) {
+           goto errout;
+       }
+       if (val->creds[i]->times.starttime) {
+           rv2->element_KRB5_13->starttime =
+             unix2gentime(val->creds[i]->times.starttime, error); 
+           if (!rv2->element_KRB5_13->starttime) {
+               goto errout;
+           }
+       }
+       rv2->element_KRB5_13->endtime =
+         unix2gentime(val->creds[i]->times.endtime, error); 
+       if (!rv2->element_KRB5_13->endtime) {
+           goto errout;
+       }
+       if (val->creds[i]->flags & TKT_FLG_RENEWABLE) {
+           rv2->element_KRB5_13->renew__till =
+             unix2gentime(val->creds[i]->times.renew_till, error); 
+           if (!rv2->element_KRB5_13->renew__till) {
+               goto errout;
+           }
+       }
+       
+       if (val->creds[i]->server) {
+           rv2->element_KRB5_13->srealm =
+             krb5_data2qbuf(krb5_princ_realm(val->creds[i]->server)); 
+           if (!rv2->element_KRB5_13->srealm) {
+               *error = ENOMEM;
+               goto errout;
+           }
+           rv2->element_KRB5_13->sname =
+             krb5_principal2KRB5_PrincipalName(val->creds[i]->server, error); 
+           if (!rv2->element_KRB5_13->sname) {
+               goto errout;
+           }
+       }
+
+       if (val->creds[i]->caddrs) {
+           rv2->element_KRB5_13->caddr =
+             krb5_address2KRB5_HostAddresses(val->creds[i]->caddrs, error); 
+           if (!rv2->element_KRB5_13->caddr) {
+               goto errout;
+           }
+       }
+    }
+
+    if (retval == 0)
+       *error = ISODE_LOCAL_ERR_MISSING_PART;
+
+    return(retval);
+}
diff --git a/src/lib/krb5/free/f_cred.c b/src/lib/krb5/free/f_cred.c
new file mode 100644 (file)
index 0000000..dd35fd0
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America is assumed
+ *   to require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * krb5_free_cred()
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_f_cred_c [] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/krb5.h>
+#include <krb5/ext-proto.h>
+
+void
+krb5_free_cred(val)
+register krb5_cred *val;
+{
+    if (val->tickets)
+        krb5_free_tickets(val->tickets);
+    if (val->enc_part.ciphertext.data)
+       xfree(val->enc_part.ciphertext.data);
+    xfree(val);
+    return;
+}
diff --git a/src/lib/krb5/free/f_cred_enc.c b/src/lib/krb5/free/f_cred_enc.c
new file mode 100644 (file)
index 0000000..f3a945f
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * $Source$
+ * $Author$
+ *
+ * Copyright 1990 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America is assumed
+ *   to require a specific license from the United States Government.
+ *   It is the responsibility of any person or organization contemplating
+ *   export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ * 
+ *
+ * krb5_free_cred_enc_part()
+ */
+
+#if !defined(lint) && !defined(SABER)
+static char rcsid_f_cred_enc_c [] =
+"$Id$";
+#endif /* !lint & !SABER */
+
+#include <krb5/krb5.h>
+#include <krb5/ext-proto.h>
+
+void
+krb5_free_cred_enc_part(val)
+register krb5_cred_enc_part *val;
+{
+    register krb5_cred_enc_struct **temp;
+    
+    for (temp = val->creds; *temp; temp++) {
+       if ((*temp)->session)
+         krb5_free_keyblock((*temp)->session);
+       if ((*temp)->r_address)
+         krb5_free_address((*temp)->r_address);
+       if ((*temp)->s_address)
+         krb5_free_address((*temp)->s_address);
+       if ((*temp)->client)
+         krb5_free_principal((*temp)->client);
+       if ((*temp)->server)
+         krb5_free_principal((*temp)->server);
+       if ((*temp)->caddrs)
+         krb5_free_addresses((*temp)->caddrs);
+       xfree((*temp));
+    }
+    xfree(val);
+    return;
+}