Hi, I have a question about create_umask. In the following code:
---
Mode = 0777;
if (0 != SecurityDescriptor)
{
Result = FspPosixMapSecurityDescriptorToPermissions(SecurityDescriptor,
&Uid, &Gid, &Mode);
if (!NT_SUCCESS(Result))
goto exit;
}
Mode &= ~context->umask;
if (CreateOptions & FILE_DIRECTORY_FILE)
{
if (f->set_create_dir_umask)
Mode = 0777 & ~f->create_dir_umask;
else if (f->set_create_umask)
Mode = 0777 & ~f->create_umask;
}
else
{
if (f->set_create_file_umask)
Mode = 0777 & ~f->create_file_umask;
else if (f->set_create_umask)
Mode = 0777 & ~f->create_umask;
}
---
As you can see, when create_umask is set, the permission calculated from SecurityDescriptor (for example, 0555) is later overridden by 0777 & ~create_umask.
Is this an intentional behavior? Because in my understanding, it might make more sense if the logic was:
Mode = Mode & ~create_umask;
Thanks in advance!
This applies the default umask as is applied in FUSE. However if there is a create_umask (see the set_create_umask check) it applies that *instead*.
For the original rationale for create_umask see this thread:
https://github.com/winfsp/sshfs-win/issues/14
Later people argued that we really need separate create_umasks for files and directories and so create_file_umask/create_dir_umask were also added.
Thanks.
Bill
--
You received this message because you are subscribed to the Google Groups "WinFsp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
winfsp+un...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/winfsp/697fb713-69cc-440f-801a-6fc24818b129n%40googlegroups.com.