(krb5_mk_req_ext): figure out the correct `enctype'
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4016 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -48,34 +48,45 @@ krb5_mk_req_extended(krb5_context context,
|
|||||||
krb5_creds *in_creds,
|
krb5_creds *in_creds,
|
||||||
krb5_data *outbuf)
|
krb5_data *outbuf)
|
||||||
{
|
{
|
||||||
krb5_error_code r;
|
krb5_error_code ret;
|
||||||
krb5_data authenticator;
|
krb5_data authenticator;
|
||||||
Checksum c;
|
Checksum c;
|
||||||
Checksum *c_opt;
|
Checksum *c_opt;
|
||||||
krb5_cksumtype cksumtype;
|
krb5_cksumtype cksumtype;
|
||||||
krb5_auth_context ac;
|
krb5_auth_context ac;
|
||||||
|
krb5_enctype enctype;
|
||||||
|
|
||||||
if(auth_context) {
|
if(auth_context) {
|
||||||
if(*auth_context == NULL)
|
if(*auth_context == NULL)
|
||||||
r = krb5_auth_con_init(context, auth_context);
|
ret = krb5_auth_con_init(context, auth_context);
|
||||||
else
|
else
|
||||||
r = 0;
|
ret = 0;
|
||||||
ac = *auth_context;
|
ac = *auth_context;
|
||||||
} else
|
} else
|
||||||
r = krb5_auth_con_init(context, &ac);
|
ret = krb5_auth_con_init(context, &ac);
|
||||||
if(r)
|
if(ret)
|
||||||
return r;
|
return ret;
|
||||||
|
|
||||||
krb5_free_keyblock(context, ac->keyblock);
|
krb5_free_keyblock(context, ac->keyblock);
|
||||||
krb5_copy_keyblock(context, &in_creds->session, &ac->keyblock);
|
krb5_copy_keyblock(context, &in_creds->session, &ac->keyblock);
|
||||||
|
|
||||||
|
if (ac->enctype)
|
||||||
|
enctype = ac->enctype;
|
||||||
|
else {
|
||||||
|
ret = krb5_keytype_to_etype(context,
|
||||||
|
ac->keyblock->keytype,
|
||||||
|
&enctype);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (ac->cksumtype)
|
if (ac->cksumtype)
|
||||||
cksumtype = ac->cksumtype;
|
cksumtype = ac->cksumtype;
|
||||||
else
|
else
|
||||||
krb5_keytype_to_cksumtype (context, ac->keyblock->keytype, &cksumtype);
|
krb5_keytype_to_cksumtype (context, ac->keyblock->keytype, &cksumtype);
|
||||||
|
|
||||||
if (in_data) {
|
if (in_data) {
|
||||||
r = krb5_create_checksum (context,
|
ret = krb5_create_checksum (context,
|
||||||
cksumtype,
|
cksumtype,
|
||||||
in_data->data,
|
in_data->data,
|
||||||
in_data->length,
|
in_data->length,
|
||||||
@@ -86,20 +97,21 @@ krb5_mk_req_extended(krb5_context context,
|
|||||||
c_opt = NULL;
|
c_opt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = krb5_build_authenticator (context,
|
ret = krb5_build_authenticator (context,
|
||||||
ac,
|
ac,
|
||||||
|
enctype,
|
||||||
in_creds,
|
in_creds,
|
||||||
c_opt,
|
c_opt,
|
||||||
NULL,
|
NULL,
|
||||||
&authenticator);
|
&authenticator);
|
||||||
if (c_opt)
|
if (c_opt)
|
||||||
free_Checksum (c_opt);
|
free_Checksum (c_opt);
|
||||||
if (r)
|
if (ret)
|
||||||
return r;
|
return ret;
|
||||||
|
|
||||||
r = krb5_build_ap_req (context, in_creds, ap_req_options,
|
ret = krb5_build_ap_req (context, enctype, in_creds, ap_req_options,
|
||||||
authenticator, outbuf);
|
authenticator, outbuf);
|
||||||
if(auth_context == NULL)
|
if(auth_context == NULL)
|
||||||
krb5_auth_con_free(context, ac);
|
krb5_auth_con_free(context, ac);
|
||||||
return r;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user