From 1b796d74704de4d2ff8b0c07990cf0b732abcff3 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Mon, 15 Jul 2024 18:19:37 -0700 Subject: [PATCH] wolfSSHd Connection Closure 1. Fix a bunch of function wrappers. Was using the Xname rather than the preferred Wname. --- apps/wolfsshd/wolfsshd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/wolfsshd/wolfsshd.c b/apps/wolfsshd/wolfsshd.c index ef62b56a7..4993f2a29 100644 --- a/apps/wolfsshd/wolfsshd.c +++ b/apps/wolfsshd/wolfsshd.c @@ -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); @@ -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)); @@ -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; @@ -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; } }