memset(&args, 0, sizeof(args));
+ if (req->id && req->keytab)
+ args.cred_usage = GSS_C_BOTH;
+ else if (req->id)
+ args.cred_usage = GSS_C_INITIATE;
+ else if (req->keytab)
+ args.cred_usage = GSS_C_ACCEPT;
+ else {
+ *minor_status = EINVAL;
+ return GSS_S_FAILURE;
+ }
+
if (req->keytab_principal) {
memset(&name, 0, sizeof(name));
code = k5_mutex_init(&name.lock);
args.ccache = req->id;
args.keytab = req->keytab;
- if (req->id && req->keytab)
- args.cred_usage = GSS_C_BOTH;
- else if (req->id)
- args.cred_usage = GSS_C_INITIATE;
- else if (req->keytab)
- args.cred_usage = GSS_C_ACCEPT;
- else {
- *minor_status = EINVAL;
- return GSS_S_FAILURE;
- }
-
- return acquire_cred(minor_status, &args, cred_handle, &time_rec);
+ code = acquire_cred(minor_status, &args, cred_handle, &time_rec);
+ if (req->keytab_principal)
+ k5_mutex_destroy(&name.lock);
+ return code;
}