loadparm: add a function process_registry_shares()
authorMichael Adam <obnox@samba.org>
Thu, 15 May 2008 00:15:20 +0000 (02:15 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 10 Jul 2008 21:34:03 +0000 (23:34 +0200)
This loads the shares defined in registry into the services array.

Michael
(cherry picked from commit b3a90b72517c2e25d972796908aec4d2b85a030e)

source/param/loadparm.c

index df8c4e9212275b50405a7cd06353e6fc72b36b32..4c8e304bd104fe99409b293b3dd3b6c088f590ae 100644 (file)
@@ -6580,6 +6580,43 @@ done:
        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;
+               }
+       }
+
+       /* store the csn */
+       smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
+
+done:
+       TALLOC_FREE(mem_ctx);
+       return ret;
+}
+
 static struct file_lists {
        struct file_lists *next;
        char *name;