diff options
Diffstat (limited to 'src/krb524')
-rw-r--r-- | src/krb524/ChangeLog | 5 | ||||
-rw-r--r-- | src/krb524/krb524d.c | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index 9240e00..28707cc 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,3 +1,8 @@ +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(). diff --git a/src/krb524/krb524d.c b/src/krb524/krb524d.c index d856e12..4d55b88 100644 --- a/src/krb524/krb524d.c +++ b/src/krb524/krb524d.c @@ -421,7 +421,18 @@ krb5_error_code lookup_service_key(context, p, ktype, kvno, key, kvnop) 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); |