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
28 changes: 28 additions & 0 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -6539,6 +6539,20 @@ static int DoServiceRequest(WOLFSSH* ssh,

ret = GetString(name, &nameSz, buf, len, idx);

/* Requested service must be 'ssh-userauth' */
if (ret == WS_SUCCESS) {
const char* nameUserAuth = IdToName(ID_SERVICE_USERAUTH);
if (nameUserAuth == NULL
|| nameSz != (word32)XSTRLEN(nameUserAuth)
|| XMEMCMP(name, nameUserAuth, nameSz) != 0) {
WLOG(WS_LOG_DEBUG, "Requested unsupported service: %s", name);
/* Terminate session, ignore result of disconnect attempt */
(void)SendDisconnect(ssh,
WOLFSSH_DISCONNECT_SERVICE_NOT_AVAILABLE);
ret = WS_INVALID_STATE_E;
}
}

if (ret == WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Requesting service: %s", name);
ssh->clientState = CLIENT_USERAUTH_REQUEST_DONE;
Expand All @@ -6557,6 +6571,20 @@ static int DoServiceAccept(WOLFSSH* ssh,

ret = GetString(name, &nameSz, buf, len, idx);

/* Accepted service must be 'ssh-userauth' */
if (ret == WS_SUCCESS) {
const char* nameUserAuth = IdToName(ID_SERVICE_USERAUTH);
if (nameUserAuth == NULL
|| nameSz != (word32)XSTRLEN(nameUserAuth)
|| XMEMCMP(name, nameUserAuth, nameSz) != 0) {
WLOG(WS_LOG_DEBUG, "Accepted unexpected service: %s", name);
/* Terminate session, ignore result of disconnect attempt */
(void)SendDisconnect(ssh,
WOLFSSH_DISCONNECT_SERVICE_NOT_AVAILABLE);
ret = WS_INVALID_STATE_E;
}
}

if (ret == WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "Accepted service: %s", name);
ssh->serverState = SERVER_USERAUTH_REQUEST_DONE;
Comment thread
ejohnstown marked this conversation as resolved.
Expand Down
Loading