[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-2441-g95339c0
Michael Adam
obnox at samba.org
Thu May 15 00:52:19 GMT 2008
The branch, v3-3-test has been updated
via 95339c0c1ecc49049f1fc176f72a1dcac639e06d (commit)
via b387c614ba8d1d3960f6917f03f0fd433cf2b2ee (commit)
via e1b76cd5d646bb9083cfca0d15a84183cad72882 (commit)
via b3233ecefd5df745ba7e10511f9ab36064036b10 (commit)
via b3a90b72517c2e25d972796908aec4d2b85a030e (commit)
via 2986e5174e69527465ae7ef8e108110416752b56 (commit)
via 83cd9f74d57c462ad5c8956b3ce3c81bea429b67 (commit)
from f3251ba03a69c2fd0335861177159a32b2bc9477 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 95339c0c1ecc49049f1fc176f72a1dcac639e06d
Author: Michael Adam <obnox at samba.org>
Date: Thu May 15 02:41:05 2008 +0200
testparm: list registry shares with testparm.
I.e., use lp_load_with_registry_shares() instead of lp_load().
Michael
commit b387c614ba8d1d3960f6917f03f0fd433cf2b2ee
Author: Michael Adam <obnox at samba.org>
Date: Thu May 15 02:39:45 2008 +0200
loadparm: add funcion lp_load_with_registry_shares().
This is like lp_load(), except that it will load the
registry shares into the services aarray when registry
shares are activated.
Michael
commit e1b76cd5d646bb9083cfca0d15a84183cad72882
Author: Michael Adam <obnox at samba.org>
Date: Thu May 15 02:39:02 2008 +0200
loadparm: add call to do_section() to process_registry_service().
Michael
commit b3233ecefd5df745ba7e10511f9ab36064036b10
Author: Michael Adam <obnox at samba.org>
Date: Thu May 15 02:25:34 2008 +0200
loadparm: add parameter allow_registry_shares to lp_load_ex().
This allows for registry shares to be activated, i.e. loaded into
the services array at lp_load() time.
Michael
commit b3a90b72517c2e25d972796908aec4d2b85a030e
Author: Michael Adam <obnox at samba.org>
Date: Thu May 15 02:15:20 2008 +0200
loadparm: add a function process_registry_shares()
This loads the shares defined in registry into the services array.
Michael
commit 2986e5174e69527465ae7ef8e108110416752b56
Author: Michael Adam <obnox at samba.org>
Date: Thu May 15 02:08:14 2008 +0200
loadparm: refactor processing of service out of process_registry_globals()
into new function process_registry_service().
Michael
commit 83cd9f74d57c462ad5c8956b3ce3c81bea429b67
Author: Michael Adam <obnox at samba.org>
Date: Thu May 15 01:40:11 2008 +0200
loadparm: refactor initalization of registry config out into lp_smbconf_ctx().
Michael
-----------------------------------------------------------------------
Summary of changes:
source/param/loadparm.c | 133 ++++++++++++++++++++++++++++++++++++++--------
source/utils/testparm.c | 2 +-
2 files changed, 111 insertions(+), 24 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index b539684..e45c8b8 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -80,7 +80,6 @@ extern userdom_struct current_user_info;
static bool in_client = False; /* Not in the client by default */
static struct smbconf_csn conf_last_csn;
-static struct smbconf_ctx *conf_ctx = NULL;
#define CONFIG_BACKEND_FILE 0
#define CONFIG_BACKEND_REGISTRY 1
@@ -6491,6 +6490,47 @@ bool service_ok(int iService)
return (bRetval);
}
+static struct smbconf_ctx *lp_smbconf_ctx(void)
+{
+ WERROR werr;
+ static struct smbconf_ctx *conf_ctx = NULL;
+
+ if (conf_ctx == NULL) {
+ werr = smbconf_init(NULL, &conf_ctx, "registry:");
+ if (!W_ERROR_IS_OK(werr)) {
+ DEBUG(1, ("error initializing registry configuration: "
+ "%s\n", dos_errstr(werr)));
+ conf_ctx = NULL;
+ }
+ }
+
+ return conf_ctx;
+}
+
+static bool process_registry_service(struct smbconf_service *service)
+{
+ uint32_t count;
+ bool ret;
+
+ if (service == NULL) {
+ return false;
+ }
+
+ ret = do_section(service->name, NULL);
+ if (ret != true) {
+ return false;
+ }
+ for (count = 0; count < service->num_params; count++) {
+ ret = do_parameter(service->param_names[count],
+ service->param_values[count],
+ NULL);
+ if (ret != true) {
+ return false;
+ }
+ }
+ return true;
+}
+
/*
* process_registry_globals
*/
@@ -6498,16 +6538,12 @@ static bool process_registry_globals(void)
{
WERROR werr;
struct smbconf_service *service = NULL;
- uint32_t count;
TALLOC_CTX *mem_ctx = talloc_stackframe();
+ struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
bool ret = false;
if (conf_ctx == NULL) {
- /* first time */
- werr = smbconf_init(NULL, &conf_ctx, "registry:");
- if (!W_ERROR_IS_OK(werr)) {
- goto done;
- }
+ goto done;
}
if (!smbconf_share_exists(conf_ctx, GLOBAL_NAME)) {
@@ -6522,16 +6558,49 @@ static bool process_registry_globals(void)
goto done;
}
- for (count = 0; count < service->num_params; count++) {
- ret = do_parameter(service->param_names[count],
- service->param_values[count],
- NULL);
- if (ret != true) {
+ ret = process_registry_service(service);
+ if (!ret) {
+ goto done;
+ }
+
+ ret = do_parameter("registry shares", "yes", NULL);
+ /* store the csn */
+ smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
+
+done:
+ TALLOC_FREE(mem_ctx);
+ return ret;
+}
+
+static bool process_registry_shares(void)
+{
+ WERROR werr;
+ uint32_t count;
+ struct smbconf_service **service = NULL;
+ uint32_t num_shares = 0;
+ TALLOC_CTX *mem_ctx = talloc_stackframe();
+ struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
+ bool ret = false;
+
+ if (conf_ctx == NULL) {
+ goto done;
+ }
+
+ werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
+ }
+
+ for (count = 0; count < num_shares; count++) {
+ if (strequal(service[count]->name, GLOBAL_NAME)) {
+ continue;
+ }
+ ret = process_registry_service(service[count]);
+ if (!ret) {
goto done;
}
}
- ret = do_parameter("registry shares", "yes", NULL);
/* store the csn */
smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
@@ -6613,14 +6682,10 @@ bool lp_file_list_changed(void)
DEBUG(6, ("lp_file_list_changed()\n"));
if (lp_config_backend_is_registry()) {
+ struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
+
if (conf_ctx == NULL) {
- WERROR werr;
- werr = smbconf_init(NULL, &conf_ctx, "registry:");
- if (!W_ERROR_IS_OK(werr)) {
- DEBUG(0, ("error opening configuration: %s\n",
- dos_errstr(werr)));
- return false;
- }
+ return false;
}
if (smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL)) {
DEBUGADD(6, ("registry config changed\n"));
@@ -8658,7 +8723,8 @@ bool lp_load_ex(const char *pszFname,
bool save_defaults,
bool add_ipc,
bool initialize_globals,
- bool allow_include_registry)
+ bool allow_include_registry,
+ bool allow_registry_shares)
{
char *n2 = NULL;
bool bRetval;
@@ -8732,7 +8798,8 @@ bool lp_load_ex(const char *pszFname,
lp_kill_all_services();
return lp_load_ex(pszFname, global_only, save_defaults,
add_ipc, initialize_globals,
- allow_include_registry);
+ allow_include_registry,
+ allow_registry_shares);
}
} else if (lp_config_backend_is_registry()) {
bRetval = process_registry_globals();
@@ -8742,6 +8809,10 @@ bool lp_load_ex(const char *pszFname,
bRetval = false;
}
+ if (bRetval && lp_registry_shares() && allow_registry_shares) {
+ bRetval = process_registry_shares();
+ }
+
lp_add_auto_services(lp_auto_services());
if (add_ipc) {
@@ -8783,7 +8854,7 @@ bool lp_load(const char *pszFname,
save_defaults,
add_ipc,
initialize_globals,
- true);
+ true, false);
}
bool lp_load_initial_only(const char *pszFname)
@@ -8793,9 +8864,25 @@ bool lp_load_initial_only(const char *pszFname)
false,
false,
true,
+ false,
false);
}
+bool lp_load_with_registry_shares(const char *pszFname,
+ bool global_only,
+ bool save_defaults,
+ bool add_ipc,
+ bool initialize_globals)
+{
+ return lp_load_ex(pszFname,
+ global_only,
+ save_defaults,
+ add_ipc,
+ initialize_globals,
+ true,
+ true);
+}
+
/***************************************************************************
Reset the max number of services.
***************************************************************************/
diff --git a/source/utils/testparm.c b/source/utils/testparm.c
index aded4a8..03291fe 100644
--- a/source/utils/testparm.c
+++ b/source/utils/testparm.c
@@ -269,7 +269,7 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
fprintf(stderr,"Load smb config files from %s\n",config_file);
- if (!lp_load(config_file,False,True,False,True)) {
+ if (!lp_load_with_registry_shares(config_file,False,True,False,True)) {
fprintf(stderr,"Error loading services.\n");
return(1);
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list