Skip to content

Commit 0458d83

Browse files
committed
Fix multibyte passwords, file mode and attrib reporting
1 parent 567efa5 commit 0458d83

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

apps/wolfsshd/auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ static int CheckPasswordWIN(const char* usr, const byte* pw, word32 pwSz, WOLFSS
815815
}
816816

817817
if (ret == WSSHD_AUTH_SUCCESS) {
818-
if (MultiByteToWideChar(CP_UTF8, 0, pw, pwSz, pwW, pwWSz) != pwSz) {
818+
if (MultiByteToWideChar(CP_UTF8, 0, pw, pwSz, pwW, pwWSz) != pwWSz) {
819819
ret = WSSHD_AUTH_FAILURE;
820820
}
821821
else {

src/wolfscp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,9 +2253,9 @@ static int GetFileStats(void *fs, ScpSendCtx* ctx, const char* fileName,
22532253
*fileMode = 0755;
22542254
/* Mimic S_IFMT */
22552255
if (ctx->s.type == FS_DIR_ENTRY_FILE)
2256-
*fileMode |= 0040000;
2256+
*fileMode |= 0100000; /* S_IFREG */
22572257
else if (ctx->s.type == FS_DIR_ENTRY_DIR)
2258-
*fileMode |= 0100000;
2258+
*fileMode |= 0040000; /* S_IFDIR */
22592259
else
22602260
ret = WS_BAD_FILE_E;
22612261

src/wolfsftp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4709,7 +4709,7 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr,
47094709

47104710
atr->flags |= WOLFSSH_FILEATRB_PERM;
47114711
atr->per = 0555 |
4712-
((stats.dwFileAttributes | FILE_ATTRIBUTE_READONLY) ? 0 : 0200);
4712+
((stats.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : 0200);
47134713
atr->per |= ((stats.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
47144714
? FILEATRB_PER_DIR : FILEATRB_PER_FILE);
47154715

0 commit comments

Comments
 (0)