From: Ken Raeburn Date: Thu, 28 Dec 2006 02:01:12 +0000 (+0000) Subject: * cc_memory.c (krb5_mcc_next_cred): Use krb5int_copy_creds_contents X-Git-Tag: krb5-1.7-alpha1~1382 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2e7531030c5cb7e050b56e28e59c0ee3958e7e32;p=krb5.git * cc_memory.c (krb5_mcc_next_cred): Use krb5int_copy_creds_contents git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19018 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/cc_memory.c b/src/lib/krb5/ccache/cc_memory.c index 0fcfa8869..46fb6519f 100644 --- a/src/lib/krb5/ccache/cc_memory.c +++ b/src/lib/krb5/ccache/cc_memory.c @@ -333,7 +333,6 @@ krb5_mcc_next_cred(krb5_context context, krb5_ccache id, { krb5_mcc_cursor mcursor; krb5_error_code retval; - krb5_data *scratch; /* Once the node in the linked list is created, it's never modified, so we don't need to worry about locking here. (Note @@ -343,53 +342,12 @@ krb5_mcc_next_cred(krb5_context context, krb5_ccache id, return KRB5_CC_END; memset(creds, 0, sizeof(krb5_creds)); if (mcursor->creds) { - *creds = *mcursor->creds; - retval = krb5_copy_principal(context, mcursor->creds->client, &creds->client); - if (retval) - return retval; - retval = krb5_copy_principal(context, mcursor->creds->server, - &creds->server); - if (retval) - goto cleanclient; - retval = krb5_copy_keyblock_contents(context, &mcursor->creds->keyblock, - &creds->keyblock); - if (retval) - goto cleanserver; - retval = krb5_copy_addresses(context, mcursor->creds->addresses, - &creds->addresses); - if (retval) - goto cleanblock; - retval = krb5_copy_data(context, &mcursor->creds->ticket, &scratch); - if (retval) - goto cleanaddrs; - creds->ticket = *scratch; - krb5_xfree(scratch); - retval = krb5_copy_data(context, &mcursor->creds->second_ticket, &scratch); - if (retval) - goto cleanticket; - creds->second_ticket = *scratch; - krb5_xfree(scratch); - retval = krb5_copy_authdata(context, mcursor->creds->authdata, - &creds->authdata); - if (retval) - goto clearticket; + retval = krb5int_copy_creds_contents(context, mcursor->creds, creds); + if (retval) + return retval; } *cursor = (krb5_cc_cursor)mcursor->next; return KRB5_OK; - -clearticket: - memset(creds->ticket.data,0, (unsigned) creds->ticket.length); -cleanticket: - krb5_xfree(creds->ticket.data); -cleanaddrs: - krb5_free_addresses(context, creds->addresses); -cleanblock: - krb5_xfree(creds->keyblock.contents); -cleanserver: - krb5_free_principal(context, creds->server); -cleanclient: - krb5_free_principal(context, creds->client); - return retval; } /*