9fd6981
diff --color -rup a/monitor.c b/monitor.c
9fd6981
--- a/monitor.c	2022-07-11 15:11:28.146863144 +0200
9fd6981
+++ b/monitor.c	2022-07-11 15:15:35.726655877 +0200
9fd6981
@@ -376,8 +376,15 @@ monitor_child_preauth(struct ssh *ssh, s
9fd6981
 		if (ent->flags & (MON_AUTHDECIDE|MON_ALOG)) {
9fd6981
 			auth_log(ssh, authenticated, partial,
9fd6981
 			    auth_method, auth_submethod);
9fd6981
-			if (!partial && !authenticated)
9fd6981
+			if (!partial && !authenticated) {
9fd6981
+#ifdef GSSAPI
9fd6981
+				/* If gssapi-with-mic failed, MONITOR_REQ_GSSCHECKMIC is disabled.
9fd6981
+				 * We have to reenable it to try again for gssapi-keyex */
9fd6981
+				if (strcmp(auth_method, "gssapi-with-mic") == 0 && options.gss_keyex)
9fd6981
+					monitor_permit(mon_dispatch, MONITOR_REQ_GSSCHECKMIC, 1);
9fd6981
+#endif
9fd6981
 				authctxt->failures++;
9fd6981
+			}
9fd6981
 			if (authenticated || partial) {
9fd6981
 				auth2_update_session_info(authctxt,
9fd6981
 				    auth_method, auth_submethod);