@@ -6420,7 +6420,7 @@ static int DoUserAuthInfoResponse(WOLFSSH* ssh,
64206420 WS_UserAuthData authData;
64216421 WS_UserAuthData_Keyboard* kb = NULL;
64226422 int ret = WS_SUCCESS;
6423- int authFailure = 0;
6423+ int authFailure = 0, authRejected = 0 ;
64246424 byte partialSuccess = 0;
64256425 word32 entry;
64266426 word32 allocatedCount = 0;
@@ -6519,6 +6519,7 @@ static int DoUserAuthInfoResponse(WOLFSSH* ssh,
65196519 #ifndef NO_FAILURE_ON_REJECTED
65206520 authFailure = 1;
65216521 #endif
6522+ authRejected = 1;
65226523 ret = WS_USER_AUTH_E;
65236524 }
65246525 else if (ret == WOLFSSH_USERAUTH_WOULD_BLOCK) {
@@ -6548,6 +6549,9 @@ static int DoUserAuthInfoResponse(WOLFSSH* ssh,
65486549
65496550 if (authFailure || partialSuccess) {
65506551 ret = SendUserAuthFailure(ssh, partialSuccess);
6552+ if (ret == WS_SUCCESS && authRejected) {
6553+ ret = WS_USER_AUTH_E;
6554+ }
65516555 }
65526556 else if (ret == WOLFSSH_USERAUTH_SUCCESS_ANOTHER) {
65536557 ret = SendUserAuthKeyboardRequest(ssh, &authData);
@@ -6569,7 +6573,7 @@ static int DoUserAuthRequestPassword(WOLFSSH* ssh, WS_UserAuthData* authData,
65696573 word32 begin;
65706574 WS_UserAuthData_Password* pw = NULL;
65716575 int ret = WS_SUCCESS;
6572- int authFailure = 0;
6576+ int authFailure = 0, authRejected = 0 ;
65736577 byte partialSuccess = 0;
65746578
65756579 WLOG(WS_LOG_DEBUG, "Entering DoUserAuthRequestPassword()");
@@ -6626,6 +6630,7 @@ static int DoUserAuthRequestPassword(WOLFSSH* ssh, WS_UserAuthData* authData,
66266630 #ifndef NO_FAILURE_ON_REJECTED
66276631 authFailure = 1;
66286632 #endif
6633+ authRejected = 1;
66296634 ret = WS_USER_AUTH_E;
66306635 }
66316636 else if (ret == WOLFSSH_USERAUTH_WOULD_BLOCK) {
@@ -6649,6 +6654,9 @@ static int DoUserAuthRequestPassword(WOLFSSH* ssh, WS_UserAuthData* authData,
66496654
66506655 if (authFailure || partialSuccess) {
66516656 ret = SendUserAuthFailure(ssh, partialSuccess);
6657+ if (ret == WS_SUCCESS && authRejected) {
6658+ ret = WS_USER_AUTH_E;
6659+ }
66526660 }
66536661 else if (ret == WS_SUCCESS) {
66546662 ssh->clientState = CLIENT_USERAUTH_DONE;
@@ -7421,7 +7429,7 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData,
74217429 word32 sigBlobSz = 0;
74227430 word32 begin;
74237431 int ret = WS_SUCCESS;
7424- int authFailure = 0;
7432+ int authFailure = 0, authRejected = 0 ;
74257433 int partialSuccess = 0;
74267434 byte hasSig = 0;
74277435 byte pkTypeId = ID_NONE;
@@ -7589,6 +7597,7 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData,
75897597 #ifndef NO_FAILURE_ON_REJECTED
75907598 authFailure = 1;
75917599 #endif
7600+ authRejected = 1;
75927601 ret = WS_USER_AUTH_E;
75937602 }
75947603 else {
@@ -7745,6 +7754,9 @@ static int DoUserAuthRequestPublicKey(WOLFSSH* ssh, WS_UserAuthData* authData,
77457754
77467755 if (authFailure) {
77477756 ret = SendUserAuthFailure(ssh, 0);
7757+ if (ret == WS_SUCCESS && authRejected) {
7758+ ret = WS_USER_AUTH_E;
7759+ }
77487760 }
77497761 else if (partialSuccess && hasSig) {
77507762 ret = SendUserAuthFailure(ssh, 1);
0 commit comments