s3: Fix bug 8102
authorVolker Lendecke <vl@samba.org>
Tue, 5 Jul 2011 09:13:07 +0000 (11:13 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 5 Jul 2011 14:21:53 +0000 (16:21 +0200)
We can't allow open with access that has been denied via the share
security descriptor

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Jul  5 16:21:54 CEST 2011 on sn-devel-104

source3/smbd/open.c

index 86a5924f16e0d28ddbd3e6b6a96200f01a01d5ff..bbab9f14efee316ab23ec5910fbd93e40ab1523b 100644 (file)
@@ -76,6 +76,14 @@ NTSTATUS smbd_check_open_rights(struct connection_struct *conn,
        /* Check if we have rights to open. */
        NTSTATUS status;
        struct security_descriptor *sd = NULL;
+       uint32_t rejected_share_access;
+
+       rejected_share_access = access_mask & ~(conn->share_access);
+
+       if (rejected_share_access) {
+               *access_granted = rejected_share_access;
+               return NT_STATUS_ACCESS_DENIED;
+       }
 
        if ((access_mask & DELETE_ACCESS) && !lp_acl_check_permissions(SNUM(conn))) {
                *access_granted = access_mask;