out_entry->timestamp = entry->timestamp;\r
out_entry->vno = entry->vno;\r
out_entry->key = entry->key; \r
+ err = krb5_copy_keyblock_contents(context, &(entry->key),\r
+ &(out_entry->key));\r
/*\r
* Coerce the enctype of the output keyblock in case we\r
* got an inexact match on the enctype.\r
*/\r
out_entry->key.enctype = enctype;\r
- err = krb5_copy_principal(context, entry->principal, &(out_entry->principal));\r
+ if(!err) {\r
+ err = krb5_copy_principal(context, \r
+ entry->principal, \r
+ &(out_entry->principal));\r
+ }\r
} else {\r
if (!err)\r
err = found_wrong_kvno ? KRB5_KT_KVNONOTFOUND : KRB5_KT_NOTFOUND;\r
entry->timestamp = mkt_cursor->entry->timestamp;\r
entry->vno = mkt_cursor->entry->vno;\r
entry->key = mkt_cursor->entry->key; \r
- err = krb5_copy_principal(context, mkt_cursor->entry->principal, &(entry->principal));\r
+ err = krb5_copy_keyblock_contents(context, &(mkt_cursor->entry->key), \r
+ &(entry->key));\r
+ if (!err) \r
+ err = krb5_copy_principal(context, mkt_cursor->entry->principal,\r
+ &(entry->principal));\r
if (!err)\r
*cursor = (krb5_kt_cursor *)mkt_cursor->next;\r
KTUNLOCK(id);\r
cursor->entry->magic = entry->magic;\r
cursor->entry->timestamp = entry->timestamp;\r
cursor->entry->vno = entry->vno;\r
- cursor->entry->key = entry->key; \r
+ err = krb5_copy_keyblock_contents(context, &(entry->key), \r
+ &(cursor->entry->key));\r
+ if (err) {\r
+ krb5_xfree(cursor->entry);\r
+ krb5_xfree(cursor);\r
+ goto done;\r
+ }\r
+\r
err = krb5_copy_principal(context, entry->principal, &(cursor->entry->principal));\r
if (err) {\r
+ krb5_free_keyblock_contents(context, &(cursor->entry->key));\r
krb5_xfree(cursor->entry);\r
krb5_xfree(cursor);\r
goto done;\r