From: Chris Provenzano Date: Mon, 7 Aug 1995 15:49:12 +0000 (+0000) Subject: Hacks to get it to compile with new kdb format X-Git-Tag: krb5-1.0-beta6~1394 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=560c9c3d6922f4144d8165bff5d9523226bc5700;p=krb5.git Hacks to get it to compile with new kdb format git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6430 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index 26e6ec5ec..60e202588 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,4 +1,8 @@ +Mon Aug 07 11:25:53 1995 Chris Provenzano (proven@mitedu) + + * krb524d.c: Hacks to get it to compile with new kdb format. + Thu Jul 27 15:14:15 EDT 1995 Paul Park (pjpark@mit.edu) * krb524d.c - Use the etype which is supplied in the krb5_keytype_array specified by the master key type. diff --git a/src/krb524/krb524d.c b/src/krb524/krb524d.c index b76b283c0..66f74c6d1 100644 --- a/src/krb524/krb524d.c +++ b/src/krb524/krb524d.c @@ -353,36 +353,42 @@ krb5_error_code lookup_service_key(context, p, ktype, key) /* taken from kdc/kdc_util.c, and modified somewhat */ krb5_error_code kdc_get_server_key(context, service, key, kvno) - krb5_context context; - krb5_principal service; - krb5_keyblock *key; - krb5_kvno *kvno; + krb5_context context; + krb5_principal service; + krb5_keyblock *key; + krb5_kvno *kvno; { - krb5_error_code ret; - int nprincs; - krb5_db_entry server; - krb5_boolean more; - - nprincs = 1; - if ((ret = krb5_db_get_principal(context, service, &server, &nprincs, &more))) - return(ret); + krb5_error_code ret; + int nprincs; + krb5_db_entry server; + krb5_boolean more; + int i, vno, ok_key; + + nprincs = 1; + if ((ret = krb5_db_get_principal(context, service, &server, + &nprincs, &more))) + return(ret); - if (more) { - krb5_db_free_principal(context, &server, nprincs); - return(KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE); - } else if (nprincs != 1) { - krb5_db_free_principal(context, &server, nprincs); - return(KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN); - } - - /* - * convert server.key into a real key (it is encrypted in the - * database) - */ - ret = krb5_kdb_decrypt_key(context, &master_encblock, &server.key, key); - if (kvno) - *kvno = server.kvno; - krb5_db_free_principal(context, &server, nprincs); - return ret; + if (more) { + krb5_db_free_principal(context, &server, nprincs); + return(KRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE); + } else if (nprincs != 1) { + krb5_db_free_principal(context, &server, nprincs); + return(KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN); + } + + /* convert server key into a real key (it is encrypted in the database) */ + for (vno = i = 0; i < server.n_key_data; i++) { + if (vno < server.key_data[i].key_data_kvno) { + vno = server.key_data[i].key_data_kvno; + ok_key = i; + } + } + ret = krb5_dbekd_decrypt_key_data(context, &master_encblock, + &server.key_data[ok_key], key, NULL); + krb5_db_free_principal(context, &server, nprincs); + if (kvno) + *kvno = vno; + return ret; }