Skip to content

Commit

Permalink
wolfSSHd Connection Closure
Browse files Browse the repository at this point in the history
1. Fix a bunch of function wrappers. Was using the Xname rather than the
   preferred Wname.
  • Loading branch information
ejohnstown committed Jul 16, 2024
1 parent 8f0b1ad commit 1b796d7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/wolfsshd/wolfsshd.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static byte* getBufferFromFile(const char* fileName, word32* bufSz, void* heap)

if (WFOPEN(NULL, &file, fileName, "rb") != 0)
return NULL;
WFSEEK(NULL, file, 0, XSEEK_END);
WFSEEK(NULL, file, 0, WSEEK_END);
fileSz = (word32)WFTELL(NULL, file);
WREWIND(NULL, file);

Expand Down Expand Up @@ -1175,7 +1175,7 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
forcedCmd = (char*)subCmd;
}

if (forcedCmd != NULL && XSTRCMP(forcedCmd, "internal-sftp") == 0) {
if (forcedCmd != NULL && WSTRCMP(forcedCmd, "internal-sftp") == 0) {
wolfSSH_Log(WS_LOG_ERROR,
"[SSHD] Only SFTP connections allowed for user "
"%s", wolfSSH_GetUsername(ssh));
Expand Down Expand Up @@ -1320,11 +1320,11 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
}

/* default to /bin/sh if user shell is not set */
if (pPasswd->pw_shell && XSTRLEN(pPasswd->pw_shell)) {
XSNPRINTF(cmd, sizeof(cmd), "%s", pPasswd->pw_shell);
if (pPasswd->pw_shell && WSTRLEN(pPasswd->pw_shell)) {
WSNPRINTF(cmd, sizeof(cmd), "%s", pPasswd->pw_shell);
}
else {
XSNPRINTF(cmd, sizeof(cmd), "%s", "/bin/sh");
WSNPRINTF(cmd, sizeof(cmd), "%s", "/bin/sh");
}

errno = 0;
Expand Down Expand Up @@ -2077,7 +2077,7 @@ static char* _convertHelper(WCHAR* in, void* heap) {
if (ret != NULL) {
size_t numConv = 0;
if (wcstombs_s(&numConv, ret, retSz, in, retSz) != 0) {
XFREE(ret, heap, DYNTYPE_SSHD);
WFREE(ret, heap, DYNTYPE_SSHD);
ret = NULL;
}
}
Expand Down

0 comments on commit 1b796d7

Please sign in to comment.