DEFPTRTYPE(auth_data_ptr, auth_data);
DEFOPTIONALEMPTYTYPE(opt_auth_data_ptr, auth_data_ptr);
+/* authdata_types retrieves just the types of authdata elements in an array. */
+DEFCTAGGEDTYPE(authdata_elt_type_0, 0, int32);
+static const struct atype_info *authdata_elt_type_fields[] = {
+ &k5_atype_authdata_elt_type_0
+};
+DEFSEQTYPE(authdata_elt_type, krb5_authdatatype, authdata_elt_type_fields);
+DEFPTRTYPE(ptr_authdata_elt_type, authdata_elt_type);
+DEFCOUNTEDSEQOFTYPE(cseqof_authdata_elt_type, unsigned int,
+ ptr_authdata_elt_type);
+struct authdata_types {
+ krb5_authdatatype *types;
+ unsigned int ntypes;
+};
+DEFCOUNTEDTYPE(authdata_types, struct authdata_types, types, ntypes,
+ cseqof_authdata_elt_type);
+
DEFFIELD(keyblock_0, krb5_keyblock, enctype, 0, int32);
DEFCNFIELD(keyblock_1, krb5_keyblock, contents, length, 1, octetstring);
static const struct atype_info *encryption_key_fields[] = {
MAKE_CODEC(krb5_encryption_key, encryption_key);
MAKE_CODEC(krb5_enc_tkt_part, enc_tkt_part);
+krb5_error_code KRB5_CALLCONV
+krb5_decode_ticket(const krb5_data *code, krb5_ticket **repptr)
+{
+ return decode_krb5_ticket(code, repptr);
+}
+
/*
* For backwards compatibility, we encode both EncASRepPart and EncTGSRepPart
* with application tag 26. On decode, we accept either app tag and set the
MAKE_CODEC(krb5_iakerb_header, iakerb_header);
MAKE_CODEC(krb5_iakerb_finished, iakerb_finished);
+krb5_error_code KRB5_CALLCONV
+krb5int_get_authdata_containee_types(krb5_context context,
+ const krb5_authdata *authdata,
+ unsigned int *num_out,
+ krb5_authdatatype **types_out)
+{
+ asn1_error_code ret;
+ struct authdata_types *atypes;
+ void *atypes_ptr;
+ krb5_data d = make_data(authdata->contents, authdata->length);
+
+ ret = k5_asn1_full_decode(&d, &k5_atype_authdata_types, &atypes_ptr);
+ if (ret)
+ return ret;
+ atypes = atypes_ptr;
+ *num_out = atypes->ntypes;
+ *types_out = atypes->types;
+ free(atypes);
+ return 0;
+}
+
/*
* PKINIT
*/
#include "asn1_get.h"
#include "krb5_decode_macros.h"
-#ifndef LEAN_CLIENT
#if 0
+#ifndef LEAN_CLIENT
krb5_error_code
decode_krb5_authenticator(const krb5_data *code, krb5_authenticator **repptr)
{
return retval;
}
#endif
-#endif
krb5_error_code KRB5_CALLCONV
krb5_decode_ticket(const krb5_data *code, krb5_ticket **repptr)
return decode_krb5_ticket(code, repptr);
}
-#if 0
krb5_error_code
decode_krb5_ticket(const krb5_data *code, krb5_ticket **repptr)
{
cleanup(free);
}
-#endif
krb5_error_code KRB5_CALLCONV
krb5int_get_authdata_containee_types(krb5_context context,
assert(0); /* NOTREACHED */
}
-#if 0
#ifndef DISABLE_PKINIT
krb5_error_code
}
/****************************************************************/
- /* decode_krb5_authdata */
+ /* decode_krb5_authdata and krb5int_get_authdata_containee_types */
{
- krb5_authdata **ref, **var;
+ krb5_authdata **ref, **var, tmp;
+ unsigned int count;
+ krb5_authdatatype *types = NULL;
ktest_make_sample_authorization_data(&ref);
retval = krb5_data_hex_parse(&code,"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");
if (retval) {
}
retval = decode_krb5_authdata(&code,&var);
if (retval) com_err("decoding authorization_data",retval,"");
- test(ktest_equal_authorization_data(ref,var),"authorization_data\n")
- krb5_free_data_contents(test_context, &code);
+ test(ktest_equal_authorization_data(ref,var),"authorization_data\n");
+ tmp.length = code.length;
+ tmp.contents = (krb5_octet *)code.data;
+ retval = krb5int_get_authdata_containee_types(test_context, &tmp,
+ &count, &types);
+ if (retval) com_err("reading authdata types",retval,"");
+ test(count == 2 && types[0] == 1 && types[1] == 1,
+ "authorization_data(types only)\n");
+ free(types);
+ krb5_free_data_contents(test_context, &code);
krb5_free_authdata(test_context, var);
ktest_destroy_authorization_data(&ref);
}