From f3ff6a502f9a69b453c4fe42e2e6a9648712493e Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Sat, 7 Jan 2012 16:50:06 +0000 Subject: [PATCH] Remove some unused structures and encoders krb5_alt_method was added in r6604 but never supported. krb5_pwd_data became unused when the Sandia kadmin system was replaced. krb5_pa_server_referral_data and krb5_pa_svr_referral_data were added in r21690 with internally-visible encoders which nothing uses. Leave behind structure declarations in krb5.hin for API compatibility. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25619 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/k5-int.h | 59 ---------------------- src/include/krb5/krb5.hin | 17 ++----- src/lib/krb5/asn.1/asn1_k_decode.c | 40 --------------- src/lib/krb5/asn.1/asn1_k_decode.h | 7 --- src/lib/krb5/asn.1/asn1_k_encode.c | 63 ----------------------- src/lib/krb5/asn.1/krb5_decode.c | 50 ------------------- src/lib/krb5/krb/kfree.c | 74 ---------------------------- src/lib/krb5/libkrb5.exports | 14 ------ src/tests/asn.1/krb5_decode_leak.c | 39 --------------- src/tests/asn.1/krb5_decode_test.c | 44 ----------------- src/tests/asn.1/krb5_encode_test.c | 33 ------------- src/tests/asn.1/ktest.c | 59 ---------------------- src/tests/asn.1/ktest.h | 6 --- src/tests/asn.1/ktest_equal.c | 41 --------------- src/tests/asn.1/ktest_equal.h | 5 -- src/tests/asn.1/reference_encode.out | 4 -- src/tests/asn.1/trval_reference.out | 29 ----------- src/windows/include/loadfuncs-krb5.h | 12 ----- 18 files changed, 4 insertions(+), 592 deletions(-) diff --git a/src/include/k5-int.h b/src/include/k5-int.h index c10d8aaac..0e9476000 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -379,18 +379,6 @@ typedef INT64_TYPE krb5_int64; #define KRB_AP_ERR_IAKERB_KDC_NO_RESPONSE 86 /* The KDC did not respond to the IAKERB proxy */ -/* - * This structure is returned in the e-data field of the KRB-ERROR - * message when the error calling for an alternative form of - * authentication is returned, KRB_AP_METHOD. - */ -typedef struct _krb5_alt_method { - krb5_magic magic; - krb5_int32 method; - unsigned int length; - krb5_octet *data; -} krb5_alt_method; - /* * A null-terminated array of this structure is returned by the KDC as * the data part of the ETYPE_INFO preauth type. It informs the @@ -1088,13 +1076,6 @@ krb5_free_s4u_userid_contents(krb5_context, krb5_s4u_userid *); void KRB5_CALLCONV krb5_free_pa_s4u_x509_user(krb5_context, krb5_pa_s4u_x509_user *); -void KRB5_CALLCONV -krb5_free_pa_svr_referral_data(krb5_context, krb5_pa_svr_referral_data *); - -void KRB5_CALLCONV -krb5_free_pa_server_referral_data(krb5_context, - krb5_pa_server_referral_data * ); - void KRB5_CALLCONV krb5_free_pa_pac_req(krb5_context, krb5_pa_pac_req * ); @@ -1569,21 +1550,12 @@ encode_krb5_authdata(krb5_authdata *const *rep, krb5_data **code); krb5_error_code encode_krb5_authdata_elt(const krb5_authdata *rep, krb5_data **code); -krb5_error_code -encode_krb5_pwd_sequence(const passwd_phrase_element *rep, krb5_data **code); - -krb5_error_code -encode_krb5_pwd_data(const krb5_pwd_data *rep, krb5_data **code); - krb5_error_code encode_krb5_padata_sequence(krb5_pa_data *const *rep, krb5_data **code); krb5_error_code encode_krb5_typed_data(krb5_pa_data *const *rep, krb5_data **code); -krb5_error_code -encode_krb5_alt_method(const krb5_alt_method *, krb5_data **code); - krb5_error_code encode_krb5_etype_info(krb5_etype_info_entry *const *, krb5_data **code); @@ -1623,14 +1595,6 @@ encode_krb5_s4u_userid(const krb5_s4u_userid *, krb5_data **); krb5_error_code encode_krb5_pa_s4u_x509_user(const krb5_pa_s4u_x509_user *, krb5_data **); -krb5_error_code -encode_krb5_pa_svr_referral_data(const krb5_pa_svr_referral_data *, - krb5_data **); - -krb5_error_code -encode_krb5_pa_server_referral_data(const krb5_pa_server_referral_data *, - krb5_data **); - krb5_error_code encode_krb5_pa_pac_req(const krb5_pa_pac_req *, krb5_data **); @@ -1765,21 +1729,12 @@ decode_krb5_error(const krb5_data *output, krb5_error **rep); krb5_error_code decode_krb5_authdata(const krb5_data *output, krb5_authdata ***rep); -krb5_error_code -decode_krb5_pwd_sequence(const krb5_data *output, passwd_phrase_element **rep); - -krb5_error_code -decode_krb5_pwd_data(const krb5_data *output, krb5_pwd_data **rep); - krb5_error_code decode_krb5_padata_sequence(const krb5_data *output, krb5_pa_data ***rep); krb5_error_code decode_krb5_typed_data(const krb5_data *, krb5_pa_data ***); -krb5_error_code -decode_krb5_alt_method(const krb5_data *output, krb5_alt_method **rep); - krb5_error_code decode_krb5_etype_info(const krb5_data *output, krb5_etype_info_entry ***rep); @@ -1801,14 +1756,6 @@ decode_krb5_pa_for_user(const krb5_data *, krb5_pa_for_user **); krb5_error_code decode_krb5_pa_s4u_x509_user(const krb5_data *, krb5_pa_s4u_x509_user **); -krb5_error_code -decode_krb5_pa_svr_referral_data(const krb5_data *, - krb5_pa_svr_referral_data **); - -krb5_error_code -decode_krb5_pa_server_referral_data(const krb5_data *, - krb5_pa_server_referral_data **); - krb5_error_code decode_krb5_pa_pac_req(const krb5_data *, krb5_pa_pac_req **); @@ -2472,12 +2419,6 @@ void KRB5_CALLCONV krb5_free_cred(krb5_context, krb5_cred *); void KRB5_CALLCONV krb5_free_cred_enc_part(krb5_context, krb5_cred_enc_part *); void KRB5_CALLCONV krb5_free_pa_data(krb5_context, krb5_pa_data **); void KRB5_CALLCONV krb5_free_tkt_authent(krb5_context, krb5_tkt_authent *); -void KRB5_CALLCONV krb5_free_pwd_data(krb5_context, krb5_pwd_data *); -void KRB5_CALLCONV krb5_free_pwd_sequences(krb5_context, - passwd_phrase_element **); -void KRB5_CALLCONV krb5_free_passwd_phrase_element(krb5_context, - passwd_phrase_element *); -void KRB5_CALLCONV krb5_free_alt_method(krb5_context, krb5_alt_method *); void KRB5_CALLCONV krb5_free_enc_data(krb5_context, krb5_enc_data *); krb5_error_code krb5_set_config_files(krb5_context, const char **); diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index a363eaff4..61026463d 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -2114,36 +2114,27 @@ typedef struct _krb5_cred { krb5_cred_enc_part *enc_part2; /**< Unencrypted version, if available */ } krb5_cred; -/* - * Sandia password generation structure - * Used by internal functions only - */ +/* Unused, but here for API compatibility. */ typedef struct _passwd_phrase_element { krb5_magic magic; krb5_data *passwd; krb5_data *phrase; } passwd_phrase_element; -/* - * Password data. - * Used by internal functions only - */ +/* Unused, but here for API compatibility. */ typedef struct _krb5_pwd_data { krb5_magic magic; int sequence_count; passwd_phrase_element **element; } krb5_pwd_data; -/* these need to be here so the typedefs are available for the prototypes */ -/* - * Note for Windows 2000 compatibility this is encoded - * in the enc_padata field of the krb5_enc_kdc_rep_part. - */ +/* Unused, but here for API compatibility. */ typedef struct _krb5_pa_svr_referral_data { /** Referred name, only realm is required */ krb5_principal principal; } krb5_pa_svr_referral_data; +/* Unused, but here for API compatibility. */ typedef struct _krb5_pa_server_referral_data { krb5_data *referred_realm; krb5_principal true_principal_name; diff --git a/src/lib/krb5/asn.1/asn1_k_decode.c b/src/lib/krb5/asn.1/asn1_k_decode.c index f05d9dfe7..f25126ebe 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.c +++ b/src/lib/krb5/asn.1/asn1_k_decode.c @@ -916,46 +916,6 @@ asn1_decode_etype_info2(asn1buf *buf, krb5_etype_info_entry ***val , } } -asn1_error_code -asn1_decode_passwdsequence(asn1buf *buf, passwd_phrase_element *val) -{ - setup(); - val->passwd = NULL; - val->phrase = NULL; - { begin_structure(); - alloc_data(val->passwd); - get_lenfield(val->passwd->length,val->passwd->data, - 0,asn1_decode_charstring); - val->passwd->magic = KV5M_DATA; - alloc_data(val->phrase); - get_lenfield(val->phrase->length,val->phrase->data, - 1,asn1_decode_charstring); - val->phrase->magic = KV5M_DATA; - end_structure(); - val->magic = KV5M_PASSWD_PHRASE_ELEMENT; - } - return 0; -error_out: - krb5_free_data(NULL, val->passwd); - krb5_free_data(NULL, val->phrase); - val->passwd = NULL; - val->phrase = NULL; - return 0; -} - -asn1_error_code -asn1_decode_passwdsequence_ptr(asn1buf *buf, passwd_phrase_element **valptr) -{ - decode_ptr(passwd_phrase_element *, asn1_decode_passwdsequence); -} - -asn1_error_code -asn1_decode_sequence_of_passwdsequence(asn1buf *buf, - passwd_phrase_element ***val) -{ - decode_array_body(passwd_phrase_element,asn1_decode_passwdsequence_ptr, - krb5_free_passwd_phrase_element); -} asn1_error_code asn1_decode_setpw_req(asn1buf *buf, krb5_data *newpasswd, krb5_principal *principal) diff --git a/src/lib/krb5/asn.1/asn1_k_decode.h b/src/lib/krb5/asn.1/asn1_k_decode.h index 362d942df..081f11f94 100644 --- a/src/lib/krb5/asn.1/asn1_k_decode.h +++ b/src/lib/krb5/asn.1/asn1_k_decode.h @@ -141,10 +141,6 @@ asn1_error_code asn1_decode_krb_cred_info_ptr(asn1buf *buf, krb5_cred_info **valptr); asn1_error_code asn1_decode_pa_data(asn1buf *buf, krb5_pa_data *val); asn1_error_code asn1_decode_pa_data_ptr(asn1buf *buf, krb5_pa_data **valptr); -asn1_error_code asn1_decode_passwdsequence(asn1buf *buf, - passwd_phrase_element *val); -asn1_error_code asn1_decode_passwdsequence_ptr(asn1buf *buf, - passwd_phrase_element **valptr); asn1_error_code asn1_decode_sam_challenge_2(asn1buf *buf, krb5_sam_challenge_2 *val); asn1_error_code @@ -218,9 +214,6 @@ asn1_error_code asn1_decode_sequence_of_enctype(asn1buf *buf, int *num, asn1_error_code asn1_decode_sequence_of_checksum(asn1buf *buf, krb5_checksum ***val); -asn1_error_code asn1_decode_sequence_of_passwdsequence(asn1buf *buf, - passwd_phrase_element ***val); - asn1_error_code asn1_decode_etype_info(asn1buf *buf, krb5_etype_info_entry ***val); asn1_error_code asn1_decode_etype_info2(asn1buf *buf, diff --git a/src/lib/krb5/asn.1/asn1_k_encode.c b/src/lib/krb5/asn.1/asn1_k_encode.c index 425853cda..4aa4da72b 100644 --- a/src/lib/krb5/asn.1/asn1_k_encode.c +++ b/src/lib/krb5/asn.1/asn1_k_encode.c @@ -454,16 +454,6 @@ DEFNULLTERMSEQOFTYPE(etype_info, etype_info_entry_ptr); DEFPTRTYPE(etype_info2_entry_ptr, etype_info2_entry); DEFNULLTERMSEQOFTYPE(etype_info2, etype_info2_entry_ptr); -static const struct field_info passwdsequence_fields[] = { - FIELDOF_NORM(passwd_phrase_element, ostring_data_ptr, passwd, 0, 0), - FIELDOF_NORM(passwd_phrase_element, ostring_data_ptr, phrase, 1, 0), -}; -DEFSEQTYPE(passwdsequence, passwd_phrase_element, passwdsequence_fields, 0); - -DEFPTRTYPE(passwdsequence_ptr, passwdsequence); -DEFNONEMPTYNULLTERMSEQOFTYPE(seqof_passwdsequence, passwdsequence_ptr); -DEFPTRTYPE(ptr_seqof_passwdsequence, seqof_passwdsequence); - static const struct field_info sam_challenge_2_fields[] = { FIELDOF_NORM(krb5_sam_challenge_2, opaque_data, sam_challenge_2_body, 0, 0), @@ -961,23 +951,6 @@ optional_error(const void *p) DEFSEQTYPE(untagged_krb5_error, krb5_error, error_fields, optional_error); DEFAPPTAGGEDTYPE(krb5_error, 30, untagged_krb5_error); -static const struct field_info alt_method_fields[] = { - FIELDOF_NORM(krb5_alt_method, int32, method, 0, 0), - FIELDOF_OPTSTRING(krb5_alt_method, octetstring, data, length, 1, 0, 1), -}; -static unsigned int -optional_alt_method(const void *p) -{ - const krb5_alt_method *a = p; - unsigned int optional = 0; - - if (a->data != NULL && a->length > 0) - optional |= (1u << 1); - - return optional; -} -DEFSEQTYPE(alt_method, krb5_alt_method, alt_method_fields, optional_alt_method); - static const struct field_info pa_enc_ts_fields[] = { FIELDOF_NORM(krb5_pa_enc_ts, kerberos_time, patimestamp, 0, 0), FIELDOF_OPT(krb5_pa_enc_ts, int32, pausec, 1, 0, 1), @@ -995,12 +968,6 @@ optional_pa_enc_ts(const void *p) } DEFSEQTYPE(pa_enc_ts, krb5_pa_enc_ts, pa_enc_ts_fields, optional_pa_enc_ts); -static const struct field_info pwd_data_fields[] = { - FIELDOF_NORM(krb5_pwd_data, int32, sequence_count, 0, 0), - FIELDOF_NORM(krb5_pwd_data, ptr_seqof_passwdsequence, element, 1, 0), -}; -DEFSEQTYPE(pwd_data, krb5_pwd_data, pwd_data_fields, 0); - static const struct field_info setpw_req_fields[] = { FIELDOF_NORM(struct krb5_setpw_req, ostring_data, password, 0, 0), FIELDOF_NORM(struct krb5_setpw_req, principal, target, 1, 0), @@ -1049,30 +1016,6 @@ static const struct field_info pa_s4u_x509_user_fields[] = { DEFSEQTYPE(pa_s4u_x509_user, krb5_pa_s4u_x509_user, pa_s4u_x509_user_fields, 0); -/* draft-ietf-krb-wg-kerberos-referrals Appendix A. */ -static const struct field_info pa_svr_referral_data_fields[] = { - FIELDOF_NORM(krb5_pa_svr_referral_data, realm_of_principal, principal, - 0, 0), - FIELDOF_OPT(krb5_pa_svr_referral_data, principal, principal, 1, 0, 1), -}; - -DEFSEQTYPE(pa_svr_referral_data, krb5_pa_svr_referral_data, pa_svr_referral_data_fields, 0); - -/* draft-ietf-krb-wg-kerberos-referrals Section 8. */ -static const struct field_info pa_server_referral_data_fields[] = { - FIELDOF_OPT(krb5_pa_server_referral_data, gstring_data_ptr, referred_realm, - 0, 0, 0), - FIELDOF_OPT(krb5_pa_server_referral_data, principal, true_principal_name, - 1, 0, 1), - FIELDOF_OPT(krb5_pa_server_referral_data, principal, - requested_principal_name, 2, 0, 2), - FIELDOF_OPT(krb5_pa_server_referral_data, kerberos_time, - referral_valid_until, 3, 0, 3), - FIELDOF_NORM(krb5_pa_server_referral_data, checksum, rep_cksum, 4, 0), -}; - -DEFSEQTYPE(pa_server_referral_data, krb5_pa_server_referral_data, pa_server_referral_data_fields, 0); - #if 0 /* draft-brezak-win2k-krb-authz Section 6. */ static const struct field_info pa_pac_request_fields[] = { @@ -1311,14 +1254,10 @@ MAKE_FULL_ENCODER(encode_krb5_enc_cred_part, enc_cred_part); MAKE_FULL_ENCODER(encode_krb5_error, krb5_error); MAKE_FULL_ENCODER(encode_krb5_authdata, auth_data); MAKE_FULL_ENCODER(encode_krb5_authdata_elt, authdata_elt); -MAKE_FULL_ENCODER(encode_krb5_alt_method, alt_method); MAKE_FULL_ENCODER(encode_krb5_etype_info, etype_info); MAKE_FULL_ENCODER(encode_krb5_etype_info2, etype_info2); MAKE_FULL_ENCODER(encode_krb5_enc_data, encrypted_data); MAKE_FULL_ENCODER(encode_krb5_pa_enc_ts, pa_enc_ts); -/* Sandia Additions */ -MAKE_FULL_ENCODER(encode_krb5_pwd_sequence, passwdsequence); -MAKE_FULL_ENCODER(encode_krb5_pwd_data, pwd_data); MAKE_FULL_ENCODER(encode_krb5_padata_sequence, seq_of_pa_data); /* sam preauth additions */ MAKE_FULL_ENCODER(encode_krb5_sam_challenge_2, sam_challenge_2); @@ -1331,8 +1270,6 @@ MAKE_FULL_ENCODER(encode_krb5_setpw_req, setpw_req); MAKE_FULL_ENCODER(encode_krb5_pa_for_user, pa_for_user); MAKE_FULL_ENCODER(encode_krb5_s4u_userid, s4u_userid); MAKE_FULL_ENCODER(encode_krb5_pa_s4u_x509_user, pa_s4u_x509_user); -MAKE_FULL_ENCODER(encode_krb5_pa_svr_referral_data, pa_svr_referral_data); -MAKE_FULL_ENCODER(encode_krb5_pa_server_referral_data, pa_server_referral_data); MAKE_FULL_ENCODER(encode_krb5_etype_list, etype_list); MAKE_FULL_ENCODER(encode_krb5_pa_fx_fast_request, pa_fx_fast_request); diff --git a/src/lib/krb5/asn.1/krb5_decode.c b/src/lib/krb5/asn.1/krb5_decode.c index 87ef34f62..840035dab 100644 --- a/src/lib/krb5/asn.1/krb5_decode.c +++ b/src/lib/krb5/asn.1/krb5_decode.c @@ -552,33 +552,6 @@ decode_krb5_authdata(const krb5_data *code, krb5_authdata ***repptr) cleanup_none(); /* we're not allocating anything here... */ } -krb5_error_code -decode_krb5_pwd_sequence(const krb5_data *code, passwd_phrase_element **repptr) -{ - setup_buf_only(passwd_phrase_element *); - alloc_field(rep); - retval = asn1_decode_passwdsequence(&buf,rep); - if (retval) clean_return(retval); - cleanup(free); -} - -krb5_error_code -decode_krb5_pwd_data(const krb5_data *code, krb5_pwd_data **repptr) -{ - setup(krb5_pwd_data *); - alloc_field(rep); - clear_field(rep,element); - { begin_structure(); - get_field(rep->sequence_count,0,asn1_decode_int); - get_field(rep->element,1,asn1_decode_sequence_of_passwdsequence); - rep->magic = KV5M_PWD_DATA; - end_structure (); } - cleanup_manual(); -error_out: - krb5_free_pwd_data(NULL, rep); - return retval; -} - krb5_error_code decode_krb5_padata_sequence(const krb5_data *code, krb5_pa_data ***repptr) { @@ -588,29 +561,6 @@ decode_krb5_padata_sequence(const krb5_data *code, krb5_pa_data ***repptr) cleanup_none(); /* we're not allocating anything here */ } -krb5_error_code -decode_krb5_alt_method(const krb5_data *code, krb5_alt_method **repptr) -{ - setup(krb5_alt_method *); - alloc_field(rep); - clear_field(rep,data); - { begin_structure(); - get_field(rep->method,0,asn1_decode_int32); - if (tagnum == 1) { - get_lenfield(rep->length,rep->data,1,asn1_decode_octetstring); - } else { - rep->length = 0; - rep->data = 0; - } - rep->magic = KV5M_ALT_METHOD; - end_structure(); - } - cleanup_manual(); -error_out: - krb5_free_alt_method(NULL, rep); - return retval; -} - krb5_error_code decode_krb5_etype_info(const krb5_data *code, krb5_etype_info_entry ***repptr) { diff --git a/src/lib/krb5/krb/kfree.c b/src/lib/krb5/krb/kfree.c index 6208a9be9..5c7990032 100644 --- a/src/lib/krb5/krb/kfree.c +++ b/src/lib/krb5/krb/kfree.c @@ -76,16 +76,6 @@ krb5_free_addresses(krb5_context context, krb5_address **val) free(val); } - -void KRB5_CALLCONV -krb5_free_alt_method(krb5_context context, - krb5_alt_method *alt) -{ - if (alt) { - free(alt->data); - free(alt); - } -} void KRB5_CALLCONV krb5_free_ap_rep(krb5_context context, register krb5_ap_rep *val) { @@ -428,43 +418,6 @@ krb5_free_priv_enc_part(krb5_context context, register krb5_priv_enc_part *val) free(val); } -void KRB5_CALLCONV -krb5_free_pwd_data(krb5_context context, krb5_pwd_data *val) -{ - if (val == NULL) - return; - krb5_free_pwd_sequences(context, val->element); - free(val); -} - - -void KRB5_CALLCONV -krb5_free_passwd_phrase_element(krb5_context context, - passwd_phrase_element *val) -{ - if (val == NULL) - return; - krb5_free_data(context, val->passwd); - val->passwd = NULL; - krb5_free_data(context, val->phrase); - val->phrase = NULL; - free(val); -} - - -void KRB5_CALLCONV -krb5_free_pwd_sequences(krb5_context context, passwd_phrase_element **val) -{ - register passwd_phrase_element **temp; - - if (val == NULL) - return; - for (temp = val; *temp; temp++) - krb5_free_passwd_phrase_element(context, *temp); - free(val); -} - - void KRB5_CALLCONV krb5_free_safe(krb5_context context, register krb5_safe *val) { @@ -680,33 +633,6 @@ krb5_free_pa_s4u_x509_user(krb5_context context, krb5_pa_s4u_x509_user *req) free(req); } -void KRB5_CALLCONV -krb5_free_pa_server_referral_data(krb5_context context, - krb5_pa_server_referral_data *ref) -{ - if (ref == NULL) - return; - krb5_free_data(context, ref->referred_realm); - ref->referred_realm = NULL; - krb5_free_principal(context, ref->true_principal_name); - ref->true_principal_name = NULL; - krb5_free_principal(context, ref->requested_principal_name); - ref->requested_principal_name = NULL; - krb5_free_checksum_contents(context, &ref->rep_cksum); - free(ref); -} - -void KRB5_CALLCONV -krb5_free_pa_svr_referral_data(krb5_context context, - krb5_pa_svr_referral_data *ref) -{ - if (ref == NULL) - return; - krb5_free_principal(context, ref->principal); - ref->principal = NULL; - free(ref); -} - void KRB5_CALLCONV krb5_free_pa_pac_req(krb5_context context, krb5_pa_pac_req *req) diff --git a/src/lib/krb5/libkrb5.exports b/src/lib/krb5/libkrb5.exports index 066ee276f..04a09eb45 100644 --- a/src/lib/krb5/libkrb5.exports +++ b/src/lib/krb5/libkrb5.exports @@ -1,7 +1,6 @@ _krb5_conf_boolean decode_krb5_ad_kdcissued decode_krb5_ad_signedpath -decode_krb5_alt_method decode_krb5_ap_rep decode_krb5_ap_rep_enc_part decode_krb5_ap_req @@ -33,8 +32,6 @@ decode_krb5_pa_pac_req decode_krb5_pa_s4u_x509_user decode_krb5_padata_sequence decode_krb5_priv -decode_krb5_pwd_data -decode_krb5_pwd_sequence decode_krb5_safe decode_krb5_sam_challenge_2 decode_krb5_sam_challenge_2_body @@ -47,7 +44,6 @@ decode_krb5_typed_data encode_krb5_ad_kdcissued encode_krb5_ad_signedpath_data encode_krb5_ad_signedpath -encode_krb5_alt_method encode_krb5_ap_rep encode_krb5_ap_rep_enc_part encode_krb5_ap_req @@ -75,13 +71,9 @@ encode_krb5_pa_enc_ts encode_krb5_pa_for_user encode_krb5_pa_fx_fast_reply encode_krb5_pa_s4u_x509_user -encode_krb5_pa_server_referral_data -encode_krb5_pa_svr_referral_data encode_krb5_padata_sequence encode_krb5_pkinit_supp_pub_info encode_krb5_priv -encode_krb5_pwd_data -encode_krb5_pwd_sequence encode_krb5_s4u_userid encode_krb5_safe encode_krb5_sam_challenge_2 @@ -259,7 +251,6 @@ krb5_free_ad_kdcissued krb5_free_ad_signedpath krb5_free_address krb5_free_addresses -krb5_free_alt_method krb5_free_ap_rep krb5_free_ap_rep_enc_part krb5_free_ap_req @@ -305,14 +296,9 @@ krb5_free_pa_enc_ts krb5_free_pa_for_user krb5_free_pa_pac_req krb5_free_pa_s4u_x509_user -krb5_free_pa_server_referral_data -krb5_free_pa_svr_referral_data -krb5_free_passwd_phrase_element krb5_free_principal krb5_free_priv krb5_free_priv_enc_part -krb5_free_pwd_data -krb5_free_pwd_sequences krb5_free_realm_tree krb5_free_safe krb5_free_sam_challenge_2 diff --git a/src/tests/asn.1/krb5_decode_leak.c b/src/tests/asn.1/krb5_decode_leak.c index c179b2f32..633d16af8 100644 --- a/src/tests/asn.1/krb5_decode_leak.c +++ b/src/tests/asn.1/krb5_decode_leak.c @@ -482,28 +482,6 @@ main(int argc, char **argv) ktest_destroy_authorization_data(&ad); } - /****************************************************************/ - /* encode_pwd_sequence */ - { - passwd_phrase_element ppe, *tmp; - - ktest_make_sample_passwd_phrase_element(&ppe); - leak_test(ppe, encode_krb5_pwd_sequence, decode_krb5_pwd_sequence, - krb5_free_passwd_phrase_element); - ktest_empty_passwd_phrase_element(&ppe); - } - - /****************************************************************/ - /* encode_passwd_data */ - { - krb5_pwd_data pd, *tmp; - - ktest_make_sample_krb5_pwd_data(&pd); - leak_test(pd, encode_krb5_pwd_data, decode_krb5_pwd_data, - krb5_free_pwd_data); - ktest_empty_pwd_data(&pd); - } - /****************************************************************/ /* encode_padata_sequence and encode_typed_data */ { @@ -528,23 +506,6 @@ main(int argc, char **argv) ktest_destroy_pa_data_array(&pa); } - /****************************************************************/ - /* encode_alt_method */ - { - krb5_alt_method am, *tmp; - - ktest_make_sample_alt_method(&am); - leak_test(am, encode_krb5_alt_method, decode_krb5_alt_method, - krb5_free_alt_method); - am.length = 0; - if (am.data) - free(am.data); - am.data = 0; - leak_test(am, encode_krb5_alt_method, decode_krb5_alt_method, - krb5_free_alt_method); - ktest_empty_alt_method(&am); - } - /****************************************************************/ /* encode_etype_info */ { diff --git a/src/tests/asn.1/krb5_decode_test.c b/src/tests/asn.1/krb5_decode_test.c index 42011ce0c..873927a6f 100644 --- a/src/tests/asn.1/krb5_decode_test.c +++ b/src/tests/asn.1/krb5_decode_test.c @@ -36,9 +36,6 @@ krb5_context test_context; int error_count = 0; -void krb5_ktest_free_alt_method(krb5_context context, krb5_alt_method *val); -void krb5_ktest_free_pwd_sequence(krb5_context context, - passwd_phrase_element *val); void krb5_ktest_free_enc_data(krb5_context context, krb5_enc_data *val); int main(argc, argv) @@ -730,22 +727,6 @@ int main(argc, argv) ktest_destroy_authorization_data(&ref); } - /****************************************************************/ - /* decode_pwd_sequence */ - { - setup(passwd_phrase_element,ktest_make_sample_passwd_phrase_element); - decode_run("PasswdSequence","","30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_pwd_sequence,ktest_equal_passwd_phrase_element,krb5_ktest_free_pwd_sequence); - ktest_empty_passwd_phrase_element(&ref); - } - - /****************************************************************/ - /* decode_passwd_data */ - { - setup(krb5_pwd_data,ktest_make_sample_krb5_pwd_data); - decode_run("PasswdData","","30 3D A0 03 02 01 02 A1 36 30 34 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61",decode_krb5_pwd_data,ktest_equal_krb5_pwd_data,krb5_free_pwd_data); - ktest_empty_pwd_data(&ref); - } - /****************************************************************/ /* decode_krb5_padata_sequence and decode_krb5_typed_data */ { @@ -792,16 +773,6 @@ int main(argc, argv) ktest_destroy_pa_data_array(&ref); } - /****************************************************************/ - /* decode_pwd_sequence */ - { - setup(krb5_alt_method,ktest_make_sample_alt_method); - decode_run("alt_method","","30 0F A0 03 02 01 2A A1 08 04 06 73 65 63 72 65 74",decode_krb5_alt_method,ktest_equal_krb5_alt_method,krb5_ktest_free_alt_method); - ref.length = 0; - decode_run("alt_method (no data)","","30 05 A0 03 02 01 2A",decode_krb5_alt_method,ktest_equal_krb5_alt_method,krb5_ktest_free_alt_method); - ktest_empty_alt_method(&ref); - } - /****************************************************************/ /* decode_etype_info */ { @@ -974,21 +945,6 @@ int main(argc, argv) } -void krb5_ktest_free_alt_method(krb5_context context, krb5_alt_method *val) -{ - if (val->data) - free(val->data); - free(val); -} - -void krb5_ktest_free_pwd_sequence(krb5_context context, - passwd_phrase_element *val) -{ - krb5_free_data(context, val->passwd); - krb5_free_data(context, val->phrase); - free(val); -} - void krb5_ktest_free_enc_data(krb5_context context, krb5_enc_data *val) { if (val) { diff --git a/src/tests/asn.1/krb5_encode_test.c b/src/tests/asn.1/krb5_encode_test.c index 7f21c0cc3..b025ec4d0 100644 --- a/src/tests/asn.1/krb5_encode_test.c +++ b/src/tests/asn.1/krb5_encode_test.c @@ -484,24 +484,6 @@ main(argc, argv) ktest_destroy_authorization_data(&ad); } - /****************************************************************/ - /* encode_pwd_sequence */ - { - passwd_phrase_element ppe; - ktest_make_sample_passwd_phrase_element(&ppe); - encode_run(ppe,passwd_phrase_element,"pwd_sequence","",encode_krb5_pwd_sequence); - ktest_empty_passwd_phrase_element(&ppe); - } - - /****************************************************************/ - /* encode_passwd_data */ - { - krb5_pwd_data pd; - ktest_make_sample_krb5_pwd_data(&pd); - encode_run(pd,krb5_pwd_data,"pwd_data","",encode_krb5_pwd_data); - ktest_empty_pwd_data(&pd); - } - /****************************************************************/ /* encode_padata_sequence and encode_krb5_typed_data */ { @@ -540,21 +522,6 @@ main(argc, argv) ktest_destroy_pa_data_array(&pa); } - /****************************************************************/ - /* encode_alt_method */ - { - krb5_alt_method am; - ktest_make_sample_alt_method(&am); - encode_run(am,krb5_alt_method,"alt_method","",encode_krb5_alt_method); - am.length = 0; - if (am.data) - free(am.data); - am.data = 0; - encode_run(am,krb5_alt_method,"alt_method (no data)","", - encode_krb5_alt_method); - ktest_empty_alt_method(&am); - } - /****************************************************************/ /* encode_etype_info */ { diff --git a/src/tests/asn.1/ktest.c b/src/tests/asn.1/ktest.c index 8f1b045c3..a7cfd66b1 100644 --- a/src/tests/asn.1/ktest.c +++ b/src/tests/asn.1/ktest.c @@ -420,37 +420,6 @@ ktest_make_sample_data(krb5_data *d) krb5_data_parse(d, "krb5data"); } -void -ktest_make_sample_passwd_phrase_element(passwd_phrase_element *ppe) -{ - ppe->passwd = ealloc(sizeof(krb5_data)); - ktest_make_sample_data(ppe->passwd); - ppe->phrase = ealloc(sizeof(krb5_data)); - ktest_make_sample_data(ppe->phrase); -} - -void -ktest_make_sample_krb5_pwd_data(krb5_pwd_data *pd) -{ - int i; - - pd->sequence_count = 2; - pd->element = ealloc(3 * sizeof(passwd_phrase_element *)); - for (i = 0; i <= 1; i++) { - pd->element[i] = ealloc(sizeof(passwd_phrase_element)); - ktest_make_sample_passwd_phrase_element(pd->element[i]); - } - pd->element[2] = NULL; -} - -void -ktest_make_sample_alt_method(krb5_alt_method *p) -{ - p->method = 42; - p->data = (unsigned char *)estrdup("secret"); - p->length = strlen((char *)p->data); -} - void ktest_make_sample_etype_info(krb5_etype_info_entry ***p) { @@ -1334,34 +1303,6 @@ ktest_empty_ap_rep_enc_part(krb5_ap_rep_enc_part *arep) ktest_destroy_keyblock(&(arep)->subkey); } -void -ktest_empty_passwd_phrase_element(passwd_phrase_element *ppe) -{ - ktest_destroy_data(&ppe->passwd); - ktest_destroy_data(&ppe->phrase); -} - -void -ktest_empty_pwd_data(krb5_pwd_data *pd) -{ - int i; - - for (i = 0; i <= pd->sequence_count; i++) { - if (pd->element[i]) { - ktest_empty_passwd_phrase_element(pd->element[i]); - free(pd->element[i]); - } - } - free(pd->element); -} - -void -ktest_empty_alt_method(krb5_alt_method *am) -{ - free(am->data); - am->data = NULL; -} - void ktest_empty_sam_challenge_2(krb5_sam_challenge_2 *p) { diff --git a/src/tests/asn.1/ktest.h b/src/tests/asn.1/ktest.h index bd81cf486..8b81131db 100644 --- a/src/tests/asn.1/ktest.h +++ b/src/tests/asn.1/ktest.h @@ -73,9 +73,6 @@ void ktest_make_sample_sequence_of_ticket(krb5_ticket ***sot); void ktest_make_sample_error(krb5_error *kerr); void ktest_make_sequence_of_cred_info(krb5_cred_info ***soci); void ktest_make_sample_cred_info(krb5_cred_info *ci); -void ktest_make_sample_passwd_phrase_element(passwd_phrase_element *ppe); -void ktest_make_sample_krb5_pwd_data(krb5_pwd_data *pd); -void ktest_make_sample_alt_method(krb5_alt_method *am); void ktest_make_sample_etype_info(krb5_etype_info_entry ***p); void ktest_make_sample_etype_info2(krb5_etype_info_entry ***p); @@ -161,9 +158,6 @@ void ktest_empty_priv_enc_part(krb5_priv_enc_part *pep); void ktest_empty_cred(krb5_cred *c); void ktest_destroy_last_req(krb5_last_req_entry ***lr); void ktest_empty_ap_rep_enc_part(krb5_ap_rep_enc_part *arep); -void ktest_empty_passwd_phrase_element(passwd_phrase_element *ppe); -void ktest_empty_pwd_data(krb5_pwd_data *pd); -void ktest_empty_alt_method(krb5_alt_method *am); void ktest_empty_sam_challenge_2(krb5_sam_challenge_2 *p); void ktest_empty_sam_challenge_2_body(krb5_sam_challenge_2_body *p); void ktest_empty_sam_response_2(krb5_sam_response_2 *p); diff --git a/src/tests/asn.1/ktest_equal.c b/src/tests/asn.1/ktest_equal.c index f3fbe67b2..53924ff5a 100644 --- a/src/tests/asn.1/ktest_equal.c +++ b/src/tests/asn.1/ktest_equal.c @@ -439,41 +439,6 @@ ktest_equal_cred_info(krb5_cred_info *ref, krb5_cred_info *var) return p; } -int -ktest_equal_passwd_phrase_element(passwd_phrase_element *ref, - passwd_phrase_element *var) -{ - int p = TRUE; - if (ref == var) return TRUE; - else if (ref == NULL || var == NULL) return FALSE; - p = p && ptr_equal(passwd,ktest_equal_data); - p = p && ptr_equal(phrase,ktest_equal_data); - return p; -} - -int -ktest_equal_krb5_pwd_data(krb5_pwd_data *ref, krb5_pwd_data *var) -{ - int p = TRUE; - if (ref == var) return TRUE; - else if (ref == NULL || var == NULL) return FALSE; - p = p && scalar_equal(sequence_count); - p = p && ptr_equal(element,ktest_equal_array_of_passwd_phrase_element); - return p; -} - -int -ktest_equal_krb5_alt_method(krb5_alt_method *ref, krb5_alt_method *var) -{ - if (ref->method != var->method) - return FALSE; - if (ref->length != var->length) - return FALSE; - if (memcmp(ref->data, var->data, ref->length) != 0) - return FALSE; - return TRUE; -} - int ktest_equal_krb5_etype_info_entry(krb5_etype_info_entry *ref, krb5_etype_info_entry *var) @@ -794,12 +759,6 @@ ktest_equal_sequence_of_principal(krb5_principal *ref, krb5_principal *var) array_compare(ktest_equal_principal_data); } -int -ktest_equal_array_of_passwd_phrase_element(passwd_phrase_element **ref, passwd_phrase_element **var) -{ - array_compare(ktest_equal_passwd_phrase_element); -} - int ktest_equal_etype_info(krb5_etype_info_entry **ref, krb5_etype_info_entry **var) { diff --git a/src/tests/asn.1/ktest_equal.h b/src/tests/asn.1/ktest_equal.h index ec8db0634..2a2b6f04d 100644 --- a/src/tests/asn.1/ktest_equal.h +++ b/src/tests/asn.1/ktest_equal.h @@ -79,9 +79,6 @@ generic(ktest_equal_tgs_req,krb5_kdc_req); generic(ktest_equal_kdc_req_body,krb5_kdc_req); generic(ktest_equal_encryption_key,krb5_keyblock); -generic(ktest_equal_passwd_phrase_element,passwd_phrase_element); -generic(ktest_equal_krb5_pwd_data,krb5_pwd_data); -generic(ktest_equal_krb5_alt_method,krb5_alt_method); generic(ktest_equal_krb5_pa_enc_ts,krb5_pa_enc_ts); generic(ktest_equal_sam_challenge_2,krb5_sam_challenge_2); @@ -100,8 +97,6 @@ len_array(ktest_equal_array_of_enctype,krb5_enctype); len_array(ktest_equal_array_of_data,krb5_data); len_unsigned_array(ktest_equal_array_of_octet,krb5_octet); -int ktest_equal_array_of_passwd_phrase_element(passwd_phrase_element **ref, - passwd_phrase_element **var); int ktest_equal_authorization_data(krb5_authdata **ref, krb5_authdata **var); int ktest_equal_addresses(krb5_address **ref, krb5_address **var); int ktest_equal_array_of_char(const unsigned int length, char *ref, char *var); diff --git a/src/tests/asn.1/reference_encode.out b/src/tests/asn.1/reference_encode.out index 5feb7b484..2396a0e7e 100644 --- a/src/tests/asn.1/reference_encode.out +++ b/src/tests/asn.1/reference_encode.out @@ -35,13 +35,9 @@ encode_krb5_enc_cred_part(optionals NULL): 7D 82 01 0E 30 82 01 0A A0 82 01 06 3 encode_krb5_error: 7E 81 BA 30 81 B7 A0 03 02 01 05 A1 03 02 01 1E A2 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A3 05 02 03 01 E2 40 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 05 02 03 01 E2 40 A6 03 02 01 3C A7 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 A8 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 AB 0A 1B 08 6B 72 62 35 64 61 74 61 AC 0A 04 08 6B 72 62 35 64 61 74 61 encode_krb5_error(optionals NULL): 7E 60 30 5E A0 03 02 01 05 A1 03 02 01 1E A3 05 02 03 01 E2 40 A4 11 18 0F 31 39 39 34 30 36 31 30 30 36 30 33 31 37 5A A5 05 02 03 01 E2 40 A6 03 02 01 3C A9 10 1B 0E 41 54 48 45 4E 41 2E 4D 49 54 2E 45 44 55 AA 1A 30 18 A0 03 02 01 01 A1 11 30 0F 1B 06 68 66 74 73 61 69 1B 05 65 78 74 72 61 encode_krb5_authorization_data: 30 22 30 0F A0 03 02 01 01 A1 08 04 06 66 6F 6F 62 61 72 30 0F A0 03 02 01 01 A1 08 04 06 66 6F 6F 62 61 72 -encode_krb5_pwd_sequence: 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 -encode_krb5_pwd_data: 30 3D A0 03 02 01 02 A1 36 30 34 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 30 18 A0 0A 04 08 6B 72 62 35 64 61 74 61 A1 0A 04 08 6B 72 62 35 64 61 74 61 encode_krb5_padata_sequence: 30 24 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 30 10 A1 03 02 01 0D A2 09 04 07 70 61 2D 64 61 74 61 encode_krb5_typed_data: 30 24 30 10 A0 03 02 01 0D A1 09 04 07 70 61 2D 64 61 74 61 30 10 A0 03 02 01 0D A1 09 04 07 70 61 2D 64 61 74 61 encode_krb5_padata_sequence(empty): 30 00 -encode_krb5_alt_method: 30 0F A0 03 02 01 2A A1 08 04 06 73 65 63 72 65 74 -encode_krb5_alt_method (no data): 30 05 A0 03 02 01 2A encode_krb5_etype_info: 30 33 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 30 05 A0 03 02 01 01 30 14 A0 03 02 01 02 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 32 encode_krb5_etype_info (only 1): 30 16 30 14 A0 03 02 01 00 A1 0D 04 0B 4D 6F 72 74 6F 6E 27 73 20 23 30 encode_krb5_etype_info (no info): 30 00 diff --git a/src/tests/asn.1/trval_reference.out b/src/tests/asn.1/trval_reference.out index 0d3716267..6f892e5b3 100644 --- a/src/tests/asn.1/trval_reference.out +++ b/src/tests/asn.1/trval_reference.out @@ -1058,24 +1058,6 @@ encode_krb5_authorization_data: . . [ad-type] [Integer] 1 . . [ad-data] [Octet String] "foobar" -encode_krb5_pwd_sequence: - -[Sequence/Sequence Of] -. [0] [Octet String] "krb5data" -. [1] [Octet String] "krb5data" - -encode_krb5_pwd_data: - -[Sequence/Sequence Of] -. [0] [Integer] 2 -. [1] [Sequence/Sequence Of] -. . [Sequence/Sequence Of] -. . . [0] [Octet String] "krb5data" -. . . [1] [Octet String] "krb5data" -. . [Sequence/Sequence Of] -. . . [0] [Octet String] "krb5data" -. . . [1] [Octet String] "krb5data" - encode_krb5_padata_sequence: [Sequence/Sequence Of] @@ -1100,17 +1082,6 @@ encode_krb5_padata_sequence(empty): [Sequence/Sequence Of] -encode_krb5_alt_method: - -[Sequence/Sequence Of] -. [0] [Integer] 42 -. [1] [Octet String] "secret" - -encode_krb5_alt_method (no data): - -[Sequence/Sequence Of] -. [0] [Integer] 42 - encode_krb5_etype_info: [Sequence/Sequence Of] diff --git a/src/windows/include/loadfuncs-krb5.h b/src/windows/include/loadfuncs-krb5.h index 2e3c1e347..a89cf16f3 100644 --- a/src/windows/include/loadfuncs-krb5.h +++ b/src/windows/include/loadfuncs-krb5.h @@ -195,18 +195,6 @@ TYPEDEF_FUNC( krb5_free_tkt_authent, (krb5_context, krb5_tkt_authent *) ); -TYPEDEF_FUNC( - void, - KRB5_CALLCONV, - krb5_free_pwd_data, - (krb5_context, krb5_pwd_data *) - ); -TYPEDEF_FUNC( - void, - KRB5_CALLCONV, - krb5_free_pwd_sequences, - (krb5_context, passwd_phrase_element * *) - ); TYPEDEF_FUNC( void, KRB5_CALLCONV, -- 2.26.2