diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-03-07 07:33:14 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-03-07 07:33:14 +1100 |
commit | 8b24d248b7c928fd3b20f95ede34302ca274c4ae (patch) | |
tree | 186243af1742e4662e462a56a01c61f62098ab68 /source4/scripting | |
parent | 0e50fb5e917117de22c5b3c32865d8a40285e362 (diff) | |
download | samba-8b24d248b7c928fd3b20f95ede34302ca274c4ae.tar.gz samba-8b24d248b7c928fd3b20f95ede34302ca274c4ae.tar.bz2 samba-8b24d248b7c928fd3b20f95ede34302ca274c4ae.zip |
Start to rework provision for LDAP backends
This is the start of the rework of the provision script to handle an
LDAP backend correctly. For example, we must not set the 'tdb
modules' against an LDAP backend such as OpenLDAP that handles subtree
renames.
Andrew Bartlett
(This used to be commit e462a107d3bafcc546ca4d53dcc8eb32e4280745)
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/__init__.py | 7 | ||||
-rw-r--r-- | source4/scripting/python/samba/provision.py | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index 8d5f4250c9..e91b320c07 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -147,7 +147,12 @@ class Ldb(ldb.Ldb): k = 0 while ++k < 10 and (previous_remaining != current_remaining): # and the rest - res2 = self.search(basedn, ldb.SCOPE_SUBTREE, "(|(objectclass=*)(distinguishedName=*))", ["distinguishedName"]) + try: + res2 = self.search(basedn, ldb.SCOPE_SUBTREE, "(|(objectclass=*)(distinguishedName=*))", ["distinguishedName"]) + except ldb.LdbError, (LDB_ERR_NO_SUCH_OBJECT, _): + # Ignore missing dn errors + return + previous_remaining = current_remaining current_remaining = len(res2) for msg in res2: diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index ea2feb981b..b140071f41 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -341,12 +341,21 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info, if ldap_backend_type == "fedora-ds": backend_modules = ["nsuniqueid", "paged_searches"] + # We can handle linked attributes here, as we don't have directory-side subtree operations + tdb_modules_list = ["linked_attributes"] elif ldap_backend_type == "openldap": backend_modules = ["normalise", "entryuuid", "paged_searches"] + # OpenLDAP handles subtree renames, so we don't want to do any of these things + tdb_modules_list = None elif serverrole == "domain controller": backend_modules = ["repl_meta_data"] else: backend_modules = ["objectguid"] + + if tdb_modules_list is None: + tdb_modules_list_as_string = "" + else: + tdb_modules_list_as_string = ","+",".join(tdb_modules_list) samdb.transaction_start() try: @@ -362,7 +371,7 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info, "CONFIGDN_MOD": "naming_fsmo,instancetype", "DOMAINDN_MOD": "pdc_fsmo,password_hash,instancetype", "MODULES_LIST": ",".join(modules_list), - "TDB_MODULES_LIST": ","+",".join(tdb_modules_list), + "TDB_MODULES_LIST": tdb_modules_list_as_string, "MODULES_LIST2": ",".join(modules_list2), "BACKEND_MOD": ",".join(backend_modules), }) |