Fix name initialization in gss_krb5int_import_cred
authorGreg Hudson <ghudson@mit.edu>
Wed, 20 Jul 2011 22:40:46 +0000 (22:40 +0000)
committerGreg Hudson <ghudson@mit.edu>
Wed, 20 Jul 2011 22:40:46 +0000 (22:40 +0000)
If we're going to fake up a name, we have to initialize its lock.  It
might be better to use kg_init_name(), but we don't have a context on
hand.

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

src/lib/gssapi/krb5/acquire_cred.c

index ca5438bc13f76eb43c1d29afd3935dda4305b13a..df029cc32e8cd9456af3e7038dddc75bc21ffec5 100644 (file)
@@ -834,6 +834,7 @@ gss_krb5int_import_cred(OM_uint32 *minor_status,
     struct acquire_cred_args args;
     krb5_gss_name_rec name;
     OM_uint32 time_rec;
+    krb5_error_code code;
 
     assert(value->length == sizeof(*req));
 
@@ -846,6 +847,11 @@ gss_krb5int_import_cred(OM_uint32 *minor_status,
 
     if (req->keytab_principal) {
         memset(&name, 0, sizeof(name));
+        code = k5_mutex_init(&name.lock);
+        if (code != 0) {
+            *minor_status = code;
+            return GSS_S_FAILURE;
+        }
         name.princ = req->keytab_principal;
         args.desired_name = (gss_name_t)&name;
     }