]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix GSS krb5 acceptor acquire_cred error handling
authorGreg Hudson <ghudson@mit.edu>
Mon, 16 Dec 2013 20:37:56 +0000 (15:37 -0500)
committerTom Yu <tlyu@mit.edu>
Thu, 23 Jan 2014 03:21:43 +0000 (22:21 -0500)
When acquiring acceptor creds with a specified name, if we fail to
open a replay cache, we leak the keytab handle.  If there is no
specified name and we discover that there is no content in the keytab,
we leak the keytab handle and return the wrong major code.  Memory
leak reported by Andrea Campi.

(cherry picked from commit decccbcb5075f8fbc28a535a9b337afc84a15dee)

ticket: 7844 (new)
version_fixed: 1.10.8
status: resolved

src/lib/gssapi/krb5/acquire_cred.c

index c815b3590a6e3c632cfc089ce0a74ee719820757..a7a209e5f6fa4548981f44eb8810d7df69550895 100644 (file)
@@ -243,6 +243,7 @@ acquire_accept_cred(krb5_context context,
         assert(cred->name == NULL);
         code = kg_duplicate_name(context, desired_name, &cred->name);
         if (code) {
+            krb5_kt_close(context, kt);
             *minor_status = code;
             return GSS_S_FAILURE;
         }
@@ -251,8 +252,9 @@ acquire_accept_cred(krb5_context context,
         code = krb5_get_server_rcache(context, &desired_name->princ->data[0],
                                       &cred->rcache);
         if (code) {
+            krb5_kt_close(context, kt);
             *minor_status = code;
-            return GSS_S_FAILURE;
+            return GSS_S_CRED_UNAVAIL;
         }
     }