From b521a2fb43c36f0267d1803b83f7a11fdd2ec74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Sun, 14 Mar 2004 16:16:58 +0000 Subject: [PATCH] (krb5_mk_rep): if KRB5_AUTH_CONTEXT_USE_SUBKEY is set send subkey (generate if needed) git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13518 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/mk_rep.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/krb5/mk_rep.c b/lib/krb5/mk_rep.c index fe414e1f4..c0a6b4b1b 100644 --- a/lib/krb5/mk_rep.c +++ b/lib/krb5/mk_rep.c @@ -55,7 +55,28 @@ krb5_mk_rep(krb5_context context, body.ctime = auth_context->authenticator->ctime; body.cusec = auth_context->authenticator->cusec; - body.subkey = NULL; + if (auth_context->flags & KRB5_AUTH_CONTEXT_USE_SUBKEY) { + if (auth_context->local_subkey == NULL) { + ret = krb5_auth_con_generatelocalsubkey(context, + auth_context, + auth_context->keyblock); + if(ret) { + krb5_set_error_string (context, + "krb5_mk_rep: generating subkey"); + free_EncAPRepPart(&body); + return ret; + } + } + ret = krb5_copy_keyblock(context, auth_context->local_subkey, + &body.subkey); + if (ret) { + krb5_set_error_string (context, + "krb5_copy_keyblock: out of memory"); + free_EncAPRepPart(&body); + return ENOMEM; + } + } else + body.subkey = NULL; if (auth_context->flags & KRB5_AUTH_CONTEXT_DO_SEQUENCE) { if(auth_context->local_seqnumber == 0) krb5_generate_seq_number (context, @@ -64,6 +85,7 @@ krb5_mk_rep(krb5_context context, ALLOC(body.seq_number, 1); if (body.seq_number == NULL) { krb5_set_error_string (context, "malloc: out of memory"); + free_EncAPRepPart(&body); return ENOMEM; } *(body.seq_number) = auth_context->local_seqnumber;