-/* $OpenBSD: auth2.c,v 1.117 2008/07/02 12:36:39 djm Exp $ */
+/* $OpenBSD: auth2.c,v 1.121 2009/06/22 05:39:28 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
#include <string.h>
#include <unistd.h>
+#include "atomicio.h"
#include "xmalloc.h"
#include "ssh2.h"
#include "packet.h"
#ifdef GSSAPI
extern Authmethod method_gssapi;
#endif
+#ifdef JPAKE
+extern Authmethod method_jpake;
+#endif
Authmethod *authmethods[] = {
&method_none,
&method_pubkey,
#ifdef GSSAPI
&method_gssapi,
+#endif
+#ifdef JPAKE
+ &method_jpake,
#endif
&method_passwd,
&method_kbdint,
}
/* reset state */
auth2_challenge_stop(authctxt);
+#ifdef JPAKE
+ auth2_jpake_stop(authctxt);
+#endif
#ifdef GSSAPI
+ /* XXX move to auth2_gssapi_stop() */
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
#endif
/* now we can break out */
authctxt->success = 1;
} else {
- if (++authctxt->failures > options.max_authtries) {
+
+ /* Allow initial try of "none" auth without failure penalty */
+ if (authctxt->attempt > 1 || strcmp(method, "none") != 0)
+ authctxt->failures++;
+ if (authctxt->failures >= options.max_authtries) {
#ifdef SSH_AUDIT_EVENTS
PRIVSEP(audit_event(SSH_LOGIN_EXCEED_MAXTRIES));
#endif