* cc_memory.c (krb5_mcc_next_cred): Use krb5int_copy_creds_contents
authorKen Raeburn <raeburn@mit.edu>
Thu, 28 Dec 2006 02:01:12 +0000 (02:01 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 28 Dec 2006 02:01:12 +0000 (02:01 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19018 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/cc_memory.c

index 0fcfa8869aab8cc220d0efe40be90f6164f2375b..46fb6519fc1fb60e5e8b4e39526ba85a938d7f9f 100644 (file)
@@ -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;
 }
 
 /*