Fix bug #9518 - conn->share_access appears not be be reset between users.
authorJeremy Allison <jra@samba.org>
Fri, 4 Jan 2013 23:15:59 +0000 (15:15 -0800)
committerKarolin Seeger <kseeger@samba.org>
Mon, 14 Jan 2013 18:03:29 +0000 (19:03 +0100)
Ensure make_connection_snum() uses the same logic as check_user_ok()
to decide if a user can access a share.

Signed-off-by: Jeremy Allison <jra@samba.org>
source3/smbd/service.c

index 10f4b537db24ff838a817f65ee85d2950cd7e858..d3cda73a8219a52f044f0ff229acdcb64ae61fd8 100644 (file)
@@ -651,30 +651,18 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
                TALLOC_FREE(s);
        }
 
-       /*
-        * New code to check if there's a share security descripter
-        * added from NT server manager. This is done after the
-        * smb.conf checks are done as we need a uid and token. JRA.
-        *
-        */
-
-       conn->share_access = create_share_access_mask(snum,
-                                       !CAN_WRITE(conn),
-                                       conn->session_info->security_token);
-
-       if ((conn->share_access & FILE_WRITE_DATA) == 0) {
-               if ((conn->share_access & FILE_READ_DATA) == 0) {
-                       /* No access, read or write. */
-                       DEBUG(0,("make_connection: connection to %s "
-                                "denied due to security "
-                                "descriptor.\n",
-                                lp_servicename(talloc_tos(), snum)));
-                       status = NT_STATUS_ACCESS_DENIED;
-                       goto err_root_exit;
-               } else {
-                       conn->read_only = True;
-               }
+        /*
+         * Set up the share security descripter
+         */
+
+       status = check_user_share_access(conn,
+                                       conn->session_info,
+                                       &conn->share_access,
+                                       &conn->read_only);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto err_root_exit;
        }
+
        /* Initialise VFS function pointers */
 
        if (!smbd_vfs_init(conn)) {