Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions examples/echoserver/echoserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,7 @@ static int wsUserAuth(byte authType,
{
PwMapList* list;
PwMap* map;
byte authHash[WC_SHA256_DIGEST_SIZE];
byte authHash[WC_SHA256_DIGEST_SIZE] = {0};

if (ctx == NULL) {
fprintf(stderr, "wsUserAuth: ctx not set");
Expand All @@ -2306,19 +2306,6 @@ static int wsUserAuth(byte authType,
return WOLFSSH_USERAUTH_WOULD_BLOCK;
}

if (authType != WOLFSSH_USERAUTH_PASSWORD &&
#ifdef WOLFSSH_ALLOW_USERAUTH_NONE
authType != WOLFSSH_USERAUTH_NONE &&
#endif
#ifdef WOLFSSH_KEYBOARD_INTERACTIVE
authType != WOLFSSH_USERAUTH_KEYBOARD &&
authType != WOLFSSH_USERAUTH_KEYBOARD_SETUP &&
#endif
authType != WOLFSSH_USERAUTH_PUBLICKEY) {

return WOLFSSH_USERAUTH_FAILURE;
}

if (authType == WOLFSSH_USERAUTH_PASSWORD) {
wc_Sha256Hash(authData->sf.password.password,
authData->sf.password.passwordSz,
Expand All @@ -2333,6 +2320,9 @@ static int wsUserAuth(byte authType,
authData->sf.keyboard.responseLengths[0],
authHash);
}
else if (authType == WOLFSSH_USERAUTH_KEYBOARD_SETUP) {
/* Do nothing. */
}
#endif
else if (authType == WOLFSSH_USERAUTH_PUBLICKEY) {
wc_Sha256Hash(authData->sf.publicKey.publicKey,
Expand Down Expand Up @@ -2406,6 +2396,14 @@ static int wsUserAuth(byte authType,
}
#endif /* WOLFSSH_CERTS && !WOLFSSH_NO_FPKI */
}
#ifdef WOLFSSH_ALLOW_USERAUTH_NONE
else if (authType == WOLFSSH_USERAUTH_NONE) {
/* Handled in the map loop below. */
}
#endif
else {
return WOLFSSH_USERAUTH_INVALID_AUTHTYPE;
}

list = (PwMapList*)ctx;
map = list->head;
Expand Down
Loading