use krb5_copy_key
authorJohn Kohl <jtkohl@mit.edu>
Mon, 26 Mar 1990 16:51:50 +0000 (16:51 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Mon, 26 Mar 1990 16:51:50 +0000 (16:51 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@420 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/kdc_util.c

index ff9e9015ffc2c511f884d71208db88247c06904d..e437379698a7d804f99fce42032cf966f85d7d4d 100644 (file)
@@ -161,6 +161,7 @@ OLDDECLARG(krb5_keyblock **, key)
 {
     register struct kparg *whoisit = (struct kparg *)keyprocarg;
     register krb5_keyblock *newkey;
+    krb5_error_code retval;
 
     if (vno != whoisit->dbentry->kvno)
        return KRB5KRB_AP_ERR_BADKEYVER;
@@ -168,12 +169,8 @@ OLDDECLARG(krb5_keyblock **, key)
        return KRB5KRB_AP_ERR_NOKEY;
     if (!(newkey = (krb5_keyblock *)malloc(sizeof(*newkey))))
        return ENOMEM;
-    *newkey = *whoisit->key;
-    if (!(newkey->contents = (krb5_octet *)malloc(newkey->length))) {
-       free((char *)newkey);
-       return ENOMEM;
-    }
-    bcopy((char *)whoisit->key, (char *)newkey->contents, newkey->length);
+    if (retval = krb5_copy_keyblock(whoisit->key, newkey))
+       return retval;
     *key = newkey;
     return 0;
 }