From 9c66f601f1520a99b9236c32bc9f03a33bd4b2aa Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 23 Jul 2006 18:43:07 +0000 Subject: r17206: Add a modular API for share configuration. Commit the classic backwards compatible module which is the default one (This used to be commit a89cc346b9296cb49929898d257a064a6c2bae86) --- source4/param/share_classic.c | 328 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 328 insertions(+) create mode 100644 source4/param/share_classic.c (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c new file mode 100644 index 0000000000..9d959da787 --- /dev/null +++ b/source4/param/share_classic.c @@ -0,0 +1,328 @@ +/* + Unix SMB/CIFS implementation. + + Classic file based services configuration + + Copyright (C) Simo Sorce 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "param/share.h" + +struct sclassic_snum { + int snum; +}; + +static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct share_context **ctx) +{ + *ctx = talloc(mem_ctx, struct share_context); + if (!*ctx) { + DEBUG(0, ("ERROR: Out of memory!\n")); + return NT_STATUS_NO_MEMORY; + } + + (*ctx)->ops = ops; + (*ctx)->priv_data = NULL; + + return NT_STATUS_OK; +} + +static const char *sclassic_string_option(struct share_config *scfg, const char *opt_name, const char *defval) +{ + struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + char *parm, *val; + const char *ret; + + if (strchr(opt_name, ':')) { + parm = talloc_strdup(scfg, opt_name); + if (!parm) { + return NULL; + } + val = strchr(parm, ':'); + *val = '\0'; + val++; + + ret = lp_parm_string(s->snum, parm, val); + if (!ret) { + ret = defval; + } + talloc_free(parm); + return ret; + } + + if (strcmp(opt_name, SHARE_NAME) == 0) { + return scfg->name; + } + + if (strcmp(opt_name, SHARE_PATH) == 0) { + return lp_pathname(s->snum); + } + + if (strcmp(opt_name, SHARE_COMMENT) == 0) { + return lp_comment(s->snum); + } + + if (strcmp(opt_name, SHARE_VOLUME) == 0) { + return volume_label(s->snum); + } + + if (strcmp(opt_name, SHARE_TYPE) == 0) { + if (lp_print_ok(s->snum)) { + return "PRINTER"; + } + return lp_fstype(s->snum); + } + + return defval; +} + +int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval) +{ + struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + char *parm, *val; + int ret; + + if (strchr(opt_name, ':')) { + parm = talloc_strdup(scfg, opt_name); + if (!parm) { + return -1; + } + val = strchr(parm, ':'); + *val = '\0'; + val++; + + ret = lp_parm_int(s->snum, parm, val, defval); + if (!ret) { + ret = defval; + } + talloc_free(parm); + return ret; + } + + if (strcmp(opt_name, SHARE_CSC_POLICY) == 0) { + ret = lp_csc_policy(s->snum); + if (ret == -1) { + return defval; + } + } + + if (strcmp(opt_name, SHARE_MAX_CONNECTIONS) == 0) { + ret = lp_max_connections(s->snum); + if (ret == -1) { + return defval; + } + } + + return defval; +} + +BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL defval) +{ + struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + char *parm, *val; + BOOL ret; + + if (strchr(opt_name, ':')) { + parm = talloc_strdup(scfg, opt_name); + if(!parm) { + return NULL; + } + val = strchr(parm, ':'); + *val = '\0'; + val++; + + ret = lp_parm_bool(s->snum, parm, val, defval); + talloc_free(parm); + return ret; + } + + if (strcmp(opt_name, SHARE_AVAILABLE) == 0) { + return lp_snum_ok(s->snum); + } + + if (strcmp(opt_name, SHARE_BROWSEABLE) == 0) { + return lp_browseable(s->snum); + } + + if (strcmp(opt_name, SHARE_READONLY) == 0) { + return lp_readonly(s->snum); + } + + if (strcmp(opt_name, SHARE_MAP_SYSTEM) == 0) { + return lp_map_system(s->snum); + } + + if (strcmp(opt_name, SHARE_MAP_HIDDEN) == 0) { + return lp_map_hidden(s->snum); + } + + if (strcmp(opt_name, SHARE_MAP_ARCHIVE) == 0) { + return lp_map_archive(s->snum); + } + + if (strcmp(opt_name, SHARE_STRICT_LOCKING) == 0) { + return lp_strict_locking(s->snum); + } + + if (strcmp(opt_name, SHARE_STRICT_SYNC) == 0) { + return lp_strict_sync(s->snum); + } + + if (strcmp(opt_name, SHARE_MSDFS_ROOT) == 0) { + return lp_msdfs_root(s->snum); + } + + if (strcmp(opt_name, SHARE_CI_FILESYSTEM) == 0) { + return lp_ci_filesystem(s->snum); + } + + return defval; +} + +const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name) +{ + struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + char *parm, *val; + const char **ret; + + if (strchr(opt_name, ':')) { + parm = talloc_strdup(scfg, opt_name); + if (!parm) { + return NULL; + } + val = strchr(parm, ':'); + *val = '\0'; + val++; + + ret = lp_parm_string_list(s->snum, parm, val, ",;"); + talloc_free(parm); + return ret; + } + + if (strcmp(opt_name, SHARE_HOSTS_ALLOW) == 0) { + return lp_hostsallow(s->snum); + } + + if (strcmp(opt_name, SHARE_HOSTS_DENY) == 0) { + return lp_hostsdeny(s->snum); + } + + if (strcmp(opt_name, SHARE_NTVFS_HANDLER) == 0) { + return lp_ntvfs_handler(s->snum); + } + + return NULL; +} + +NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, + struct share_context *ctx, + int *count, + const char ***names) +{ + int i; + int num_services; + const char **n; + + num_services = lp_numservices(); + + n = talloc_array(mem_ctx, const char *, num_services); + if (!n) { + DEBUG(0,("ERROR: Out of memory!\n")); + return NT_STATUS_NO_MEMORY; + } + + for (i = 0; i < num_services; i++) { + n[i] = talloc_strdup(n, lp_servicename(i)); + if (!n[i]) { + DEBUG(0,("ERROR: Out of memory!\n")); + talloc_free(n); + return NT_STATUS_NO_MEMORY; + } + } + + *names = n; + *count = num_services; + + return NT_STATUS_OK; +} + +NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, + struct share_context *ctx, + const char *name, + struct share_config **scfg) +{ + int i, snum; + struct share_config *s; + struct sclassic_snum *scnum; + + snum = -1; + for (i = 0; i < lp_numservices(); i++) { + if (strcasecmp_m(name, lp_servicename(i)) == 0) { + snum = i; + break; + } + } + + if (snum < 0) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + + s = talloc(mem_ctx, struct share_config); + if (!s) { + DEBUG(0,("ERROR: Out of memory!\n")); + return NT_STATUS_NO_MEMORY; + } + + s->name = talloc_strdup(s, lp_servicename(snum)); + if (!s->name) { + DEBUG(0,("ERROR: Out of memory!\n")); + talloc_free(s); + return NT_STATUS_NO_MEMORY; + } + + scnum = talloc(s, struct sclassic_snum); + if (!scnum) { + DEBUG(0,("ERROR: Out of memory!\n")); + talloc_free(s); + return NT_STATUS_NO_MEMORY; + } + scnum->snum = snum; + + s->opaque = (void *)scnum; + s->ctx = ctx; + + *scfg = s; + + return NT_STATUS_OK; +} + +NTSTATUS share_classic_init(void) +{ + struct share_ops ops; + + ops.name = "classic"; + ops.init = sclassic_init; + ops.string_option = sclassic_string_option; + ops.int_option = sclassic_int_option; + ops.bool_option = sclassic_bool_option; + ops.string_list_option = sclassic_string_list_option; + ops.list_all = sclassic_list_all; + ops.get_config = sclassic_get_config; + + return share_register(&ops); +} + -- cgit From 830b03d7e88f83e0a395d5944f0b0001480ea4fa Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 23 Jul 2006 20:04:42 +0000 Subject: r17210: I wonder how I missed this, build farm caught it. (This used to be commit e0af5cf51dbedccfe47cfd6ec5232847f586ece8) --- source4/param/share_classic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 9d959da787..59c58e4d54 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -139,7 +139,7 @@ BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL if (strchr(opt_name, ':')) { parm = talloc_strdup(scfg, opt_name); if(!parm) { - return NULL; + return False; } val = strchr(parm, ':'); *val = '\0'; -- cgit From b0fb34fd24f5d73cfc2d3aca09379d85b9fb57dd Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 15 Sep 2006 05:18:53 +0000 Subject: r18542: Some late nite work. Now we can add and remove a share from the "Computer Management" console (not yet modify!) usinf share backend = ldb (This used to be commit ae2f6d4a5a372a37b9783a02bb8e7f16588b21f0) --- source4/param/share_classic.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 59c58e4d54..75f66b1fd4 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -312,16 +312,16 @@ NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, NTSTATUS share_classic_init(void) { - struct share_ops ops; - - ops.name = "classic"; - ops.init = sclassic_init; - ops.string_option = sclassic_string_option; - ops.int_option = sclassic_int_option; - ops.bool_option = sclassic_bool_option; - ops.string_list_option = sclassic_string_list_option; - ops.list_all = sclassic_list_all; - ops.get_config = sclassic_get_config; + static struct share_ops ops = { + .name = "classic", + .init = sclassic_init, + .string_option = sclassic_string_option, + .int_option = sclassic_int_option, + .bool_option = sclassic_bool_option, + .string_list_option = sclassic_string_list_option, + .list_all = sclassic_list_all, + .get_config = sclassic_get_config + }; return share_register(&ops); } -- cgit From fa257e78b5e1de1ba12e12968b1b2a6edbead7c6 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 15 Sep 2006 16:27:55 +0000 Subject: r18558: Fix ShareCheck which was assuming all paths are "C:\" Also cope with the fact that we define the FSTYPE as NTFS by default. We never use this anywhere else, so we may just change it, but just detect the fact and return DISK in share_classic for now. (This used to be commit 4daf5f7764ce69c14066f7320961c90141f0863a) --- source4/param/share_classic.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 75f66b1fd4..794a21c5bf 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -84,6 +84,9 @@ static const char *sclassic_string_option(struct share_config *scfg, const char if (lp_print_ok(s->snum)) { return "PRINTER"; } + if (strcmp("NTFS", lp_fstype(s->snum)) == 0) { + return "DISK"; + } return lp_fstype(s->snum); } -- cgit From b540bc85ff8140424e9e925aa73f1f1cacfbd64a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2007 04:15:07 +0000 Subject: r23696: added the create mask and related share permissions options to Samba4, using the new share_int_option() code from Simo speaking of which, this is the first time I've looked closely at the share_classic.c code. It is absolutely and completely braindead and broken. Whatever drugs Simo was on at the time, he better not try to cross a border with them on him! Problems with it: - if you actually set a value, it gets ignored, and the defvalue gets used instead ('ret' is never returned). If you don't set a value, then defvalue gets returned too. Sound useful? - it means we now have to list parameters in source/param/ in lots and lots of places, all of which have to match exactly. code like this is supposed to reduce the likelyhood of errors, not increase it! - code which has a long line of if() statements with strcmp() should cause your fingers to burn on the keyboard when you type it in. That's what structure lists are for. Strangely enough, we have all the info in loadparm.c in a structure list, but instead it gets replicated in share_classic.c in this strange if() strcmp() form expect some changes to this code shortly. I'll need a calming cup of tea first though :-) (This used to be commit 19a9fc2f444efc0894b06a249daf73ed555b61e2) --- source4/param/share_classic.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 794a21c5bf..0a6e23287c 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -90,6 +90,9 @@ static const char *sclassic_string_option(struct share_config *scfg, const char return lp_fstype(s->snum); } + DEBUG(0,("request for unknown share string option '%s'\n", + opt_name)); + return defval; } @@ -117,19 +120,33 @@ int sclassic_int_option(struct share_config *scfg, const char *opt_name, int def } if (strcmp(opt_name, SHARE_CSC_POLICY) == 0) { - ret = lp_csc_policy(s->snum); - if (ret == -1) { - return defval; - } + return lp_csc_policy(s->snum); } if (strcmp(opt_name, SHARE_MAX_CONNECTIONS) == 0) { - ret = lp_max_connections(s->snum); - if (ret == -1) { - return defval; - } + return lp_max_connections(s->snum); + } + + if (strcmp(opt_name, SHARE_CREATE_MASK) == 0) { + return lp_create_mask(s->snum); + } + + if (strcmp(opt_name, SHARE_DIR_MASK) == 0) { + return lp_dir_mask(s->snum); } + if (strcmp(opt_name, SHARE_FORCE_DIR_MODE) == 0) { + return lp_force_dir_mode(s->snum); + } + + if (strcmp(opt_name, SHARE_FORCE_CREATE_MODE) == 0) { + return lp_force_create_mode(s->snum); + } + + + DEBUG(0,("request for unknown share int option '%s'\n", + opt_name)); + return defval; } @@ -193,6 +210,9 @@ BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL return lp_ci_filesystem(s->snum); } + DEBUG(0,("request for unknown share bool option '%s'\n", + opt_name)); + return defval; } @@ -228,6 +248,9 @@ const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_confi return lp_ntvfs_handler(s->snum); } + DEBUG(0,("request for unknown share list option '%s'\n", + opt_name)); + return NULL; } -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/param/share_classic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 0a6e23287c..234a632144 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From b93a941214b82448a15c3d936bb21dcda2a5287e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 3 Sep 2007 04:05:50 +0000 Subject: r24915: Try to quiet down this warning - the 'classic' share code doesn't support passwords for share-mode security (we don't even support share mode security, and are unlikely ever to). Andrew Bartlett (This used to be commit 0d56ab59c571fd38c3071660ed7db6264300df50) --- source4/param/share_classic.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 234a632144..c38e5d78df 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -89,6 +89,10 @@ static const char *sclassic_string_option(struct share_config *scfg, const char return lp_fstype(s->snum); } + if (strcmp(opt_name, SHARE_PASSWORD) == 0) { + return defval; + } + DEBUG(0,("request for unknown share string option '%s'\n", opt_name)); -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/param/share_classic.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index c38e5d78df..15f52eb9f1 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -21,6 +21,7 @@ #include "includes.h" #include "param/share.h" +#include "param/param.h" struct sclassic_snum { int snum; -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/param/share_classic.c | 120 +++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 67 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 15f52eb9f1..0c39322345 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -23,8 +23,8 @@ #include "param/share.h" #include "param/param.h" -struct sclassic_snum { - int snum; +struct service { + struct service *service; }; static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct share_context **ctx) @@ -43,7 +43,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, static const char *sclassic_string_option(struct share_config *scfg, const char *opt_name, const char *defval) { - struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + struct service *s = talloc_get_type(scfg->opaque, struct service); char *parm, *val; const char *ret; @@ -56,7 +56,7 @@ static const char *sclassic_string_option(struct share_config *scfg, const char *val = '\0'; val++; - ret = lp_parm_string(s->snum, parm, val); + ret = lp_parm_string(s, parm, val); if (!ret) { ret = defval; } @@ -69,25 +69,25 @@ static const char *sclassic_string_option(struct share_config *scfg, const char } if (strcmp(opt_name, SHARE_PATH) == 0) { - return lp_pathname(s->snum); + return lp_pathname(s); } if (strcmp(opt_name, SHARE_COMMENT) == 0) { - return lp_comment(s->snum); + return lp_comment(s); } if (strcmp(opt_name, SHARE_VOLUME) == 0) { - return volume_label(s->snum); + return volume_label(s); } if (strcmp(opt_name, SHARE_TYPE) == 0) { - if (lp_print_ok(s->snum)) { + if (lp_print_ok(s)) { return "PRINTER"; } - if (strcmp("NTFS", lp_fstype(s->snum)) == 0) { + if (strcmp("NTFS", lp_fstype(s)) == 0) { return "DISK"; } - return lp_fstype(s->snum); + return lp_fstype(s); } if (strcmp(opt_name, SHARE_PASSWORD) == 0) { @@ -100,9 +100,9 @@ static const char *sclassic_string_option(struct share_config *scfg, const char return defval; } -int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval) +static int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval) { - struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + struct service *s = talloc_get_type(scfg->opaque, struct service); char *parm, *val; int ret; @@ -115,7 +115,7 @@ int sclassic_int_option(struct share_config *scfg, const char *opt_name, int def *val = '\0'; val++; - ret = lp_parm_int(s->snum, parm, val, defval); + ret = lp_parm_int(s, parm, val, defval); if (!ret) { ret = defval; } @@ -124,27 +124,27 @@ int sclassic_int_option(struct share_config *scfg, const char *opt_name, int def } if (strcmp(opt_name, SHARE_CSC_POLICY) == 0) { - return lp_csc_policy(s->snum); + return lp_csc_policy(s); } if (strcmp(opt_name, SHARE_MAX_CONNECTIONS) == 0) { - return lp_max_connections(s->snum); + return lp_max_connections(s); } if (strcmp(opt_name, SHARE_CREATE_MASK) == 0) { - return lp_create_mask(s->snum); + return lp_create_mask(s); } if (strcmp(opt_name, SHARE_DIR_MASK) == 0) { - return lp_dir_mask(s->snum); + return lp_dir_mask(s); } if (strcmp(opt_name, SHARE_FORCE_DIR_MODE) == 0) { - return lp_force_dir_mode(s->snum); + return lp_force_dir_mode(s); } if (strcmp(opt_name, SHARE_FORCE_CREATE_MODE) == 0) { - return lp_force_create_mode(s->snum); + return lp_force_create_mode(s); } @@ -154,9 +154,10 @@ int sclassic_int_option(struct share_config *scfg, const char *opt_name, int def return defval; } -BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL defval) +static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name, + bool defval) { - struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + struct service *s = talloc_get_type(scfg->opaque, struct service); char *parm, *val; BOOL ret; @@ -169,49 +170,49 @@ BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL *val = '\0'; val++; - ret = lp_parm_bool(s->snum, parm, val, defval); + ret = lp_parm_bool(s, parm, val, defval); talloc_free(parm); return ret; } if (strcmp(opt_name, SHARE_AVAILABLE) == 0) { - return lp_snum_ok(s->snum); + return s != NULL; } if (strcmp(opt_name, SHARE_BROWSEABLE) == 0) { - return lp_browseable(s->snum); + return lp_browseable(s); } if (strcmp(opt_name, SHARE_READONLY) == 0) { - return lp_readonly(s->snum); + return lp_readonly(s); } if (strcmp(opt_name, SHARE_MAP_SYSTEM) == 0) { - return lp_map_system(s->snum); + return lp_map_system(s); } if (strcmp(opt_name, SHARE_MAP_HIDDEN) == 0) { - return lp_map_hidden(s->snum); + return lp_map_hidden(s); } if (strcmp(opt_name, SHARE_MAP_ARCHIVE) == 0) { - return lp_map_archive(s->snum); + return lp_map_archive(s); } if (strcmp(opt_name, SHARE_STRICT_LOCKING) == 0) { - return lp_strict_locking(s->snum); + return lp_strict_locking(s); } if (strcmp(opt_name, SHARE_STRICT_SYNC) == 0) { - return lp_strict_sync(s->snum); + return lp_strict_sync(s); } if (strcmp(opt_name, SHARE_MSDFS_ROOT) == 0) { - return lp_msdfs_root(s->snum); + return lp_msdfs_root(s); } if (strcmp(opt_name, SHARE_CI_FILESYSTEM) == 0) { - return lp_ci_filesystem(s->snum); + return lp_ci_filesystem(s); } DEBUG(0,("request for unknown share bool option '%s'\n", @@ -220,9 +221,9 @@ BOOL sclassic_bool_option(struct share_config *scfg, const char *opt_name, BOOL return defval; } -const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name) +static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name) { - struct sclassic_snum *s = talloc_get_type(scfg->opaque, struct sclassic_snum); + struct service *s = talloc_get_type(scfg->opaque, struct service); char *parm, *val; const char **ret; @@ -235,21 +236,21 @@ const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_confi *val = '\0'; val++; - ret = lp_parm_string_list(s->snum, parm, val, ",;"); + ret = lp_parm_string_list(s, parm, val, ",;"); talloc_free(parm); return ret; } if (strcmp(opt_name, SHARE_HOSTS_ALLOW) == 0) { - return lp_hostsallow(s->snum); + return lp_hostsallow(s); } if (strcmp(opt_name, SHARE_HOSTS_DENY) == 0) { - return lp_hostsdeny(s->snum); + return lp_hostsdeny(s); } if (strcmp(opt_name, SHARE_NTVFS_HANDLER) == 0) { - return lp_ntvfs_handler(s->snum); + return lp_ntvfs_handler(s); } DEBUG(0,("request for unknown share list option '%s'\n", @@ -258,10 +259,10 @@ const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_confi return NULL; } -NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, - struct share_context *ctx, - int *count, - const char ***names) +static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, + struct share_context *ctx, + int *count, + const char ***names) { int i; int num_services; @@ -276,7 +277,7 @@ NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, } for (i = 0; i < num_services; i++) { - n[i] = talloc_strdup(n, lp_servicename(i)); + n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum(i))); if (!n[i]) { DEBUG(0,("ERROR: Out of memory!\n")); talloc_free(n); @@ -290,24 +291,17 @@ NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } -NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, - struct share_context *ctx, - const char *name, - struct share_config **scfg) +static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, + struct share_context *ctx, + const char *name, + struct share_config **scfg) { - int i, snum; struct share_config *s; - struct sclassic_snum *scnum; + struct service *service; - snum = -1; - for (i = 0; i < lp_numservices(); i++) { - if (strcasecmp_m(name, lp_servicename(i)) == 0) { - snum = i; - break; - } - } + service = lp_service(name); - if (snum < 0) { + if (service == NULL) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; } @@ -317,22 +311,14 @@ NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - s->name = talloc_strdup(s, lp_servicename(snum)); + s->name = talloc_strdup(s, lp_servicename(service)); if (!s->name) { DEBUG(0,("ERROR: Out of memory!\n")); talloc_free(s); return NT_STATUS_NO_MEMORY; } - scnum = talloc(s, struct sclassic_snum); - if (!scnum) { - DEBUG(0,("ERROR: Out of memory!\n")); - talloc_free(s); - return NT_STATUS_NO_MEMORY; - } - scnum->snum = snum; - - s->opaque = (void *)scnum; + s->opaque = (void *)service; s->ctx = ctx; *scfg = s; -- cgit From 9fd1b1c130ad6886111df9bf3e3de86a64dea7f7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 20:03:19 +0000 Subject: r25039: Rename service -> loadparm_service, use context more. (This used to be commit ab417cb32bd348c05b20707e73297df05c920079) --- source4/param/share_classic.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 0c39322345..46a853b41a 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -23,10 +23,6 @@ #include "param/share.h" #include "param/param.h" -struct service { - struct service *service; -}; - static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct share_context **ctx) { *ctx = talloc(mem_ctx, struct share_context); @@ -43,7 +39,8 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, static const char *sclassic_string_option(struct share_config *scfg, const char *opt_name, const char *defval) { - struct service *s = talloc_get_type(scfg->opaque, struct service); + struct loadparm_service *s = talloc_get_type(scfg->opaque, + struct loadparm_service); char *parm, *val; const char *ret; @@ -102,7 +99,8 @@ static const char *sclassic_string_option(struct share_config *scfg, const char static int sclassic_int_option(struct share_config *scfg, const char *opt_name, int defval) { - struct service *s = talloc_get_type(scfg->opaque, struct service); + struct loadparm_service *s = talloc_get_type(scfg->opaque, + struct loadparm_service); char *parm, *val; int ret; @@ -157,7 +155,8 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name, bool defval) { - struct service *s = talloc_get_type(scfg->opaque, struct service); + struct loadparm_service *s = talloc_get_type(scfg->opaque, + struct loadparm_service); char *parm, *val; BOOL ret; @@ -223,7 +222,8 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct share_config *scfg, const char *opt_name) { - struct service *s = talloc_get_type(scfg->opaque, struct service); + struct loadparm_service *s = talloc_get_type(scfg->opaque, + struct loadparm_service); char *parm, *val; const char **ret; @@ -297,7 +297,7 @@ static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, struct share_config **scfg) { struct share_config *s; - struct service *service; + struct loadparm_service *service; service = lp_service(name); -- cgit From 46d16c0131f69f320f58a2e074d7623f23311e1e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 20:49:43 +0000 Subject: r25041: Use context in more places, fix warnings. (This used to be commit 9bb8738945b80d308e592bbecd44fe4e4f048ad8) --- source4/param/share_classic.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 46a853b41a..df86e2be4f 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -326,19 +326,19 @@ static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } +static const struct share_ops ops = { + .name = "classic", + .init = sclassic_init, + .string_option = sclassic_string_option, + .int_option = sclassic_int_option, + .bool_option = sclassic_bool_option, + .string_list_option = sclassic_string_list_option, + .list_all = sclassic_list_all, + .get_config = sclassic_get_config +}; + NTSTATUS share_classic_init(void) { - static struct share_ops ops = { - .name = "classic", - .init = sclassic_init, - .string_option = sclassic_string_option, - .int_option = sclassic_int_option, - .bool_option = sclassic_bool_option, - .string_list_option = sclassic_string_list_option, - .list_all = sclassic_list_all, - .get_config = sclassic_get_config - }; - return share_register(&ops); } -- cgit From 5e2f9cd8e223368d38d49cf60f199bbd818b8732 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 27 Sep 2007 19:49:53 +0000 Subject: r25379: Use loadparm context parameter in a lot more places. (This used to be commit 091961b13be665061c7e88ab4e2808c015bc403e) --- source4/param/share_classic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index df86e2be4f..c9786d06bd 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -268,7 +268,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, int num_services; const char **n; - num_services = lp_numservices(); + num_services = lp_numservices(global_loadparm); n = talloc_array(mem_ctx, const char *, num_services); if (!n) { @@ -277,7 +277,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, } for (i = 0; i < num_services; i++) { - n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum(i))); + n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum(global_loadparm, i))); if (!n[i]) { DEBUG(0,("ERROR: Out of memory!\n")); talloc_free(n); @@ -299,7 +299,7 @@ static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, struct share_config *s; struct loadparm_service *service; - service = lp_service(name); + service = lp_service(global_loadparm, name); if (service == NULL) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/param/share_classic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index c9786d06bd..08d01af6e2 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -53,7 +53,7 @@ static const char *sclassic_string_option(struct share_config *scfg, const char *val = '\0'; val++; - ret = lp_parm_string(s, parm, val); + ret = lp_parm_string(global_loadparm, s, parm, val); if (!ret) { ret = defval; } @@ -113,7 +113,7 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, *val = '\0'; val++; - ret = lp_parm_int(s, parm, val, defval); + ret = lp_parm_int(global_loadparm, s, parm, val, defval); if (!ret) { ret = defval; } @@ -169,7 +169,7 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name *val = '\0'; val++; - ret = lp_parm_bool(s, parm, val, defval); + ret = lp_parm_bool(global_loadparm, s, parm, val, defval); talloc_free(parm); return ret; } @@ -236,7 +236,7 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar *val = '\0'; val++; - ret = lp_parm_string_list(s, parm, val, ",;"); + ret = lp_parm_string_list(global_loadparm, s, parm, val, ",;"); talloc_free(parm); return ret; } -- cgit From d5a93dfcb950ecd52d8dea7a2a5d667feb6259ca Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 21:39:52 +0000 Subject: r25547: Convert to standard bool type. (This used to be commit 97a241692c4b8dc45e086aa9b959f2cd30b8d6c9) --- source4/param/share_classic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 08d01af6e2..cf140f0d32 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -158,12 +158,12 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); char *parm, *val; - BOOL ret; + bool ret; if (strchr(opt_name, ':')) { parm = talloc_strdup(scfg, opt_name); if(!parm) { - return False; + return false; } val = strchr(parm, ':'); *val = '\0'; -- cgit From ab69eb8d8901d23794c6a298718e67656ef4820e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 15:53:17 +0100 Subject: r26250: Avoid global_loadparm in a couple more places. (This used to be commit 2c6b755309fdf685cd0b0564272bf83038574a43) --- source4/param/share_classic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index cf140f0d32..2dc40e3e25 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -32,7 +32,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, } (*ctx)->ops = ops; - (*ctx)->priv_data = NULL; + (*ctx)->priv_data = global_loadparm; return NT_STATUS_OK; } @@ -268,7 +268,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, int num_services; const char **n; - num_services = lp_numservices(global_loadparm); + num_services = lp_numservices((struct loadparm_context *)ctx->priv_data); n = talloc_array(mem_ctx, const char *, num_services); if (!n) { @@ -277,7 +277,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, } for (i = 0; i < num_services; i++) { - n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum(global_loadparm, i))); + n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum((struct loadparm_context *)ctx->priv_data, i))); if (!n[i]) { DEBUG(0,("ERROR: Out of memory!\n")); talloc_free(n); @@ -299,7 +299,7 @@ static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, struct share_config *s; struct loadparm_service *service; - service = lp_service(global_loadparm, name); + service = lp_service((struct loadparm_context *)ctx->priv_data, name); if (service == NULL) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; -- cgit From 509e82e402d64c79f27c9a10d75b100a1ac5fefa Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 23:33:22 +0100 Subject: r26272: Remove global_loadparm in some more places. (This used to be commit 1ab76ecc5311fa863e5d04899b6f110899818f55) --- source4/param/share_classic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 2dc40e3e25..7a0c2873f4 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -23,7 +23,9 @@ #include "param/share.h" #include "param/param.h" -static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct share_context **ctx) +static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, + const struct share_ops *ops, + struct share_context **ctx) { *ctx = talloc(mem_ctx, struct share_context); if (!*ctx) { @@ -37,7 +39,9 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, return NT_STATUS_OK; } -static const char *sclassic_string_option(struct share_config *scfg, const char *opt_name, const char *defval) +static const char *sclassic_string_option(struct share_config *scfg, + const char *opt_name, + const char *defval) { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); -- cgit From fd88c3ca2480fabb90c0d8fc701394bb59f99481 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Dec 2007 23:32:18 +0100 Subject: r26348: Avoid use of autofree context. (This used to be commit eebcf7e1b06ca48cc53bdd12efa01fcf0cff8aa3) --- source4/param/share_classic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 7a0c2873f4..ab1b4bf904 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -240,7 +240,7 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar *val = '\0'; val++; - ret = lp_parm_string_list(global_loadparm, s, parm, val, ",;"); + ret = lp_parm_string_list(mem_ctx, global_loadparm, s, parm, val, ",;"); talloc_free(parm); return ret; } -- cgit From b65dba2245bf382c47d65c95ac9b1efa43918fc0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 10 Dec 2007 04:33:16 +0100 Subject: r26355: Eliminate global_loadparm in more places. (This used to be commit 5d589a0d94bd76a9b4c9fc748854e8098ea43c4d) --- source4/param/share_classic.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index ab1b4bf904..4a7fbcb263 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -45,6 +45,8 @@ static const char *sclassic_string_option(struct share_config *scfg, { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context); char *parm, *val; const char *ret; @@ -57,7 +59,7 @@ static const char *sclassic_string_option(struct share_config *scfg, *val = '\0'; val++; - ret = lp_parm_string(global_loadparm, s, parm, val); + ret = lp_parm_string(lp_ctx, s, parm, val); if (!ret) { ret = defval; } @@ -105,6 +107,8 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context); char *parm, *val; int ret; @@ -117,7 +121,7 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, *val = '\0'; val++; - ret = lp_parm_int(global_loadparm, s, parm, val, defval); + ret = lp_parm_int(lp_ctx, s, parm, val, defval); if (!ret) { ret = defval; } @@ -161,6 +165,8 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context); char *parm, *val; bool ret; @@ -173,7 +179,7 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name *val = '\0'; val++; - ret = lp_parm_bool(global_loadparm, s, parm, val, defval); + ret = lp_parm_bool(lp_ctx, s, parm, val, defval); talloc_free(parm); return ret; } @@ -228,6 +234,8 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context); char *parm, *val; const char **ret; @@ -240,7 +248,7 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar *val = '\0'; val++; - ret = lp_parm_string_list(mem_ctx, global_loadparm, s, parm, val, ",;"); + ret = lp_parm_string_list(mem_ctx, lp_ctx, s, parm, val, ",;"); talloc_free(parm); return ret; } -- cgit From e31abef15f7696cf39e9e81307f153da93568e02 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:55 +0100 Subject: r26440: Remove more uses of global_loadparm. (This used to be commit 8858cf39722f192865e531164c72039fd18d7a8d) --- source4/param/share_classic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index 4a7fbcb263..b517c9c4c2 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -25,6 +25,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, + struct loadparm_context *lp_ctx, struct share_context **ctx) { *ctx = talloc(mem_ctx, struct share_context); @@ -34,7 +35,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, } (*ctx)->ops = ops; - (*ctx)->priv_data = global_loadparm; + (*ctx)->priv_data = lp_ctx; return NT_STATUS_OK; } -- cgit From 80d1d2a4db91eba72a4a8da0ed89691f8c25d97f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 16:18:01 +0100 Subject: Clarify comments. (This used to be commit 5193b383761129e59241cd2cc6000f0b038b49d4) --- source4/param/share_classic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index b517c9c4c2..eb5e486c44 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. - Classic file based services configuration + Classic file based shares configuration Copyright (C) Simo Sorce 2006 -- cgit From 2ba62662f8e2578153be3125eb557b9349ccfd3b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 28 Feb 2008 20:04:58 +0100 Subject: Remove sDefault as static variable. (This used to be commit 16f36ce499e93860dd535034a584ec2b93e7a172) --- source4/param/share_classic.c | 48 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index eb5e486c44..f5a6fa67a4 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -73,25 +73,25 @@ static const char *sclassic_string_option(struct share_config *scfg, } if (strcmp(opt_name, SHARE_PATH) == 0) { - return lp_pathname(s); + return lp_pathname(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_COMMENT) == 0) { - return lp_comment(s); + return lp_comment(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_VOLUME) == 0) { - return volume_label(s); + return volume_label(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_TYPE) == 0) { - if (lp_print_ok(s)) { + if (lp_print_ok(s, lp_default_service(lp_ctx))) { return "PRINTER"; } - if (strcmp("NTFS", lp_fstype(s)) == 0) { + if (strcmp("NTFS", lp_fstype(s, lp_default_service(lp_ctx))) == 0) { return "DISK"; } - return lp_fstype(s); + return lp_fstype(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_PASSWORD) == 0) { @@ -131,27 +131,27 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, } if (strcmp(opt_name, SHARE_CSC_POLICY) == 0) { - return lp_csc_policy(s); + return lp_csc_policy(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAX_CONNECTIONS) == 0) { - return lp_max_connections(s); + return lp_max_connections(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_CREATE_MASK) == 0) { - return lp_create_mask(s); + return lp_create_mask(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_DIR_MASK) == 0) { - return lp_dir_mask(s); + return lp_dir_mask(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_FORCE_DIR_MODE) == 0) { - return lp_force_dir_mode(s); + return lp_force_dir_mode(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_FORCE_CREATE_MODE) == 0) { - return lp_force_create_mode(s); + return lp_force_create_mode(s, lp_default_service(lp_ctx)); } @@ -190,39 +190,39 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name } if (strcmp(opt_name, SHARE_BROWSEABLE) == 0) { - return lp_browseable(s); + return lp_browseable(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_READONLY) == 0) { - return lp_readonly(s); + return lp_readonly(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_SYSTEM) == 0) { - return lp_map_system(s); + return lp_map_system(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_HIDDEN) == 0) { - return lp_map_hidden(s); + return lp_map_hidden(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_ARCHIVE) == 0) { - return lp_map_archive(s); + return lp_map_archive(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_STRICT_LOCKING) == 0) { - return lp_strict_locking(s); + return lp_strict_locking(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_STRICT_SYNC) == 0) { - return lp_strict_sync(s); + return lp_strict_sync(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MSDFS_ROOT) == 0) { - return lp_msdfs_root(s); + return lp_msdfs_root(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_CI_FILESYSTEM) == 0) { - return lp_ci_filesystem(s); + return lp_ci_filesystem(s, lp_default_service(lp_ctx)); } DEBUG(0,("request for unknown share bool option '%s'\n", @@ -255,15 +255,15 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar } if (strcmp(opt_name, SHARE_HOSTS_ALLOW) == 0) { - return lp_hostsallow(s); + return lp_hostsallow(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_HOSTS_DENY) == 0) { - return lp_hostsdeny(s); + return lp_hostsdeny(s, lp_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_NTVFS_HANDLER) == 0) { - return lp_ntvfs_handler(s); + return lp_ntvfs_handler(s, lp_default_service(lp_ctx)); } DEBUG(0,("request for unknown share list option '%s'\n", -- cgit From 91ae032c53d9a121a241a9886a1f873db81d7d88 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 27 Mar 2008 20:50:39 +1100 Subject: Actually call into lp_oplocks() in share_classic backend. Andrew Bartlett (This used to be commit 2c18482b1983b4e2764beccc20f08e9b3074816a) --- source4/param/share_classic.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index f5a6fa67a4..c3adc4473c 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -213,6 +213,10 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name return lp_strict_locking(s, lp_default_service(lp_ctx)); } + if (strcmp(opt_name, SHARE_OPLOCKS) == 0) { + return lp_oplocks(s, lp_default_service(lp_ctx)); + } + if (strcmp(opt_name, SHARE_STRICT_SYNC) == 0) { return lp_strict_sync(s, lp_default_service(lp_ctx)); } -- cgit From 21fc7673780aa1d7c0caab7b17ff9171238913ba Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 12:23:44 +0200 Subject: Specify event_context to ldb_wrap_connect explicitly. (This used to be commit b4e1ae07a284c044704322446c94351c2decff91) --- source4/param/share_classic.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/param/share_classic.c') diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index c3adc4473c..bac1aac2d7 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -25,6 +25,7 @@ static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, + struct event_context *event_ctx, struct loadparm_context *lp_ctx, struct share_context **ctx) { -- cgit