(krb5_mk_req_exact): new function that takes a krb5_principal

(krb5_mk_req): use krb5_mk_req_exact


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@9167 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-11-15 06:50:53 +00:00
parent cd3d6b4191
commit 9c35b05242

View File

@@ -36,19 +36,16 @@
RCSID("$Id$"); RCSID("$Id$");
krb5_error_code krb5_error_code
krb5_mk_req(krb5_context context, krb5_mk_req_exact(krb5_context context,
krb5_auth_context *auth_context, krb5_auth_context *auth_context,
const krb5_flags ap_req_options, const krb5_flags ap_req_options,
const char *service, const krb5_principal server,
const char *hostname, krb5_data *in_data,
krb5_data *in_data, krb5_ccache ccache,
krb5_ccache ccache, krb5_data *outbuf)
krb5_data *outbuf)
{ {
krb5_error_code ret; krb5_error_code ret;
krb5_creds this_cred, *cred; krb5_creds this_cred, *cred;
char **realms;
char *real_hostname;
memset(&this_cred, 0, sizeof(this_cred)); memset(&this_cred, 0, sizeof(this_cred));
@@ -57,31 +54,18 @@ krb5_mk_req(krb5_context context,
if(ret) if(ret)
return ret; return ret;
ret = krb5_expand_hostname_realms (context, hostname, ret = krb5_copy_principal (context, server, &this_cred.server);
&real_hostname, &realms);
if (ret) { if (ret) {
krb5_free_principal (context, this_cred.client); krb5_free_creds_contents (context, &this_cred);
return ret; return ret;
} }
ret = krb5_build_principal (context, &this_cred.server,
strlen(*realms),
*realms,
service,
real_hostname,
NULL);
free (real_hostname);
krb5_free_host_realm (context, realms);
if (ret) {
krb5_free_principal (context, this_cred.client);
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;
ret = krb5_get_credentials (context, 0, ccache, &this_cred, &cred); ret = krb5_get_credentials (context, 0, ccache, &this_cred, &cred);
krb5_free_creds_contents(context, &this_cred);
if (ret) if (ret)
return ret; return ret;
@@ -92,3 +76,39 @@ krb5_mk_req(krb5_context context,
cred, cred,
outbuf); outbuf);
} }
krb5_error_code
krb5_mk_req(krb5_context context,
krb5_auth_context *auth_context,
const krb5_flags ap_req_options,
const char *service,
const char *hostname,
krb5_data *in_data,
krb5_ccache ccache,
krb5_data *outbuf)
{
krb5_error_code ret;
char **realms;
char *real_hostname;
krb5_principal server;
ret = krb5_expand_hostname_realms (context, hostname,
&real_hostname, &realms);
if (ret)
return ret;
ret = krb5_build_principal (context, &server,
strlen(*realms),
*realms,
service,
real_hostname,
NULL);
free (real_hostname);
krb5_free_host_realm (context, realms);
if (ret)
return ret;
ret = krb5_mk_req_exact (context, auth_context, ap_req_options,
server, in_data, ccache, outbuf);
krb5_free_principal (context, server);
return ret;
}