Skip to content

Fix SftpFileAttributes file type detection - #1688

Merged
Rob-Hague merged 4 commits into
sshnet:developfrom
Rob-Hague:sftpfileattributes
Oct 1, 2025
Merged

Fix SftpFileAttributes file type detection#1688
Rob-Hague merged 4 commits into
sshnet:developfrom
Rob-Hague:sftpfileattributes

Conversation

@Rob-Hague

Copy link
Copy Markdown
Collaborator

To get the file type, S_IFMT should be used as the mask. Instead it was using each file type as the mask. It meant that e.g. a symbolic link would also show as a regular file and a character device.

Also allow setting and retrieving the setuid/setgid/sticky bits

closes#1000
closes#159

To get the file type, S_IFMT should be used as the mask. Instead it was using each file
type as the mask. It meant that e.g. a symbolic link would also show as a regular file
and a character device.
Also allow setting and retrieving the setuid/setgid/sticky bits
{
uint flag = 0;

if (IsSizeChanged && IsRegularFile)

@Rob-HagueRob-HagueAug 12, 2025

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed the IsRegularFile condition because I don't think it needs to exist. And given the bug, this condition would still have passed for a symbolic link, so this is more like keeping the behaviour the same

@Rob-Hague
Rob-Hague merged commit af279d2 into sshnet:developOct 1, 2025
4 checks passed
@Rob-Hague
Rob-Hague deleted the sftpfileattributes branch October 1, 2025 20:19
This was referenced Aug 12, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SftpFileAttributes incorrect bit masking for file type, should always use & S_IFMT Get/Update Unix special permissions (setuid, setgid and Sticky Bit)

2 participants

@Rob-Hague@WojciechNagorski