Fix to compare using new_entry instead of cur_entry. (Bug made in
authorTheodore Tso <tytso@mit.edu>
Wed, 5 Oct 1994 02:10:35 +0000 (02:10 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 5 Oct 1994 02:10:35 +0000 (02:10 +0000)
previous modification. )  Don't free cur_entry twice on errors.

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

src/lib/krb5/keytab/file/ChangeLog
src/lib/krb5/keytab/file/ktf_get_en.c

index 2d60a62007941da723e65616a492ae74c296b6f8..b6bb32ff66d1b7bb0f82f2b2350d7c248ad5acdf 100644 (file)
@@ -1,5 +1,9 @@
 Tue Oct  4 16:20:48 1994  Theodore Y. Ts'o  (tytso@dcl)
 
+       * ktf_get_en.c (krb5_ktfile_get_entry): Fix to compare using
+               new_entry instead of cur_entry.  (Bug made in modification
+               on Sep 28th).  Don't free cur_entry twice on errors.
+
         * ktfile.h
        * ktf_wreslv.c (krb5_ktfile_wresolve):
        * ktf_resolv.c (krb5_ktf_resolv): Resolv's first argument is now a
index 2660a455ff811abe2846df1a8010c4e46f2241a2..a1c18fc107bf3d6214f5e15e9f3a41d82604d7e5 100644 (file)
@@ -54,11 +54,13 @@ OLDDECLARG(krb5_keytab_entry *, entry)
      * is exited with a break statement.
      */
     cur_entry.principal = 0;
+    cur_entry.vno = 0;
+    cur_entry.key.contents = 0;
     while (TRUE) {
        if (kerror = krb5_ktfileint_read_entry(id, &new_entry))
            break;
 
-       if (krb5_principal_compare(principal, cur_entry.principal)) {
+       if (krb5_principal_compare(principal, new_entry.principal)) {
                if (kvno == IGNORE_VNO) {
                        if (cur_entry.vno < new_entry.vno) {
                                krb5_kt_free_entry(&cur_entry);
@@ -76,14 +78,11 @@ OLDDECLARG(krb5_keytab_entry *, entry)
        if (kerror == KRB5_KT_END)
            kerror = KRB5_KT_NOTFOUND;
        (void) krb5_ktfileint_close(id);
-       if (cur_entry.principal)
-               krb5_kt_free_entry(&cur_entry);
+       krb5_kt_free_entry(&cur_entry);
        return kerror;
     }
     if ((kerror = krb5_ktfileint_close(id)) != 0) {
        krb5_kt_free_entry(&cur_entry);
-       if (cur_entry.principal)
-               krb5_kt_free_entry(&cur_entry);
        return kerror;
     }
     *entry = cur_entry;