Distinguish between auth and key password failures

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/171/head
Selva Nair 8 years ago
parent b4f03a1932
commit c37467ebe4

@ -220,6 +220,7 @@ OnStateChange(connection_t *c, char *data)
/* Save time when we got connected. */
c->connected_since = atoi(data);
c->failed_psw_attempts = 0;
c->failed_auth_attempts = 0;
c->state = connected;
SetMenuStatus(c, connected);
@ -235,7 +236,9 @@ OnStateChange(connection_t *c, char *data)
{
if (!c->dynamic_cr)
{
if (strcmp(message, "auth-failure") == 0 || strcmp(message, "private-key-password-failure") == 0)
if (strcmp(message, "auth-failure") == 0)
c->failed_auth_attempts++;
else if (strcmp(message, "private-key-password-failure") == 0)
c->failed_psw_attempts++;
if (strcmp(message, "auth-failure") == 0 && (c->flags & FLAG_SAVE_AUTH_PASS))
@ -848,6 +851,7 @@ OnStop(connection_t *c, UNUSED char *msg)
case connected:
/* OpenVPN process ended unexpectedly */
c->failed_psw_attempts = 0;
c->failed_auth_attempts = 0;
c->state = disconnected;
CheckAndSetTrayIcon();
SetDlgItemText(c->hwndStatus, ID_TXT_STATUS, LoadLocalizedString(IDS_NFO_STATE_DISCONNECTED));
@ -909,6 +913,7 @@ OnStop(connection_t *c, UNUSED char *msg)
// }
/* Shutdown was initiated by us */
c->failed_psw_attempts = 0;
c->failed_auth_attempts = 0;
c->state = disconnected;
CheckAndSetTrayIcon();
SendMessage(c->hwndStatus, WM_CLOSE, 0, 0);

@ -102,6 +102,7 @@ struct connection {
BOOL auto_connect; /* AutoConnect at startup id TRUE */
conn_state_t state; /* State the connection currently is in */
int failed_psw_attempts; /* # of failed attempts entering password(s) */
int failed_auth_attempts; /* # of failed user-auth attempts */
time_t connected_since; /* Time when the connection was established */
proxy_t proxy_type; /* Set during querying proxy credentials */

Loading…
Cancel
Save