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 09:42:11 +0000 (11:42 +0200)
Michael
(cherry picked from commit fb3b6576127ce837ac711e87c293d1f4cf97473c)

source/param/loadparm.c

index ada330c667b6406259838c3c5d407d98e43e748d..a3efd20e0609c86a0a85a45cb77d014a26024d11 100644 (file)
@@ -6535,10 +6535,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;
@@ -6550,19 +6550,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;
        }
@@ -6580,6 +6579,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;