Skip to content

Commit b048f18

Browse files
authored
Merge pull request #885 from padelsbach/padelsbach/finding-401-402-403
Fix multibyte passwords, file mode and attrib reporting
2 parents 1e1140a + 0458d83 commit b048f18

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
@@ -816,7 +816,7 @@ static int CheckPasswordWIN(const char* usr, const byte* pw, word32 pwSz, WOLFSS
816816
}
817817

818818
if (ret == WSSHD_AUTH_SUCCESS) {
819-
if (MultiByteToWideChar(CP_UTF8, 0, pw, pwSz, pwW, pwWSz) != pwSz) {
819+
if (MultiByteToWideChar(CP_UTF8, 0, pw, pwSz, pwW, pwWSz) != pwWSz) {
820820
ret = WSSHD_AUTH_FAILURE;
821821
}
822822
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
@@ -4687,7 +4687,7 @@ int SFTP_GetAttributes(void* fs, const char* fileName, WS_SFTP_FILEATRB* atr,
46874687

46884688
atr->flags |= WOLFSSH_FILEATRB_PERM;
46894689
atr->per = 0555 |
4690-
((stats.dwFileAttributes | FILE_ATTRIBUTE_READONLY) ? 0 : 0200);
4690+
((stats.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : 0200);
46914691
atr->per |= ((stats.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
46924692
? FILEATRB_PER_DIR : FILEATRB_PER_FILE);
46934693

0 commit comments

Comments
 (0)