summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/service.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 4765844460..beb2d76b44 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -259,27 +259,30 @@ static NTSTATUS share_sanity_checks(int snum, char* service, char *dev)
****************************************************************************/
static void set_read_only(connection_struct *conn)
{
+ char **list;
char *service = lp_servicename(conn->service);
conn->read_only = lp_readonly(conn->service);
- {
- char **list;
+ if (!service) return;
- lp_list_copy(&list, lp_readlist(conn->service));
- if(list && lp_list_substitute(list, "%S", service)) {
- if (user_in_list(conn->user, list))
- conn->read_only = True;
+ lp_list_copy(&list, lp_readlist(conn->service));
+ if (list) {
+ if (!lp_list_substitute(list, "%S", service)) {
+ DEBUG(0, ("ERROR: read list substitution failed\n"));
}
- else DEBUG(0, ("ERROR: read list substitution failed\n"));
- if (list) lp_list_free(&list);
-
- lp_list_copy(&list, lp_writelist(conn->service));
- if(list && lp_list_substitute(list, "%S", service)) {
- if (user_in_list(conn->user, list))
- conn->read_only = False;
+ if (user_in_list(conn->user, list))
+ conn->read_only = True;
+ lp_list_free(&list);
+ }
+
+ lp_list_copy(&list, lp_writelist(conn->service));
+ if (list) {
+ if (!lp_list_substitute(list, "%S", service)) {
+ DEBUG(0, ("ERROR: write list substitution failed\n"));
}
- else DEBUG(0, ("ERROR: write list substitution failed\n"));
- if (list) lp_list_free(&list);
+ if (user_in_list(conn->user, list))
+ conn->read_only = False;
+ lp_list_free(&list);
}
}