Change API for create_share_access_mask() - remove conn struct.
authorJeremy Allison <jra@samba.org>
Fri, 4 Jan 2013 22:24:13 +0000 (14:24 -0800)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 9 Jan 2013 04:29:08 +0000 (15:29 +1100)
Eventually this will be indepentent of conn, just pass in the
readonly flag.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/proto.h
source3/smbd/service.c

index bfaaf6d..2198ccd 100644 (file)
@@ -979,8 +979,8 @@ void smbd_exit_server_cleanly(const char *const reason) _NORETURN_;
 
 bool set_conn_connectpath(connection_struct *conn, const char *connectpath);
 NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum);
-uint32_t create_share_access_mask(connection_struct *conn,
-                       int snum,
+uint32_t create_share_access_mask(int snum,
+                       bool readonly_share,
                        const struct security_token *token);
 bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir);
 void load_registry_shares(void);
index 3e1d87f..10f4b53 100644 (file)
@@ -515,8 +515,8 @@ NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum)
   Setup the share access mask for a connection.
 ****************************************************************************/
 
-uint32_t create_share_access_mask(connection_struct *conn,
-                               int snum,
+uint32_t create_share_access_mask(int snum,
+                               bool readonly_share,
                                const struct security_token *token)
 {
        uint32_t share_access = 0;
@@ -526,7 +526,7 @@ uint32_t create_share_access_mask(connection_struct *conn,
                        MAXIMUM_ALLOWED_ACCESS,
                        &share_access);
 
-       if (!CAN_WRITE(conn)) {
+       if (readonly_share) {
                share_access &=
                        ~(SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA |
                          SEC_FILE_WRITE_EA | SEC_FILE_WRITE_ATTRIBUTE |
@@ -658,8 +658,8 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
         *
         */
 
-       conn->share_access = create_share_access_mask(conn,
-                                       snum,
+       conn->share_access = create_share_access_mask(snum,
+                                       !CAN_WRITE(conn),
                                        conn->session_info->security_token);
 
        if ((conn->share_access & FILE_WRITE_DATA) == 0) {