s3:loadparm: refactor process_registry_service out or process_registry_globals
authorMichael Adam <obnox@samba.org>
Tue, 28 Apr 2009 23:31:03 +0000 (01:31 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 29 Apr 2009 00:20:19 +0000 (02:20 +0200)
Michael

source3/include/proto.h
source3/param/loadparm.c

index 46600e2db2d98fd0a60c4fbf1cca0a37b3d9203e..6dd9c7e7e80408199633b366bf9167869ad1dfe4 100644 (file)
@@ -4079,6 +4079,7 @@ bool lp_string_is_valid_boolean(const char *parm_value);
 bool lp_invert_boolean(const char *str, const char **inverse_str);
 bool lp_canonicalize_boolean(const char *str, const char**canon_str);
 bool service_ok(int iService);
+bool process_registry_service(const char *service_name);
 bool lp_config_backend_is_registry(void);
 bool lp_config_backend_is_file(void);
 bool lp_file_list_changed(void);
index 7e2affed082a3a4d70124d1bffc840646d3b41e6..380b9e1b8c8ed4603fa19780afc2089331c51ecb 100644 (file)
@@ -6824,10 +6824,10 @@ static bool process_smbconf_service(struct smbconf_service *service)
        return true;
 }
 
-/*
- * process_registry_globals
+/**
+ * load a service from registry and activate it
  */
-static bool process_registry_globals(void)
+bool process_registry_service(const char *service_name)
 {
        WERROR werr;
        struct smbconf_service *service = NULL;
@@ -6839,19 +6839,18 @@ static bool process_registry_globals(void)
                goto done;
        }
 
-       ret = do_parameter("registry shares", "yes", NULL);
-       if (!ret) {
-               goto done;
-       }
+       DEBUG(5, ("process_registry_service: service name %s\n", service_name));
 
-       if (!smbconf_share_exists(conf_ctx, GLOBAL_NAME)) {
-               /* nothing to read from the registry yet but make sure lp_load
-                * doesn't return false */
+       if (!smbconf_share_exists(conf_ctx, service_name)) {
+               /*
+                * Registry does not contain data for this service (yet),
+                * but make sure lp_load doesn't return false.
+                */
                ret = true;
                goto done;
        }
 
-       werr = smbconf_get_share(conf_ctx, mem_ctx, GLOBAL_NAME, &service);
+       werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
        }
@@ -6869,6 +6868,21 @@ done:
        return ret;
 }
 
+/*
+ * process_registry_globals
+ */
+static bool process_registry_globals(void)
+{
+       bool ret;
+
+       ret = do_parameter("registry shares", "yes", NULL);
+       if (!ret) {
+               return ret;
+       }
+
+       return process_registry_service(GLOBAL_NAME);
+}
+
 static bool process_registry_shares(void)
 {
        WERROR werr;