s3:idmap: in idmap_init_domain() load methods before loading further config
authorMichael Adam <obnox@samba.org>
Sun, 20 Jul 2014 09:53:32 +0000 (11:53 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 25 Jul 2014 09:52:10 +0000 (11:52 +0200)
Check whether the requested backend exists at all, before going
further into the config parsing.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/winbindd/idmap.c

index 33b397ce661001f1575b4c1dfc5c90d2783be2c1..c76c35022de0ead972a144a88d50d11c5343aad2 100644 (file)
@@ -185,6 +185,29 @@ static struct idmap_domain *idmap_init_domain(TALLOC_CTX *mem_ctx,
                goto fail;
        }
 
+       /*
+        * Check whether the requested backend module exists and
+        * load the methods.
+        */
+
+       result->methods = get_methods(modulename);
+       if (result->methods == NULL) {
+               DEBUG(3, ("idmap backend %s not found\n", modulename));
+
+               status = smb_probe_module("idmap", modulename);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DEBUG(3, ("Could not probe idmap module %s\n",
+                                 modulename));
+                       goto fail;
+               }
+
+               result->methods = get_methods(modulename);
+       }
+       if (result->methods == NULL) {
+               DEBUG(1, ("idmap backend %s not found\n", modulename));
+               goto fail;
+       }
+
        /*
         * load ranges and read only information from the config
         */
@@ -226,24 +249,6 @@ static struct idmap_domain *idmap_init_domain(TALLOC_CTX *mem_ctx,
                }
        }
 
-       result->methods = get_methods(modulename);
-       if (result->methods == NULL) {
-               DEBUG(3, ("idmap backend %s not found\n", modulename));
-
-               status = smb_probe_module("idmap", modulename);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DEBUG(3, ("Could not probe idmap module %s\n",
-                                 modulename));
-                       goto fail;
-               }
-
-               result->methods = get_methods(modulename);
-       }
-       if (result->methods == NULL) {
-               DEBUG(1, ("idmap backend %s not found\n", modulename));
-               goto fail;
-       }
-
        status = result->methods->init(result);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("idmap initialization returned %s\n",