diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 0cfe8213..25518aab 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -742,7 +742,7 @@ static int wsUserAuth(byte authType, else { ret = (authType == WOLFSSH_USERAUTH_PASSWORD ? (--passwdRetry > 0 ? - WOLFSSH_USERAUTH_INVALID_PASSWORD : WOLFSSH_USERAUTH_PASSWORD_RETRYOUT) + WOLFSSH_USERAUTH_INVALID_PASSWORD : WS_PASSWORD_RETRYOUT) : WOLFSSH_USERAUTH_INVALID_PUBLICKEY); if (passwdRetry == 0)passwdRetry = MAX_PASSWD_RETRY; return ret; diff --git a/src/internal.c b/src/internal.c index 31e78460..73917f12 100644 --- a/src/internal.c +++ b/src/internal.c @@ -272,6 +272,9 @@ const char* GetErrorString(int err) case WS_EXTDATA: return "Extended Data available to be read"; + case WS_PASSWORD_RETRYOUT: + return "Password retry out"; + default: return "Unknown error code"; } @@ -3221,17 +3224,15 @@ static int DoUserAuthRequestPassword(WOLFSSH* ssh, WS_UserAuthData* authData, ssh->clientState = CLIENT_USERAUTH_DONE; ret = WS_SUCCESS; } - else if (ret == WOLFSSH_USERAUTH_INVALID_PASSWORD) { - WLOG(WS_LOG_DEBUG, "DUARPW: password check failed"); + else if (ret == WS_PASSWORD_RETRYOUT) { + WLOG(WS_LOG_DEBUG, "DUARPW: password retry out"); ret = SendUserAuthFailure(ssh, 0); + if (ret == WS_SUCCESS) + ret = WS_PASSWORD_RETRYOUT; } else { - WLOG(WS_LOG_DEBUG, "DUARPW: password check failed"); + WLOG(WS_LOG_DEBUG, "DUARPW: password check failed, retry"); ret = SendUserAuthFailure(ssh, 0); - if(ret == WS_SUCCESS){ - WLOG(WS_LOG_DEBUG, "DUARPW: WS_INVALID_USERNAME"); - ret = WS_INVALID_USERNAME; - } } } else { diff --git a/wolfssh/error.h b/wolfssh/error.h index 4cbd0dfa..ea46c9e2 100644 --- a/wolfssh/error.h +++ b/wolfssh/error.h @@ -105,8 +105,9 @@ enum WS_ErrorCodes { WS_CLOSE_FILE_E = -1065, /* Unable to close local file */ WS_PUBKEY_REJECTED_E = -1066, /* Server public key rejected */ WS_EXTDATA = -1067, /* Extended Data available to be read */ + WS_PASSWORD_RETRYOUT = -1068, /* Password retry out */ - WS_LAST_E = -1067 /* Update this to indicate last error */ + WS_LAST_E = -1068 /* Update this to indicate last error */ }; diff --git a/wolfssh/ssh.h b/wolfssh/ssh.h index b4dfbf3d..fee8c172 100644 --- a/wolfssh/ssh.h +++ b/wolfssh/ssh.h @@ -239,7 +239,6 @@ enum WS_UserAuthResults { WOLFSSH_USERAUTH_INVALID_AUTHTYPE, WOLFSSH_USERAUTH_INVALID_USER, WOLFSSH_USERAUTH_INVALID_PASSWORD, - WOLFSSH_USERAUTH_PASSWORD_RETRYOUT, WOLFSSH_USERAUTH_INVALID_PUBLICKEY };