Commit a17cd35d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

server: Map a SD group to Unix group modes if the SD owner is present anywhere…

server: Map a SD group to Unix group modes if the SD owner is present anywhere in the current user's token. Instead of requiring the SD owner to match the token user. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44691Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b3dc0c16
...@@ -8365,10 +8365,10 @@ static void test_group_as_file_owner(void) ...@@ -8365,10 +8365,10 @@ static void test_group_as_file_owner(void)
sprintf(path, "%s\\testdir\\subdir", temp_path); sprintf(path, "%s\\testdir\\subdir", temp_path);
ret = CreateDirectoryA(path, NULL); ret = CreateDirectoryA(path, NULL);
todo_wine ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
ret = RemoveDirectoryA(path); ret = RemoveDirectoryA(path);
todo_wine ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
sprintf(path, "%s\\testdir", temp_path); sprintf(path, "%s\\testdir", temp_path);
ret = RemoveDirectoryA(path); ret = RemoveDirectoryA(path);
ok(ret, "got error %u\n", GetLastError()); ok(ret, "got error %u\n", GetLastError());
......
...@@ -473,7 +473,6 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ) ...@@ -473,7 +473,6 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner )
mode_t mode; mode_t mode;
int present; int present;
const ACL *dacl = sd_get_dacl( sd, &present ); const ACL *dacl = sd_get_dacl( sd, &present );
const SID *user = token_get_user( current->process->token );
if (present && dacl) if (present && dacl)
{ {
const ACE_HEADER *ace = (const ACE_HEADER *)(dacl + 1); const ACE_HEADER *ace = (const ACE_HEADER *)(dacl + 1);
...@@ -496,8 +495,8 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ) ...@@ -496,8 +495,8 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner )
{ {
bits_to_set &= ~((mode << 6) | (mode << 3) | mode); /* all */ bits_to_set &= ~((mode << 6) | (mode << 3) | mode); /* all */
} }
else if ((security_equal_sid( user, owner ) && else if (token_sid_present( current->process->token, owner, TRUE ) &&
token_sid_present( current->process->token, sid, TRUE ))) token_sid_present( current->process->token, sid, TRUE ))
{ {
bits_to_set &= ~((mode << 6) | (mode << 3)); /* user + group */ bits_to_set &= ~((mode << 6) | (mode << 3)); /* user + group */
} }
...@@ -516,8 +515,8 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner ) ...@@ -516,8 +515,8 @@ mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner )
new_mode |= mode & bits_to_set; new_mode |= mode & bits_to_set;
bits_to_set &= ~mode; bits_to_set &= ~mode;
} }
else if ((security_equal_sid( user, owner ) && else if (token_sid_present( current->process->token, owner, FALSE ) &&
token_sid_present( current->process->token, sid, FALSE ))) token_sid_present( current->process->token, sid, FALSE ))
{ {
mode = (mode << 6) | (mode << 3); /* user + group */ mode = (mode << 6) | (mode << 3); /* user + group */
new_mode |= mode & bits_to_set; new_mode |= mode & bits_to_set;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment