From 5e9eebf5dec60177a680010e011b88ae0ecf26d2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jan 2013 14:24:13 -0800 Subject: Change API for create_share_access_mask() - remove conn struct. Eventually this will be indepentent of conn, just pass in the readonly flag. Signed-off-by: Jeremy Allison Reviewed-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- source3/smbd/proto.h | 4 ++-- source3/smbd/service.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index bfaaf6d639..2198ccd3f7 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 3e1d87f1f0..10f4b537db 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -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) { -- cgit