fix up confusion about errors and cur_entry
authorJohn Kohl <jtkohl@mit.edu>
Tue, 8 May 1990 13:42:41 +0000 (13:42 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 8 May 1990 13:42:41 +0000 (13:42 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@778 dc483132-0cff-0310-8789-dd5450dbe970

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

index a4e919225d88bd2c71f3af491cf8e22f852f7c83..dad940c302bc47f4cc3bb640307cd8df6cc5a1d2 100644 (file)
@@ -37,8 +37,6 @@ OLDDECLARG(krb5_keytab_entry *, entry)
     krb5_keytab_entry *cur_entry;
     krb5_error_code kerror = 0; /* XXX */
 
-    bzero((char *)&cur_entry, sizeof(krb5_keytab_entry));
-
     /* Open the keyfile for reading */
     if (kerror = krb5_ktfileint_openr(id))
        return(kerror); /* XXX */
@@ -48,6 +46,7 @@ OLDDECLARG(krb5_keytab_entry *, entry)
      * is exited with a break statement.
      */
     while (TRUE) {
+       cur_entry = 0;
        if (kerror = krb5_ktfileint_read_entry(id, &cur_entry))
            break;
 
@@ -63,8 +62,11 @@ OLDDECLARG(krb5_keytab_entry *, entry)
        return kerror;
     }
     if (!(kerror = krb5_ktfileint_close(id))) {
-       *entry = *cur_entry;
-       xfree(cur_entry);
+       if (cur_entry) {
+           *entry = *cur_entry;
+           xfree(cur_entry);
+       } else
+           kerror = KRB5_KT_NOTFOUND;
     } else
        krb5_kt_free_entry(cur_entry);
     return kerror;