From: Greg Hudson Date: Fri, 21 Jan 2011 18:09:56 +0000 (+0000) Subject: Add a trace log event for unrecognized enctypes in a profile enctype X-Git-Tag: krb5-1.10-alpha1~612 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a6eafba6148b91fda7c2b1544e968ae325ffc868;p=krb5.git Add a trace log event for unrecognized enctypes in a profile enctype list. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24602 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/k5-int.h b/src/include/k5-int.h index ac46b4600..d188f8e9d 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -3018,7 +3018,8 @@ krb5int_get_authdata_containee_types(krb5_context context, unsigned int *nad_types, krb5_authdatatype **ad_types); -krb5_error_code krb5int_parse_enctype_list(krb5_context context, char *profstr, +krb5_error_code krb5int_parse_enctype_list(krb5_context context, + const char *profkey, char *profstr, krb5_enctype *default_list, krb5_enctype **result); diff --git a/src/include/k5-trace.h b/src/include/k5-trace.h index 1bd4b4451..a4a0b83de 100644 --- a/src/include/k5-trace.h +++ b/src/include/k5-trace.h @@ -149,6 +149,9 @@ #define TRACE_GIC_PWD_MASTER(c) \ TRACE(c, (c, "Retrying AS request with master KDC")) +#define TRACE_ENCTYPE_LIST_UNKNOWN(c, profvar, name) \ + TRACE(c, (c, "Unrecognized enctype name in {str}: {str}", profvar, name)) + #define TRACE_INIT_CREDS(c, princ) \ TRACE(c, (c, "Getting initial credentials for {princ}", princ)) #define TRACE_INIT_CREDS_AS_KEY_GAK(c, keyblock) \ diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c index 67810adcb..4f0075031 100644 --- a/src/lib/krb5/krb/init_ctx.c +++ b/src/lib/krb5/krb/init_ctx.c @@ -404,8 +404,9 @@ mod_list(krb5_enctype etype, krb5_boolean add, krb5_boolean allow_weak, * parsing profstr. profstr may be modified during parsing. */ krb5_error_code -krb5int_parse_enctype_list(krb5_context context, char *profstr, - krb5_enctype *default_list, krb5_enctype **result) +krb5int_parse_enctype_list(krb5_context context, const char *profkey, + char *profstr, krb5_enctype *default_list, + krb5_enctype **result) { char *token, *delim = " \t\r\n,", *save = NULL; krb5_boolean sel, weak = context->allow_weak_crypto; @@ -450,6 +451,8 @@ krb5int_parse_enctype_list(krb5_context context, char *profstr, } else if (krb5_string_to_enctype(token, &etype) == 0) { /* Set a specific enctype. */ mod_list(etype, sel, weak, &list); + } else { + TRACE_ENCTYPE_LIST_UNKNOWN(context, profkey, token); } } @@ -489,8 +492,8 @@ get_profile_etype_list(krb5_context context, krb5_enctype **etypes_ptr, profkey, NULL, "DEFAULT", &profstr); if (code) return code; - code = krb5int_parse_enctype_list(context, profstr, default_list, - &etypes); + code = krb5int_parse_enctype_list(context, profkey, profstr, + default_list, &etypes); profile_release_string(profstr); if (code) return code; diff --git a/src/lib/krb5/krb/t_etypes.c b/src/lib/krb5/krb/t_etypes.c index b27f7bdfe..5de4ced0b 100644 --- a/src/lib/krb5/krb/t_etypes.c +++ b/src/lib/krb5/krb/t_etypes.c @@ -238,8 +238,8 @@ main(int argc, char **argv) if (tests[i].str != NULL) { copy = strdup(tests[i].str); - ret = krb5int_parse_enctype_list(ctx, copy, tests[i].defaults, - &list); + ret = krb5int_parse_enctype_list(ctx, "", copy, + tests[i].defaults, &list); if (ret != expected_err) { com_err("krb5int_parse_enctype_list", ret, ""); return 2;