Add a trace log event for unrecognized enctypes in a profile enctype
authorGreg Hudson <ghudson@mit.edu>
Fri, 21 Jan 2011 18:09:56 +0000 (18:09 +0000)
committerGreg Hudson <ghudson@mit.edu>
Fri, 21 Jan 2011 18:09:56 +0000 (18:09 +0000)
list.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24602 dc483132-0cff-0310-8789-dd5450dbe970

src/include/k5-int.h
src/include/k5-trace.h
src/lib/krb5/krb/init_ctx.c
src/lib/krb5/krb/t_etypes.c

index ac46b460068fd6ded71319cac17007cf2adc8c37..d188f8e9d842d0ad176814fa5ace4139e8d46cd1 100644 (file)
@@ -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);
 
index 1bd4b44513d27ea6dd7d4043766f0093b836e77c..a4a0b83de6e163581df82f6c8253cd3eacd6cec3 100644 (file)
 #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) \
index 67810adcbe679d79bf03a49a45480bda9ad68631..4f007503116f566b310425d2e33dd440ea234409 100644 (file)
@@ -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;
index b27f7bdfe3d434543b7f173524da2da86ef91816..5de4ced0b3ff02c9bb0945b42e46c6f2076dabaa 100644 (file)
@@ -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;