svn rev #21557: branches/mskrb-integ/src/ include/krb5/ lib/krb5/ lib/krb5/krb/

lhoward@MIT.EDU lhoward at MIT.EDU
Sun Dec 21 00:31:40 EST 2008


http://src.mit.edu/fisheye/changelog/krb5/?cs=21557
Commit By: lhoward
Log Message:
Replace krb5_{en,de}code_ad_if_relevant with more general purpose
krb5_{en,de}code_authdata_container APIs



Changed Files:
U   branches/mskrb-integ/src/include/krb5/krb5.hin
U   branches/mskrb-integ/src/lib/krb5/krb/copy_auth.c
U   branches/mskrb-integ/src/lib/krb5/libkrb5.exports
Modified: branches/mskrb-integ/src/include/krb5/krb5.hin
===================================================================
--- branches/mskrb-integ/src/include/krb5/krb5.hin	2008-12-21 05:04:47 UTC (rev 21556)
+++ branches/mskrb-integ/src/include/krb5/krb5.hin	2008-12-21 05:31:38 UTC (rev 21557)
@@ -891,13 +891,6 @@
 
 #define LR_TYPE_INTERPRETATION_MASK	0x7fff
 
-/* definitions for ad_type fields. */
-#define	AD_TYPE_EXTERNAL	0x4000
-#define	AD_TYPE_REGISTERED	0x2000
-
-#define AD_TYPE_FIELD_TYPE_MASK	0x1fff
-#define AD_TYPE_INTERNAL_MASK	0x3fff
-
 /* definitions for msec direction bit for KRB_SAFE, KRB_PRIV */
 #define	MSEC_DIRBIT		0x8000
 #define	MSEC_VAL_MASK		0x7fff
@@ -2507,11 +2500,13 @@
 krb5_clear_error_message (krb5_context);
 
 krb5_error_code KRB5_CALLCONV
-krb5_decode_ad_if_relevant(krb5_context context,
+krb5_decode_authdata_container(krb5_context context,
+    krb5_authdatatype type,
     const krb5_authdata *if_relevant,
     krb5_authdata ***authdata);
 krb5_error_code KRB5_CALLCONV
-krb5_encode_ad_if_relevant(krb5_context context,
+krb5_encode_authdata_container(krb5_context context,
+    krb5_authdatatype type,
     krb5_authdata * const*authdata,
     krb5_authdata ***if_relevant_p);
 

Modified: branches/mskrb-integ/src/lib/krb5/krb/copy_auth.c
===================================================================
--- branches/mskrb-integ/src/lib/krb5/krb/copy_auth.c	2008-12-21 05:04:47 UTC (rev 21556)
+++ branches/mskrb-integ/src/lib/krb5/krb/copy_auth.c	2008-12-21 05:31:38 UTC (rev 21557)
@@ -109,18 +109,21 @@
 }
 
 krb5_error_code KRB5_CALLCONV
-krb5_decode_ad_if_relevant(krb5_context context, const krb5_authdata *if_relevant, krb5_authdata ***authdata)
+krb5_decode_authdata_container(krb5_context context,
+			       krb5_authdatatype type,
+			       const krb5_authdata *container,
+			       krb5_authdata ***authdata)
 {
     krb5_error_code code;
     krb5_data data;
 
     *authdata = NULL;
 
-    if (if_relevant->ad_type != KRB5_AUTHDATA_IF_RELEVANT)
+    if ((container->ad_type & AD_TYPE_FIELD_TYPE_MASK) != type)
 	return EINVAL;
 
-    data.length = if_relevant->length;
-    data.data = (char *)if_relevant->contents;
+    data.length = container->length;
+    data.data = (char *)container->contents;
 
     code = decode_krb5_authdata(&data, authdata);
     if (code)
@@ -130,27 +133,30 @@
 }
 
 krb5_error_code KRB5_CALLCONV
-krb5_encode_ad_if_relevant(krb5_context context, krb5_authdata *const*authdata, krb5_authdata ***if_relevant_p)
+krb5_encode_authdata_container(krb5_context context,
+			       krb5_authdatatype type,
+			       krb5_authdata *const*authdata,
+			       krb5_authdata ***container)
 {
     krb5_error_code code;
     krb5_data *data;
     krb5_authdata ad_datum;
     krb5_authdata *ad_data[2];
 
-    *if_relevant_p = NULL;
+    *container = NULL;
 
     code = encode_krb5_authdata((krb5_authdata * const *)authdata, &data);
     if (code)
 	return code;
 
-    ad_datum.ad_type = KRB5_AUTHDATA_IF_RELEVANT;
+    ad_datum.ad_type = type & AD_TYPE_FIELD_TYPE_MASK;;
     ad_datum.length = data->length;
     ad_datum.contents = (unsigned char *)data->data;
 
     ad_data[0] = &ad_datum;
     ad_data[1] = NULL;
 
-    code = krb5_copy_authdata(context, ad_data, if_relevant_p);
+    code = krb5_copy_authdata(context, ad_data, container);
 
     krb5_free_data(context, data);
 

Modified: branches/mskrb-integ/src/lib/krb5/libkrb5.exports
===================================================================
--- branches/mskrb-integ/src/lib/krb5/libkrb5.exports	2008-12-21 05:04:47 UTC (rev 21556)
+++ branches/mskrb-integ/src/lib/krb5/libkrb5.exports	2008-12-21 05:31:38 UTC (rev 21557)
@@ -173,7 +173,7 @@
 krb5_copy_ticket
 krb5_create_secure_file
 krb5_crypto_us_timeofday
-krb5_decode_ad_if_relevant
+krb5_decode_authdata_container
 krb5_decode_kdc_rep
 krb5_decode_ticket
 krb5_decrypt_tkt_part
@@ -182,7 +182,7 @@
 krb5_defkeyname
 krb5_deltat_to_string
 krb5_do_preauth
-krb5_encode_ad_if_relevant
+krb5_encode_authdata_container
 krb5_encode_kdc_rep
 krb5_encrypt_helper
 krb5_encrypt_tkt_part




More information about the cvs-krb5 mailing list