s3:smbd/open: try the primary sid (user) as group_sid if the token has just one sid
authorStefan Metzmacher <metze@samba.org>
Fri, 30 Nov 2012 12:32:04 +0000 (13:32 +0100)
committerMichael Adam <obnox@samba.org>
Sun, 2 Dec 2012 17:32:04 +0000 (18:32 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/smbd/open.c

index 955660c14834cadf195df4984380067b974981d2..03e8feb30261a4040fd5243d5e207b92ffd07593 100644 (file)
@@ -3538,7 +3538,11 @@ static NTSTATUS inherit_new_acl(files_struct *fsp)
                owner_sid = &token->sids[PRIMARY_USER_SID_INDEX];
        }
        if (group_sid == NULL) {
-               group_sid = &token->sids[PRIMARY_GROUP_SID_INDEX];
+               if (token->num_sids == PRIMARY_GROUP_SID_INDEX) {
+                       group_sid = &token->sids[PRIMARY_USER_SID_INDEX];
+               } else {
+                       group_sid = &token->sids[PRIMARY_GROUP_SID_INDEX];
+               }
        }
 
        status = se_create_child_secdesc(frame,