* kt_file.c (krb5_ktfile_get_entry): Check principal name prior to
authorTom Yu <tlyu@mit.edu>
Thu, 22 May 2003 23:13:49 +0000 (23:13 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 22 May 2003 23:13:49 +0000 (23:13 +0000)
checking enctype.  Suggested by Wyllys Ingersoll.

ticket: 1229
status: open
tags: pullup

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

src/lib/krb5/keytab/ChangeLog
src/lib/krb5/keytab/kt_file.c

index 87f76ed2f83d3a82e891ce87dd311e9e3162624e..a3c4f8c7a47ddcaf48bc53ecd6138e3fa824fbd4 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-22  Tom Yu  <tlyu@mit.edu>
+
+       * kt_file.c (krb5_ktfile_get_entry): Check principal name prior to
+       checking enctype.  Suggested by Wyllys Ingersoll.
+
 2003-05-19  Sam Hartman  <hartmans@mit.edu>
 
        * ktbase.c: Register writable keytab by default
index 9b7b9ae8f8b9da9853b4d63ccca9c0b36871c8ab..3175de75185aa1870388a55f4b8df01d2d09dedb 100644 (file)
@@ -258,6 +258,14 @@ krb5_ktfile_get_entry(krb5_context context, krb5_keytab id, krb5_const_principal
           and copy new_entry there, or free new_entry.  Otherwise, it
           leaks. */
 
+       /* if the principal isn't the one requested, free new_entry
+          and continue to the next. */
+
+       if (!krb5_principal_compare(context, principal, new_entry.principal)) {
+           krb5_kt_free_entry(context, &new_entry);
+           continue;
+       }
+
        /* if the enctype is not ignored and doesn't match, free new_entry
           and continue to the next */
 
@@ -281,14 +289,6 @@ krb5_ktfile_get_entry(krb5_context context, krb5_keytab id, krb5_const_principal
 
        }
 
-       /* if the principal isn't the one requested, free new_entry
-          and continue to the next. */
-
-       if (!krb5_principal_compare(context, principal, new_entry.principal)) {
-           krb5_kt_free_entry(context, &new_entry);
-           continue;
-       }
-
        if (kvno == IGNORE_VNO) {
            /* if this is the first match, or if the new vno is
               bigger, free the current and keep the new.  Otherwise,