(krb5_km_req): use krb5_expand_hostname_realms

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7780 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-01-09 09:20:01 +00:00
parent 62bfc36ee5
commit 171ae91fed

View File

@@ -45,7 +45,7 @@ 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 ret;
krb5_creds this_cred, *cred; krb5_creds this_cred, *cred;
char **realms; char **realms;
krb5_data realm_data; krb5_data realm_data;
@@ -53,45 +53,41 @@ krb5_mk_req(krb5_context context,
memset(&this_cred, 0, sizeof(this_cred)); memset(&this_cred, 0, sizeof(this_cred));
r = krb5_cc_get_principal(context, ccache, &this_cred.client); ret = krb5_cc_get_principal(context, ccache, &this_cred.client);
if(r) if(ret)
return r; return ret;
r = krb5_expand_hostname (context, hostname, &real_hostname); ret = krb5_expand_hostname_realms (context, hostname,
if (r) { &real_hostname, &realms);
if (ret) {
krb5_free_principal (context, this_cred.client); krb5_free_principal (context, this_cred.client);
return r; return ret;
} }
r = krb5_get_host_realm(context, real_hostname, &realms);
if (r) {
krb5_free_principal (context, this_cred.client);
return r;
}
realm_data.length = strlen(*realms); realm_data.length = strlen(*realms);
realm_data.data = *realms; realm_data.data = *realms;
r = krb5_build_principal (context, &this_cred.server, ret = krb5_build_principal (context, &this_cred.server,
strlen(*realms), strlen(*realms),
*realms, *realms,
service, service,
real_hostname, real_hostname,
NULL); NULL);
free (real_hostname); free (real_hostname);
krb5_free_host_realm (context, realms); krb5_free_host_realm (context, realms);
if (r) { if (ret) {
krb5_free_principal (context, this_cred.client); krb5_free_principal (context, this_cred.client);
return r; return ret;
} }
this_cred.times.endtime = 0; this_cred.times.endtime = 0;
if (auth_context && *auth_context && (*auth_context)->keytype) if (auth_context && *auth_context && (*auth_context)->keytype)
this_cred.session.keytype = (*auth_context)->keytype; this_cred.session.keytype = (*auth_context)->keytype;
r = krb5_get_credentials (context, 0, ccache, &this_cred, &cred); ret = krb5_get_credentials (context, 0, ccache, &this_cred, &cred);
if (r) if (ret)
return r; return ret;
return krb5_mk_req_extended (context, return krb5_mk_req_extended (context,
auth_context, auth_context,