provision: Set @INDEXLIST first when building dummy sam.ldb
authorAndrew Bartlett <abartlet@samba.org>
Thu, 22 Mar 2018 21:58:11 +0000 (10:58 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 6 Apr 2018 00:08:45 +0000 (02:08 +0200)
The new LMDB backed will not allow normal records to be added before the @INDEXLIST
as this is what forces the GUID index mode.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
python/samba/provision/sambadns.py

index ce1b7692ff965ec591de5190c196171f5c7c7eff..7a85546c53eca272103a557eaa28642f8c0afbc7 100644 (file)
@@ -811,6 +811,11 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
         # Fill the basedn and @OPTION records in domain partition
         dom_url = "%s://%s" % (backend_store, domainpart_file)
         dom_ldb = samba.Ldb(dom_url)
+
+        # We need the dummy main-domain DB to have the correct @INDEXLIST
+        index_res = samdb.search(base="@INDEXLIST", scope=ldb.SCOPE_BASE)
+        dom_ldb.add(index_res[0])
+
         domainguid_line = "objectGUID: %s\n-" % domainguid
         descr = b64encode(get_domain_descriptor(domainsid))
         setup_add_ldif(dom_ldb, setup_path("provision_basedn.ldif"), {
@@ -821,9 +826,6 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid):
         setup_add_ldif(dom_ldb,
             setup_path("provision_basedn_options.ldif"), None)
 
-        # We need the dummy main-domain DB to have the correct @INDEXLIST
-        index_res = samdb.search(base="@INDEXLIST", scope=ldb.SCOPE_BASE)
-        dom_ldb.add(index_res[0])
     except:
         logger.error(
             "Failed to setup database for BIND, AD based DNS cannot be used")