From: Greg Hudson Date: Wed, 11 Feb 2009 20:18:43 +0000 (+0000) Subject: Ensure we have a free function for every data type we have an ASN.1 X-Git-Tag: krb5-1.8-alpha1~644 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=14a6b11b17fc1ecce63e1deb4880b26761c231cc;p=krb5.git Ensure we have a free function for every data type we have an ASN.1 decoder for. Export the new free functions, but only declare them in k5-int.h since they shouldn't be needed by applications. Also export a couple of encoder and decoder functions not previously exported. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21969 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/k5-int.h b/src/include/k5-int.h index 1cc3c8061..61d1aa18f 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -2509,6 +2509,12 @@ 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/lib/krb5/krb/kfree.c b/src/lib/krb5/krb/kfree.c index c7c1c602c..e0e71746d 100644 --- a/src/lib/krb5/krb/kfree.c +++ b/src/lib/krb5/krb/kfree.c @@ -79,6 +79,15 @@ krb5_free_addresses(krb5_context context, krb5_address **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) { @@ -254,6 +263,15 @@ krb5_free_data_contents(krb5_context context, krb5_data *val) } } +void KRB5_CALLCONV +krb5_free_enc_data(krb5_context context, krb5_enc_data *val) +{ + if (val == NULL) + return; + krb5_free_data_contents(context, &val->ciphertext); + free(val); +} + void krb5_free_etype_info(krb5_context context, krb5_etype_info info) { int i; @@ -425,6 +443,22 @@ krb5_free_pwd_data(krb5_context context, krb5_pwd_data *val) } +void KRB5_CALLCONV +krb5_free_passwd_phrase_element(krb5_context context, + passwd_phrase_element *val) +{ + register passwd_phrase_element **temp; + + 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) { @@ -432,13 +466,8 @@ krb5_free_pwd_sequences(krb5_context context, passwd_phrase_element **val) if (val == NULL) return; - for (temp = val; *temp; temp++) { - krb5_free_data(context, (*temp)->passwd); - (*temp)->passwd = 0; - krb5_free_data(context, (*temp)->phrase); - (*temp)->phrase = 0; - free(*temp); - } + for (temp = val; *temp; temp++) + krb5_free_passwd_phrase_element(context, *temp); free(val); } diff --git a/src/lib/krb5/libkrb5.exports b/src/lib/krb5/libkrb5.exports index 0d1842dec..c69aead5d 100644 --- a/src/lib/krb5/libkrb5.exports +++ b/src/lib/krb5/libkrb5.exports @@ -13,10 +13,12 @@ decode_krb5_enc_data decode_krb5_enc_kdc_rep_part decode_krb5_enc_priv_part decode_krb5_enc_sam_response_enc +decode_krb5_enc_sam_response_enc_2 decode_krb5_enc_tkt_part decode_krb5_encryption_key decode_krb5_error decode_krb5_etype_info +decode_krb5_etype_info2 decode_krb5_kdc_req_body decode_krb5_pa_enc_ts decode_krb5_pa_for_user @@ -29,6 +31,7 @@ decode_krb5_pwd_sequence decode_krb5_safe decode_krb5_sam_challenge decode_krb5_sam_response +decode_krb5_sam_response_2 decode_krb5_setpw_req decode_krb5_tgs_rep decode_krb5_tgs_req @@ -47,6 +50,7 @@ encode_krb5_enc_data encode_krb5_enc_kdc_rep_part encode_krb5_enc_priv_part encode_krb5_enc_sam_response_enc +encode_krb5_enc_sam_response_enc_2 encode_krb5_enc_tkt_part encode_krb5_encryption_key encode_krb5_error @@ -66,6 +70,7 @@ encode_krb5_safe encode_krb5_sam_challenge encode_krb5_sam_key encode_krb5_sam_response +encode_krb5_sam_response_2 encode_krb5_tgs_rep encode_krb5_tgs_req encode_krb5_ticket @@ -192,6 +197,7 @@ krb5_fcc_ops krb5_find_serializer krb5_free_address krb5_free_addresses +krb5_free_alt_method krb5_free_ap_rep krb5_free_ap_rep_enc_part krb5_free_ap_req @@ -209,6 +215,7 @@ krb5_free_creds krb5_free_data krb5_free_data_contents krb5_free_default_realm +krb5_free_enc_data krb5_free_enc_kdc_rep_part krb5_free_enc_sam_response_enc krb5_free_enc_sam_response_enc_2 @@ -233,6 +240,7 @@ krb5_free_pa_pac_req krb5_free_pa_for_user krb5_free_pa_server_referral_data krb5_free_pa_svr_referral_data +krb5_free_passwd_phrase_element krb5_free_predicted_sam_response krb5_free_predicted_sam_response_contents krb5_free_principal