From 3386b636cf5a1f55a1c5f3d728cbeccdc719c515 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 20 Mar 2025 09:02:39 -0700 Subject: [PATCH] Fix SFTP Symlinks 1. When making a longname, mask the permission file type bits and check it being a link. 2. Mask the permission bits the same way for checking the item being a directory. --- src/wolfsftp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wolfsftp.c b/src/wolfsftp.c index d228ccff..e5d17d31 100644 --- a/src/wolfsftp.c +++ b/src/wolfsftp.c @@ -2612,10 +2612,10 @@ static int SFTP_CreateLongName(WS_SFTPNAME* name) word32 tmp = atr->per; i = 0; - if (tmp & FILEATRB_PER_DIR) { + if ((tmp & FILEATRB_PER_MASK_TYPE) == FILEATRB_PER_DIR) { perm[i++] = 'd'; } - else if (tmp & FILEATRB_PER_LINK) { + else if ((tmp & FILEATRB_PER_MASK_TYPE) == FILEATRB_PER_LINK) { perm[i++] = 'l'; } else {