mirror of https://github.com/wolfSSL/wolfssh.git
Fix handling of empty prompts in keyboard-interactive auth test
Co-Authored-By: andrew@wolfssl.com <andrew@wolfssl.com>pull/803/head
parent
4cc1aa583c
commit
727a0c8d7a
|
@ -425,16 +425,24 @@ static int keyboardUserAuth(byte authType, WS_UserAuthData* authData, void* ctx)
|
||||||
|
|
||||||
if (authType == WOLFSSH_USERAUTH_KEYBOARD) {
|
if (authType == WOLFSSH_USERAUTH_KEYBOARD) {
|
||||||
AssertIntEQ(kbResponseCount, authData->sf.keyboard.promptCount);
|
AssertIntEQ(kbResponseCount, authData->sf.keyboard.promptCount);
|
||||||
|
|
||||||
|
/* Only check prompts if there are any */
|
||||||
|
if (kbResponseCount > 0) {
|
||||||
for (word32 prompt = 0; prompt < kbResponseCount; prompt++) {
|
for (word32 prompt = 0; prompt < kbResponseCount; prompt++) {
|
||||||
AssertStrEQ("Password: ", authData->sf.keyboard.prompts[prompt]);
|
AssertStrEQ("Password: ", authData->sf.keyboard.prompts[prompt]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
authData->sf.keyboard.responseCount = kbResponseCount;
|
authData->sf.keyboard.responseCount = kbResponseCount;
|
||||||
if (unbalanced) {
|
if (unbalanced) {
|
||||||
authData->sf.keyboard.responseCount++;
|
authData->sf.keyboard.responseCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Only set response pointers if there are responses */
|
||||||
|
if (kbResponseCount > 0) {
|
||||||
authData->sf.keyboard.responseLengths = kbResponseLengths;
|
authData->sf.keyboard.responseLengths = kbResponseLengths;
|
||||||
authData->sf.keyboard.responses = (byte**)kbResponses;
|
authData->sf.keyboard.responses = (byte**)kbResponses;
|
||||||
|
}
|
||||||
ret = WS_SUCCESS;
|
ret = WS_SUCCESS;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue