(krb5_mk_req): use krb5_expand_hostname
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@6670 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -50,49 +50,61 @@ krb5_mk_req(krb5_context context,
|
|||||||
krb5_ccache ccache,
|
krb5_ccache ccache,
|
||||||
krb5_data *outbuf)
|
krb5_data *outbuf)
|
||||||
{
|
{
|
||||||
krb5_error_code r;
|
krb5_error_code r;
|
||||||
krb5_creds this_cred, *cred;
|
krb5_creds this_cred, *cred;
|
||||||
char **realms;
|
char **realms;
|
||||||
krb5_data realm_data;
|
krb5_data realm_data;
|
||||||
char **p;
|
char **p;
|
||||||
|
char *real_hostname;
|
||||||
|
|
||||||
memset(&this_cred, 0, sizeof(this_cred));
|
memset(&this_cred, 0, sizeof(this_cred));
|
||||||
|
|
||||||
r = krb5_cc_get_principal(context, ccache, &this_cred.client);
|
r = krb5_cc_get_principal(context, ccache, &this_cred.client);
|
||||||
|
|
||||||
if(r)
|
if(r)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = krb5_get_host_realm(context, hostname, &realms);
|
r = krb5_expand_hostname (context, hostname, &real_hostname);
|
||||||
if (r)
|
if (r) {
|
||||||
return r;
|
krb5_free_principal (context, this_cred.client);
|
||||||
realm_data.length = strlen(*realms);
|
return r;
|
||||||
realm_data.data = *realms;
|
}
|
||||||
|
|
||||||
r = krb5_build_principal (context, &this_cred.server,
|
r = krb5_get_host_realm(context, real_hostname, &realms);
|
||||||
strlen(*realms),
|
if (r) {
|
||||||
*realms,
|
krb5_free_principal (context, this_cred.client);
|
||||||
service,
|
return r;
|
||||||
hostname,
|
}
|
||||||
NULL);
|
realm_data.length = strlen(*realms);
|
||||||
for (p = realms; *p; ++p)
|
realm_data.data = *realms;
|
||||||
free (*p);
|
|
||||||
free (realms);
|
|
||||||
|
|
||||||
if (r)
|
r = krb5_build_principal (context, &this_cred.server,
|
||||||
return r;
|
strlen(*realms),
|
||||||
this_cred.times.endtime = 0;
|
*realms,
|
||||||
if (auth_context && *auth_context && (*auth_context)->keytype)
|
service,
|
||||||
this_cred.session.keytype = (*auth_context)->keytype;
|
real_hostname,
|
||||||
|
NULL);
|
||||||
|
free (real_hostname);
|
||||||
|
for (p = realms; *p; ++p)
|
||||||
|
free (*p);
|
||||||
|
free (realms);
|
||||||
|
|
||||||
r = krb5_get_credentials (context, 0, ccache, &this_cred, &cred);
|
if (r) {
|
||||||
if (r)
|
krb5_free_principal (context, this_cred.client);
|
||||||
return r;
|
return r;
|
||||||
|
}
|
||||||
|
this_cred.times.endtime = 0;
|
||||||
|
if (auth_context && *auth_context && (*auth_context)->keytype)
|
||||||
|
this_cred.session.keytype = (*auth_context)->keytype;
|
||||||
|
|
||||||
return krb5_mk_req_extended (context,
|
r = krb5_get_credentials (context, 0, ccache, &this_cred, &cred);
|
||||||
auth_context,
|
if (r)
|
||||||
ap_req_options,
|
return r;
|
||||||
in_data,
|
|
||||||
cred,
|
return krb5_mk_req_extended (context,
|
||||||
outbuf);
|
auth_context,
|
||||||
|
ap_req_options,
|
||||||
|
in_data,
|
||||||
|
cred,
|
||||||
|
outbuf);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user