Ensure we have a free function for every data type we have an ASN.1
authorGreg Hudson <ghudson@mit.edu>
Wed, 11 Feb 2009 20:18:43 +0000 (20:18 +0000)
committerGreg Hudson <ghudson@mit.edu>
Wed, 11 Feb 2009 20:18:43 +0000 (20:18 +0000)
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

src/include/k5-int.h
src/lib/krb5/krb/kfree.c
src/lib/krb5/libkrb5.exports

index 1cc3c806177d2f4db9ea83691060c50055275801..61d1aa18fff89ecdc6b8d3a613fae3ad1b6bbfac 100644 (file)
@@ -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 **);
 
index c7c1c602c379b74d64a412b38cb98184f25c4772..e0e71746d6de94ff352bbb231ec7fb14a1baba01 100644 (file)
@@ -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);
 }
 
index 0d1842dec141fe13a9ded64b4efa5030071dccde..c69aead5d7f9adfada8ca2bc01141136565043e9 100644 (file)
@@ -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