2 * Copyright (c) 1997 - 2008 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #include "krb5_locl.h"
36 RCSID("$Id: get_in_tkt.c 23316 2008-06-23 04:32:32Z lha $");
38 krb5_error_code KRB5_LIB_FUNCTION
39 krb5_init_etype (krb5_context context,
42 const krb5_enctype *etypes)
46 krb5_enctype *tmp = NULL;
50 ret = krb5_get_default_in_tkt_etypes(context,
57 for (i = 0; etypes[i]; ++i)
60 *val = malloc(i * sizeof(**val));
61 if (i != 0 && *val == NULL) {
63 krb5_set_error_message(context, ret, "malloc: out of memory");
75 static krb5_error_code
76 check_server_referral(krb5_context context,
79 krb5_const_principal requested,
80 krb5_const_principal returned,
81 const krb5_keyblock const * key)
84 PA_ServerReferralData ref;
92 if (rep->kdc_rep.padata == NULL)
95 pa = krb5_find_padata(rep->kdc_rep.padata->val,
96 rep->kdc_rep.padata->len,
97 KRB5_PADATA_SERVER_REFERRAL, &i);
101 memset(&ed, 0, sizeof(ed));
102 memset(&ref, 0, sizeof(ref));
104 ret = decode_EncryptedData(pa->padata_value.data,
105 pa->padata_value.length,
109 if (len != pa->padata_value.length) {
110 free_EncryptedData(&ed);
111 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED, "Referral EncryptedData wrong");
112 return KRB5KRB_AP_ERR_MODIFIED;
115 ret = krb5_crypto_init(context, key, 0, &session);
117 free_EncryptedData(&ed);
121 ret = krb5_decrypt_EncryptedData(context, session,
122 KRB5_KU_PA_SERVER_REFERRAL,
124 free_EncryptedData(&ed);
125 krb5_crypto_destroy(context, session);
129 ret = decode_PA_ServerReferralData(data.data, data.length, &ref, &len);
131 krb5_data_free(&data);
134 krb5_data_free(&data);
136 if (strcmp(requested->realm, returned->realm) != 0) {
137 free_PA_ServerReferralData(&ref);
138 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
139 "server ref realm mismatch");
140 return KRB5KRB_AP_ERR_MODIFIED;
143 if (returned->name.name_string.len == 2 &&
144 strcmp(returned->name.name_string.val[0], KRB5_TGS_NAME) == 0)
146 const char *realm = returned->name.name_string.val[1];
148 if (ref.referred_realm == NULL
149 || strcmp(*ref.referred_realm, realm) != 0)
151 free_PA_ServerReferralData(&ref);
152 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
153 "tgt returned with wrong ref");
154 return KRB5KRB_AP_ERR_MODIFIED;
156 } else if (krb5_principal_compare(context, returned, requested) == 0) {
157 free_PA_ServerReferralData(&ref);
158 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
159 "req princ no same as returned");
160 return KRB5KRB_AP_ERR_MODIFIED;
163 if (ref.requested_principal_name) {
164 cmp = _krb5_principal_compare_PrincipalName(context,
166 ref.requested_principal_name);
168 free_PA_ServerReferralData(&ref);
169 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
170 "compare requested failed");
171 return KRB5KRB_AP_ERR_MODIFIED;
173 } else if (flags & EXTRACT_TICKET_AS_REQ) {
174 free_PA_ServerReferralData(&ref);
175 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
176 "Requested principal missing on AS-REQ");
177 return KRB5KRB_AP_ERR_MODIFIED;
180 free_PA_ServerReferralData(&ref);
184 if (krb5_principal_compare(context, requested, returned) == FALSE) {
185 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
186 "Not same server principal returned "
188 return KRB5KRB_AP_ERR_MODIFIED;
195 * Verify referral data
199 static krb5_error_code
200 check_client_referral(krb5_context context,
202 krb5_const_principal requested,
203 krb5_const_principal mapped,
204 krb5_keyblock const * key)
207 PA_ClientCanonicalized canon;
214 if (rep->kdc_rep.padata == NULL)
217 pa = krb5_find_padata(rep->kdc_rep.padata->val,
218 rep->kdc_rep.padata->len,
219 KRB5_PADATA_CLIENT_CANONICALIZED, &i);
223 ret = decode_PA_ClientCanonicalized(pa->padata_value.data,
224 pa->padata_value.length,
227 krb5_set_error_message(context, ret, "Failed to decode "
228 "PA_ClientCanonicalized");
232 ASN1_MALLOC_ENCODE(PA_ClientCanonicalizedNames, data.data, data.length,
233 &canon.names, &len, ret);
235 free_PA_ClientCanonicalized(&canon);
238 if (data.length != len)
239 krb5_abortx(context, "internal asn.1 error");
241 ret = krb5_crypto_init(context, key, 0, &crypto);
244 free_PA_ClientCanonicalized(&canon);
248 ret = krb5_verify_checksum(context, crypto, KRB5_KU_CANONICALIZED_NAMES,
249 data.data, data.length,
250 &canon.canon_checksum);
251 krb5_crypto_destroy(context, crypto);
254 krb5_set_error_message(context, ret, "Failed to verify "
255 "client canonicalized data");
256 free_PA_ClientCanonicalized(&canon);
260 if (!_krb5_principal_compare_PrincipalName(context,
262 &canon.names.requested_name))
264 free_PA_ClientCanonicalized(&canon);
265 krb5_set_error_message(context, KRB5_PRINC_NOMATCH,
266 "Requested name doesn't match"
267 " in client referral");
268 return KRB5_PRINC_NOMATCH;
270 if (!_krb5_principal_compare_PrincipalName(context,
272 &canon.names.mapped_name))
274 free_PA_ClientCanonicalized(&canon);
275 krb5_set_error_message(context, KRB5_PRINC_NOMATCH,
276 "Mapped name doesn't match"
277 " in client referral");
278 return KRB5_PRINC_NOMATCH;
284 if (krb5_principal_compare(context, requested, mapped) == FALSE) {
285 krb5_set_error_message(context, KRB5KRB_AP_ERR_MODIFIED,
286 "Not same client principal returned "
288 return KRB5KRB_AP_ERR_MODIFIED;
295 static krb5_error_code
296 decrypt_tkt (krb5_context context,
298 krb5_key_usage usage,
299 krb5_const_pointer decrypt_arg,
300 krb5_kdc_rep *dec_rep)
307 ret = krb5_crypto_init(context, key, 0, &crypto);
311 ret = krb5_decrypt_EncryptedData (context,
314 &dec_rep->kdc_rep.enc_part,
316 krb5_crypto_destroy(context, crypto);
321 ret = krb5_decode_EncASRepPart(context,
327 ret = krb5_decode_EncTGSRepPart(context,
332 krb5_data_free (&data);
339 _krb5_extract_ticket(krb5_context context,
343 krb5_const_pointer keyseed,
344 krb5_key_usage key_usage,
345 krb5_addresses *addrs,
348 krb5_decrypt_proc decrypt_proc,
349 krb5_const_pointer decryptarg)
352 krb5_principal tmp_principal;
355 krb5_timestamp sec_now;
359 if (decrypt_proc == NULL)
360 decrypt_proc = decrypt_tkt;
362 ret = (*decrypt_proc)(context, key, key_usage, decryptarg, rep);
366 /* save session key */
368 creds->session.keyvalue.length = 0;
369 creds->session.keyvalue.data = NULL;
370 creds->session.keytype = rep->enc_part.key.keytype;
371 ret = krb5_data_copy (&creds->session.keyvalue,
372 rep->enc_part.key.keyvalue.data,
373 rep->enc_part.key.keyvalue.length);
375 krb5_clear_error_string(context);
381 * this is really a ugly hack, to support using the Netbios Domain Name
382 * as realm against windows KDC's, they always return the full realm
383 * based on the DNS Name.
385 flags |= EXTRACT_TICKET_ALLOW_SERVER_MISMATCH;
386 flags |=EXTRACT_TICKET_ALLOW_CNAME_MISMATCH ;
389 /* compare client and save */
390 ret = _krb5_principalname2krb5_principal (context,
393 rep->kdc_rep.crealm);
397 /* check client referral and save principal */
398 /* anonymous here ? */
399 if((flags & EXTRACT_TICKET_ALLOW_CNAME_MISMATCH) == 0) {
400 ret = check_client_referral(context, rep,
405 krb5_free_principal (context, tmp_principal);
409 krb5_free_principal (context, creds->client);
410 creds->client = tmp_principal;
412 /* check server referral and save principal */
413 ret = _krb5_principalname2krb5_principal (context,
415 rep->kdc_rep.ticket.sname,
416 rep->kdc_rep.ticket.realm);
419 if((flags & EXTRACT_TICKET_ALLOW_SERVER_MISMATCH) == 0){
420 ret = check_server_referral(context,
427 krb5_free_principal (context, tmp_principal);
431 krb5_free_principal(context, creds->server);
432 creds->server = tmp_principal;
435 if(flags & EXTRACT_TICKET_MATCH_REALM){
436 const char *srealm = krb5_principal_get_realm(context, creds->server);
437 const char *crealm = krb5_principal_get_realm(context, creds->client);
439 if (strcmp(rep->enc_part.srealm, srealm) != 0 ||
440 strcmp(rep->enc_part.srealm, crealm) != 0)
442 ret = KRB5KRB_AP_ERR_MODIFIED;
443 krb5_clear_error_string(context);
450 if (nonce != rep->enc_part.nonce) {
451 ret = KRB5KRB_AP_ERR_MODIFIED;
452 krb5_set_error_message(context, ret, "malloc: out of memory");
458 krb5_timeofday (context, &sec_now);
459 if (rep->enc_part.flags.initial
460 && context->kdc_sec_offset == 0
461 && krb5_config_get_bool (context, NULL,
465 context->kdc_sec_offset = rep->enc_part.authtime - sec_now;
466 krb5_timeofday (context, &sec_now);
469 /* check all times */
471 if (rep->enc_part.starttime) {
472 tmp_time = *rep->enc_part.starttime;
474 tmp_time = rep->enc_part.authtime;
476 if (creds->times.starttime == 0
477 && abs(tmp_time - sec_now) > context->max_skew) {
478 ret = KRB5KRB_AP_ERR_SKEW;
479 krb5_set_error_message (context, ret,
480 "time skew (%d) larger than max (%d)",
481 abs(tmp_time - sec_now),
482 (int)context->max_skew);
486 if (creds->times.starttime != 0
487 && tmp_time != creds->times.starttime) {
488 krb5_clear_error_string (context);
489 ret = KRB5KRB_AP_ERR_MODIFIED;
493 creds->times.starttime = tmp_time;
495 if (rep->enc_part.renew_till) {
496 tmp_time = *rep->enc_part.renew_till;
500 if (creds->times.renew_till != 0
501 && tmp_time > creds->times.renew_till) {
502 krb5_clear_error_string (context);
503 ret = KRB5KRB_AP_ERR_MODIFIED;
507 creds->times.renew_till = tmp_time;
509 creds->times.authtime = rep->enc_part.authtime;
511 if (creds->times.endtime != 0
512 && rep->enc_part.endtime > creds->times.endtime) {
513 krb5_clear_error_string (context);
514 ret = KRB5KRB_AP_ERR_MODIFIED;
518 creds->times.endtime = rep->enc_part.endtime;
520 if(rep->enc_part.caddr)
521 krb5_copy_addresses (context, rep->enc_part.caddr, &creds->addresses);
523 krb5_copy_addresses (context, addrs, &creds->addresses);
525 creds->addresses.len = 0;
526 creds->addresses.val = NULL;
528 creds->flags.b = rep->enc_part.flags;
530 creds->authdata.len = 0;
531 creds->authdata.val = NULL;
534 ASN1_MALLOC_ENCODE(Ticket, creds->ticket.data, creds->ticket.length,
535 &rep->kdc_rep.ticket, &len, ret);
538 if (creds->ticket.length != len)
539 krb5_abortx(context, "internal error in ASN.1 encoder");
540 creds->second_ticket.length = 0;
541 creds->second_ticket.data = NULL;
545 memset (rep->enc_part.key.keyvalue.data, 0,
546 rep->enc_part.key.keyvalue.length);
551 static krb5_error_code
552 make_pa_enc_timestamp(krb5_context context, PA_DATA *pa,
553 krb5_enctype etype, krb5_keyblock *key)
559 EncryptedData encdata;
565 krb5_us_timeofday (context, &p.patimestamp, &usec);
569 ASN1_MALLOC_ENCODE(PA_ENC_TS_ENC, buf, buf_size, &p, &len, ret);
573 krb5_abortx(context, "internal error in ASN.1 encoder");
574 ret = krb5_crypto_init(context, key, 0, &crypto);
579 ret = krb5_encrypt_EncryptedData(context,
581 KRB5_KU_PA_ENC_TIMESTAMP,
587 krb5_crypto_destroy(context, crypto);
591 ASN1_MALLOC_ENCODE(EncryptedData, buf, buf_size, &encdata, &len, ret);
592 free_EncryptedData(&encdata);
596 krb5_abortx(context, "internal error in ASN.1 encoder");
597 pa->padata_type = KRB5_PADATA_ENC_TIMESTAMP;
598 pa->padata_value.length = len;
599 pa->padata_value.data = buf;
603 static krb5_error_code
604 add_padata(krb5_context context,
606 krb5_principal client,
607 krb5_key_proc key_proc,
608 krb5_const_pointer keyseed,
609 krb5_enctype *enctypes,
620 /* default to standard salt */
621 ret = krb5_get_pw_salt (context, client, &salt2);
625 enctypes = context->etypes;
627 for (ep = enctypes; *ep != ETYPE_NULL; ep++)
630 pa2 = realloc (md->val, (md->len + netypes) * sizeof(*md->val));
632 krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
637 for (i = 0; i < netypes; ++i) {
640 ret = (*key_proc)(context, enctypes[i], *salt, keyseed, &key);
643 ret = make_pa_enc_timestamp (context, &md->val[md->len],
645 krb5_free_keyblock (context, key);
651 krb5_free_salt(context, salt2);
655 static krb5_error_code
656 init_as_req (krb5_context context,
659 const krb5_addresses *addrs,
660 const krb5_enctype *etypes,
661 const krb5_preauthtype *ptypes,
662 const krb5_preauthdata *preauth,
663 krb5_key_proc key_proc,
664 krb5_const_pointer keyseed,
671 memset(a, 0, sizeof(*a));
674 a->msg_type = krb_as_req;
675 a->req_body.kdc_options = opts;
676 a->req_body.cname = malloc(sizeof(*a->req_body.cname));
677 if (a->req_body.cname == NULL) {
679 krb5_set_error_message(context, ret, "malloc: out of memory");
682 a->req_body.sname = malloc(sizeof(*a->req_body.sname));
683 if (a->req_body.sname == NULL) {
685 krb5_set_error_message(context, ret, "malloc: out of memory");
688 ret = _krb5_principal2principalname (a->req_body.cname, creds->client);
691 ret = _krb5_principal2principalname (a->req_body.sname, creds->server);
694 ret = copy_Realm(&creds->client->realm, &a->req_body.realm);
698 if(creds->times.starttime) {
699 a->req_body.from = malloc(sizeof(*a->req_body.from));
700 if (a->req_body.from == NULL) {
702 krb5_set_error_message(context, ret, "malloc: out of memory");
705 *a->req_body.from = creds->times.starttime;
707 if(creds->times.endtime){
708 ALLOC(a->req_body.till, 1);
709 *a->req_body.till = creds->times.endtime;
711 if(creds->times.renew_till){
712 a->req_body.rtime = malloc(sizeof(*a->req_body.rtime));
713 if (a->req_body.rtime == NULL) {
715 krb5_set_error_message(context, ret, "malloc: out of memory");
718 *a->req_body.rtime = creds->times.renew_till;
720 a->req_body.nonce = nonce;
721 ret = krb5_init_etype (context,
722 &a->req_body.etype.len,
723 &a->req_body.etype.val,
729 * This means no addresses
732 if (addrs && addrs->len == 0) {
733 a->req_body.addresses = NULL;
735 a->req_body.addresses = malloc(sizeof(*a->req_body.addresses));
736 if (a->req_body.addresses == NULL) {
738 krb5_set_error_message(context, ret, "malloc: out of memory");
743 ret = krb5_copy_addresses(context, addrs, a->req_body.addresses);
745 ret = krb5_get_all_client_addrs (context, a->req_body.addresses);
746 if(ret == 0 && a->req_body.addresses->len == 0) {
747 free(a->req_body.addresses);
748 a->req_body.addresses = NULL;
755 a->req_body.enc_authorization_data = NULL;
756 a->req_body.additional_tickets = NULL;
758 if(preauth != NULL) {
761 if(a->padata == NULL) {
763 krb5_set_error_message(context, ret, "malloc: out of memory");
766 a->padata->val = NULL;
768 for(i = 0; i < preauth->len; i++) {
769 if(preauth->val[i].type == KRB5_PADATA_ENC_TIMESTAMP){
772 for(j = 0; j < preauth->val[i].info.len; j++) {
773 krb5_salt *sp = &salt;
774 if(preauth->val[i].info.val[j].salttype)
775 salt.salttype = *preauth->val[i].info.val[j].salttype;
777 salt.salttype = KRB5_PW_SALT;
778 if(preauth->val[i].info.val[j].salt)
779 salt.saltvalue = *preauth->val[i].info.val[j].salt;
781 if(salt.salttype == KRB5_PW_SALT)
784 krb5_data_zero(&salt.saltvalue);
785 ret = add_padata(context, a->padata, creds->client,
787 &preauth->val[i].info.val[j].etype, 1,
795 /* not sure this is the way to use `ptypes' */
796 if (ptypes == NULL || *ptypes == KRB5_PADATA_NONE)
798 else if (*ptypes == KRB5_PADATA_ENC_TIMESTAMP) {
800 if (a->padata == NULL) {
802 krb5_set_error_message(context, ret, "malloc: out of memory");
806 a->padata->val = NULL;
808 /* make a v5 salted pa-data */
809 add_padata(context, a->padata, creds->client,
810 key_proc, keyseed, a->req_body.etype.val,
811 a->req_body.etype.len, NULL);
813 /* make a v4 salted pa-data */
814 salt.salttype = KRB5_PW_SALT;
815 krb5_data_zero(&salt.saltvalue);
816 add_padata(context, a->padata, creds->client,
817 key_proc, keyseed, a->req_body.etype.val,
818 a->req_body.etype.len, &salt);
820 ret = KRB5_PREAUTH_BAD_TYPE;
821 krb5_set_error_message (context, ret, "pre-auth type %d not supported",
832 set_ptypes(krb5_context context,
834 const krb5_preauthtype **ptypes,
835 krb5_preauthdata **preauth)
837 static krb5_preauthdata preauth2;
838 static krb5_preauthtype ptypes2[] = { KRB5_PADATA_ENC_TIMESTAMP, KRB5_PADATA_NONE };
843 decode_METHOD_DATA(error->e_data->data,
844 error->e_data->length,
847 for(i = 0; i < md.len; i++){
848 switch(md.val[i].padata_type){
849 case KRB5_PADATA_ENC_TIMESTAMP:
852 case KRB5_PADATA_ETYPE_INFO:
853 *preauth = &preauth2;
854 ALLOC_SEQ(*preauth, 1);
855 (*preauth)->val[0].type = KRB5_PADATA_ENC_TIMESTAMP;
856 krb5_decode_ETYPE_INFO(context,
857 md.val[i].padata_value.data,
858 md.val[i].padata_value.length,
859 &(*preauth)->val[0].info,
866 free_METHOD_DATA(&md);
873 krb5_error_code KRB5_LIB_FUNCTION
874 krb5_get_in_cred(krb5_context context,
876 const krb5_addresses *addrs,
877 const krb5_enctype *etypes,
878 const krb5_preauthtype *ptypes,
879 const krb5_preauthdata *preauth,
880 krb5_key_proc key_proc,
881 krb5_const_pointer keyseed,
882 krb5_decrypt_proc decrypt_proc,
883 krb5_const_pointer decryptarg,
885 krb5_kdc_rep *ret_as_reply)
898 krb5_preauthdata *my_preauth = NULL;
902 opts = int2KDCOptions(options);
904 krb5_generate_random_block (&nonce, sizeof(nonce));
909 ret = init_as_req (context,
921 free_ETYPE_INFO(&my_preauth->val[0].info);
922 free (my_preauth->val);
928 ASN1_MALLOC_ENCODE(AS_REQ, req.data, req.length, &a, &len, ret);
932 if(len != req.length)
933 krb5_abortx(context, "internal error in ASN.1 encoder");
935 ret = krb5_sendto_kdc (context, &req, &creds->client->realm, &resp);
936 krb5_data_free(&req);
940 memset (&rep, 0, sizeof(rep));
941 ret = decode_AS_REP(resp.data, resp.length, &rep.kdc_rep, &size);
943 /* let's try to parse it as a KRB-ERROR */
947 ret2 = krb5_rd_error(context, &resp, &error);
948 if(ret2 && resp.data && ((char*)resp.data)[0] == 4)
949 ret = KRB5KRB_AP_ERR_V4_REPLY;
950 krb5_data_free(&resp);
952 ret = krb5_error_from_rd_error(context, &error, creds);
953 /* if no preauth was set and KDC requires it, give it
955 if (!ptypes && !preauth
956 && ret == KRB5KDC_ERR_PREAUTH_REQUIRED
958 || ret == KRB5KDC_ERR_BADOPTION
960 && set_ptypes(context, &error, &ptypes, &my_preauth)) {
962 preauth = my_preauth;
963 krb5_free_error_contents(context, &error);
964 krb5_clear_error_string(context);
968 ret_as_reply->error = error;
970 free_KRB_ERROR (&error);
975 krb5_data_free(&resp);
979 etype = rep.kdc_rep.enc_part.etype;
980 if(rep.kdc_rep.padata){
982 pa = krb5_find_padata(rep.kdc_rep.padata->val, rep.kdc_rep.padata->len,
983 KRB5_PADATA_PW_SALT, &i);
986 pa = krb5_find_padata(rep.kdc_rep.padata->val,
987 rep.kdc_rep.padata->len,
988 KRB5_PADATA_AFS3_SALT, &i);
992 salt.salttype = pa->padata_type;
993 salt.saltvalue = pa->padata_value;
995 ret = (*key_proc)(context, etype, salt, keyseed, &key);
997 /* make a v5 salted pa-data */
998 ret = krb5_get_pw_salt (context, creds->client, &salt);
1002 ret = (*key_proc)(context, etype, salt, keyseed, &key);
1003 krb5_free_salt(context, salt);
1010 if (opts.request_anonymous)
1011 flags |= EXTRACT_TICKET_ALLOW_SERVER_MISMATCH;
1013 ret = _krb5_extract_ticket(context,
1018 KRB5_KU_AS_REP_ENC_PART,
1025 memset (key->keyvalue.data, 0, key->keyvalue.length);
1026 krb5_free_keyblock_contents (context, key);
1030 if (ret == 0 && ret_as_reply)
1031 *ret_as_reply = rep;
1033 krb5_free_kdc_rep (context, &rep);
1037 krb5_error_code KRB5_LIB_FUNCTION
1038 krb5_get_in_tkt(krb5_context context,
1040 const krb5_addresses *addrs,
1041 const krb5_enctype *etypes,
1042 const krb5_preauthtype *ptypes,
1043 krb5_key_proc key_proc,
1044 krb5_const_pointer keyseed,
1045 krb5_decrypt_proc decrypt_proc,
1046 krb5_const_pointer decryptarg,
1049 krb5_kdc_rep *ret_as_reply)
1051 krb5_error_code ret;
1053 ret = krb5_get_in_cred (context,
1068 ret = krb5_cc_store_cred (context, ccache, creds);