From a21e1f781f0bbf783cda6237fa4103deb8a43474 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 29 Sep 2003 06:18:42 +0000 Subject: Merge from 3.0: >Ensure %S gets expanded in read/write lists. >Jeremy. (This used to be commit 424acd6ee92c46c565886c3305c3492737538d3d) --- source3/smbd/service.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'source3') diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 44d73b2ab2..e4c3890f86 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -259,23 +259,27 @@ static NTSTATUS share_sanity_checks(int snum, fstring dev) return NT_STATUS_OK; } - /**************************************************************************** readonly share? ****************************************************************************/ + static void set_read_only(connection_struct *conn, gid_t *groups, size_t n_groups) { char **list; - char *service = lp_servicename(conn->service); + const char *service = lp_servicename(conn->service); conn->read_only = lp_readonly(conn->service); - if (!service) return; + if (!service) + return; str_list_copy(&list, lp_readlist(conn->service)); if (list) { - if ( !str_list_sub_basic(list, current_user_info.smb_name) ) { + if (!str_list_sub_basic(list, current_user_info.smb_name) ) { DEBUG(0, ("ERROR: read list substitution failed\n")); } + if (!str_list_substitute(list, "%S", service)) { + DEBUG(0, ("ERROR: read list service substitution failed\n")); + } if (user_in_list(conn->user, (const char **)list, groups, n_groups)) conn->read_only = True; str_list_free(&list); @@ -283,19 +287,22 @@ static void set_read_only(connection_struct *conn, gid_t *groups, size_t n_group str_list_copy(&list, lp_writelist(conn->service)); if (list) { - if ( !str_list_sub_basic(list, current_user_info.smb_name) ) { + if (!str_list_sub_basic(list, current_user_info.smb_name) ) { DEBUG(0, ("ERROR: write list substitution failed\n")); } + if (!str_list_substitute(list, "%S", service)) { + DEBUG(0, ("ERROR: write list service substitution failed\n")); + } if (user_in_list(conn->user, (const char **)list, groups, n_groups)) conn->read_only = False; str_list_free(&list); } } - /**************************************************************************** admin user check ****************************************************************************/ + static void set_admin_user(connection_struct *conn, gid_t *groups, size_t n_groups) { /* admin user check */ -- cgit