Fix for OpenSSH interoperability
[mech_eap.orig] / mech_eap / init_sec_context.c
index a7d17b5..c42fa88 100644 (file)
@@ -543,7 +543,9 @@ eapGssSmInitAcceptorName(OM_uint32 *minor,
                ctx->acceptorName == GSS_C_NO_NAME) {
         /* Accept target name hint from acceptor */
         major = gssEapImportName(minor, inputToken,
-                                 GSS_C_NT_USER_NAME, &ctx->acceptorName);
+                                 GSS_C_NT_USER_NAME,
+                                 ctx->mechanismUsed,
+                                 &ctx->acceptorName);
         if (GSS_ERROR(major))
             return major;
     }
@@ -952,10 +954,8 @@ gss_init_sec_context(OM_uint32 *minor,
     if (initialContextToken) {
         major = initBegin(minor, cred, ctx, target_name, mech_type,
                           req_flags, time_req, input_chan_bindings);
-        if (GSS_ERROR(major)) {
-            gssEapReleaseContext(minor, &ctx);
-            return major;
-        }
+        if (GSS_ERROR(major))
+            goto cleanup;
     }
 
     major = gssEapSmStep(minor,