+2002-03-06 Ken Raeburn <raeburn@mit.edu>
+
+ * krb524d.c (lookup_service_key): Copy key block and free up
+ keytab entry data.
+
2001-12-05 Ezra Peisach <epeisach@mit.edu>
* krb524d.c (cleanup_and_exit): Call krb5_klog_close().
if (use_keytab) {
if ((ret = krb5_kt_get_entry(context, kt, p, kvno, ktype, &entry)))
return ret;
- memcpy(key, (char *) &entry.key, sizeof(krb5_keyblock));
+ *key = entry.key;
+ key->contents = malloc(key->length);
+ if (key->contents)
+ memcpy(key->contents, entry.key.contents, key->length);
+ else if (key->length) {
+ /* out of memory? */
+ ret = errno;
+ memset (key, 0, sizeof (*key));
+ return ret;
+ }
+
+ krb5_kt_free_entry(context, &entry);
return 0;
} else if (use_master) {
return kdc_get_server_key(context, p, key, kvnop, ktype, kvno);