From d41f005cc1c58604b73847d3ff566f6da6dfdd81 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Tue, 16 Jul 2013 14:57:03 +0200 Subject: [PATCH] add _krb5_get_ad --- lib/krb5/ticket.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/krb5/ticket.c b/lib/krb5/ticket.c index a75fc078c..0b63ee026 100644 --- a/lib/krb5/ticket.c +++ b/lib/krb5/ticket.c @@ -322,6 +322,37 @@ out: return ret; } +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +_krb5_get_ad(krb5_context context, + const AuthorizationData *ad, + krb5_keyblock *sessionkey, + int type, + krb5_data *data) +{ + krb5_boolean found = FALSE; + krb5_error_code ret; + + krb5_data_zero(data); + + if (ad == NULL) { + krb5_set_error_message(context, ENOENT, + N_("No authorization data", "")); + return ENOENT; /* XXX */ + } + + ret = find_type_in_ad(context, type, data, &found, TRUE, sessionkey, ad, 0); + if (ret) + return ret; + if (!found) { + krb5_set_error_message(context, ENOENT, + N_("Have no authorization data of type %d", ""), + type); + return ENOENT; /* XXX */ + } + return 0; +} + + /** * Extract the authorization data type of type from the ticket. Store * the field in data. This function is to use for kerberos