(krb5_get_in_cred): new function that is almost krb5_get_in_tkt but
doesn't write the creds to the ccache. Small fixes in krb5_get_in_tkt git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2705 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -230,7 +230,7 @@ make_pa_enc_timestamp(krb5_context context, PA_DATA *pa, krb5_keyblock *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
krb5_error_code
|
krb5_error_code
|
||||||
krb5_get_in_tkt(krb5_context context,
|
krb5_get_in_cred(krb5_context context,
|
||||||
krb5_flags options,
|
krb5_flags options,
|
||||||
const krb5_addresses *addrs,
|
const krb5_addresses *addrs,
|
||||||
const krb5_enctype *etypes,
|
const krb5_enctype *etypes,
|
||||||
@@ -240,7 +240,6 @@ krb5_get_in_tkt(krb5_context context,
|
|||||||
krb5_decrypt_proc decrypt_proc,
|
krb5_decrypt_proc decrypt_proc,
|
||||||
krb5_const_pointer decryptarg,
|
krb5_const_pointer decryptarg,
|
||||||
krb5_creds *creds,
|
krb5_creds *creds,
|
||||||
krb5_ccache ccache,
|
|
||||||
krb5_kdc_rep *ret_as_reply)
|
krb5_kdc_rep *ret_as_reply)
|
||||||
{
|
{
|
||||||
krb5_error_code ret;
|
krb5_error_code ret;
|
||||||
@@ -252,19 +251,17 @@ krb5_get_in_tkt(krb5_context context,
|
|||||||
krb5_data salt;
|
krb5_data salt;
|
||||||
krb5_keyblock *key;
|
krb5_keyblock *key;
|
||||||
size_t size;
|
size_t size;
|
||||||
union {
|
krb5_kdc_flags opts;
|
||||||
krb5_flags i;
|
|
||||||
KDCOptions f;
|
|
||||||
} opts;
|
|
||||||
PA_DATA *pa;
|
PA_DATA *pa;
|
||||||
unsigned etype;
|
unsigned etype;
|
||||||
|
|
||||||
opts.i = options;
|
opts.i = options;
|
||||||
|
|
||||||
memset(&a, 0, sizeof(a));
|
memset(&a, 0, sizeof(a));
|
||||||
|
|
||||||
a.pvno = 5;
|
a.pvno = 5;
|
||||||
a.msg_type = krb_as_req;
|
a.msg_type = krb_as_req;
|
||||||
a.req_body.kdc_options = opts.f;
|
a.req_body.kdc_options = opts.b;
|
||||||
a.req_body.cname = malloc(sizeof(*a.req_body.cname));
|
a.req_body.cname = malloc(sizeof(*a.req_body.cname));
|
||||||
a.req_body.sname = malloc(sizeof(*a.req_body.sname));
|
a.req_body.sname = malloc(sizeof(*a.req_body.sname));
|
||||||
krb5_principal2principalname (a.req_body.cname, creds->client);
|
krb5_principal2principalname (a.req_body.cname, creds->client);
|
||||||
@@ -342,17 +339,16 @@ krb5_get_in_tkt(krb5_context context,
|
|||||||
sizeof(buf),
|
sizeof(buf),
|
||||||
&a,
|
&a,
|
||||||
&req.length);
|
&req.length);
|
||||||
if (ret){
|
|
||||||
free_AS_REQ(&a);
|
free_AS_REQ(&a);
|
||||||
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
free_AS_REQ(&a);
|
|
||||||
req.data = buf + sizeof(buf) - req.length;
|
req.data = buf + sizeof(buf) - req.length;
|
||||||
|
|
||||||
ret = krb5_sendto_kdc (context, &req, &creds->client->realm, &resp);
|
ret = krb5_sendto_kdc (context, &req, &creds->client->realm, &resp);
|
||||||
if (ret) {
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
if((ret = decode_AS_REP(resp.data, resp.length, &rep.part1, &size))){
|
if((ret = decode_AS_REP(resp.data, resp.length, &rep.part1, &size))){
|
||||||
/* let's try to parse it as a KRB-ERROR */
|
/* let's try to parse it as a KRB-ERROR */
|
||||||
KRB_ERROR error;
|
KRB_ERROR error;
|
||||||
@@ -401,16 +397,41 @@ krb5_get_in_tkt(krb5_context context,
|
|||||||
memset (key->keyvalue.data, 0, key->keyvalue.length);
|
memset (key->keyvalue.data, 0, key->keyvalue.length);
|
||||||
krb5_free_keyblock (context, key);
|
krb5_free_keyblock (context, key);
|
||||||
free (key);
|
free (key);
|
||||||
#if 0
|
|
||||||
krb5_data_free (&key->keyvalue);
|
|
||||||
free (key);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ret_as_reply)
|
if (ret_as_reply)
|
||||||
*ret_as_reply = rep;
|
*ret_as_reply = rep;
|
||||||
else
|
else
|
||||||
krb5_free_kdc_rep (context, &rep);
|
krb5_free_kdc_rep (context, &rep);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
krb5_error_code
|
||||||
|
krb5_get_in_tkt(krb5_context context,
|
||||||
|
krb5_flags options,
|
||||||
|
const krb5_addresses *addrs,
|
||||||
|
const krb5_enctype *etypes,
|
||||||
|
const krb5_preauthtype *ptypes,
|
||||||
|
krb5_key_proc key_proc,
|
||||||
|
krb5_const_pointer keyseed,
|
||||||
|
krb5_decrypt_proc decrypt_proc,
|
||||||
|
krb5_const_pointer decryptarg,
|
||||||
|
krb5_creds *creds,
|
||||||
|
krb5_ccache ccache,
|
||||||
|
krb5_kdc_rep *ret_as_reply)
|
||||||
|
{
|
||||||
|
krb5_error_code ret;
|
||||||
|
|
||||||
|
ret = krb5_get_in_cred (context,
|
||||||
|
options,
|
||||||
|
addrs,
|
||||||
|
etypes,
|
||||||
|
ptypes,
|
||||||
|
key_proc,
|
||||||
|
keyseed,
|
||||||
|
decrypt_proc,
|
||||||
|
decryptarg,
|
||||||
|
creds,
|
||||||
|
ret_as_reply);
|
||||||
if(ret)
|
if(ret)
|
||||||
return ret;
|
return ret;
|
||||||
ret = krb5_cc_store_cred (context, ccache, creds);
|
ret = krb5_cc_store_cred (context, ccache, creds);
|
||||||
|
Reference in New Issue
Block a user