From f2943ec899859b418e6c2fb06511dc08503ffbe8 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Mon, 29 Sep 1997 20:42:30 +0000 Subject: [PATCH] (krb5_build_authenticator): figure out what etype to use from the keytype. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3565 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/build_auth.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/krb5/build_auth.c b/lib/krb5/build_auth.c index 3394a1136..611df614e 100644 --- a/lib/krb5/build_auth.c +++ b/lib/krb5/build_auth.c @@ -48,10 +48,25 @@ krb5_build_authenticator (krb5_context context, Authenticator **auth_result, krb5_data *result) { - Authenticator *auth = malloc(sizeof(*auth)); + Authenticator *auth; char buf[1024]; size_t len; krb5_error_code ret; + krb5_enctype enctype; + + if (auth_context->enctype) + enctype = auth_context->enctype; + else { + ret = krb5_keytype_to_etype(context, + cred->session.keytype, + &enctype); + if (ret) + return ret; + } + + auth = malloc(sizeof(*auth)); + if (auth == NULL) + return ENOMEM; auth->authenticator_vno = 5; copy_Realm(&cred->client->realm, &auth->crealm); @@ -94,7 +109,7 @@ krb5_build_authenticator (krb5_context context, ret = encode_Authenticator (buf + sizeof(buf) - 1, sizeof(buf), auth, &len); ret = krb5_encrypt (context, buf + sizeof(buf) - len, len, - auth_context->enctype, + enctype, &cred->session, result);