summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c13
-rw-r--r--source4/scripting/python/samba/tests/provision.py9
-rw-r--r--source4/scripting/python/samba/tests/upgradeprovision.py2
-rw-r--r--source4/scripting/python/samba/tests/upgradeprovisionneeddc.py2
4 files changed, 18 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c b/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c
index e90fc77068..e3d8485c61 100644
--- a/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c
+++ b/source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c
@@ -474,7 +474,8 @@ static int secrets_tdb_sync_init(struct ldb_module *module)
struct ldb_context *ldb;
struct secrets_tdb_sync_private *data;
char *private_dir, *p;
- const char *secrets_ldb;
+ const char *secrets_ldb, *secrets_ntdb;
+ bool use_ntdb;
ldb = ldb_module_get_ctx(module);
@@ -498,11 +499,17 @@ static int secrets_tdb_sync_init(struct ldb_module *module)
p = strrchr(private_dir, '/');
if (p) {
*p = '\0';
- secrets_init_path(private_dir);
} else {
- secrets_init_path(".");
+ private_dir = talloc_strdup(data, ".");
}
+ /* If there's an ntdb file, force code to load that. */
+ secrets_ntdb = talloc_asprintf(private_dir, "%s/secrets.ntdb",
+ private_dir);
+ use_ntdb = file_exist(secrets_ntdb);
+
+ secrets_init_path(private_dir, use_ntdb);
+
TALLOC_FREE(private_dir);
data->secrets_tdb = secrets_db_ctx();
diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py
index 992179124b..929e7074f7 100644
--- a/source4/scripting/python/samba/tests/provision.py
+++ b/source4/scripting/python/samba/tests/provision.py
@@ -55,8 +55,9 @@ class ProvisionTestCase(samba.tests.TestCaseInTempDir):
def test_setup_secretsdb(self):
path = os.path.join(self.tempdir, "secrets.ldb")
- secrets_tdb_path = os.path.join(self.tempdir, "secrets.tdb")
paths = ProvisionPaths()
+ secrets_tdb_path = os.path.join(self.tempdir, "secrets.tdb")
+ secrets_ntdb_path = os.path.join(self.tempdir, "secrets.ntdb")
paths.secrets = path
paths.private_dir = os.path.dirname(path)
paths.keytab = "no.keytab"
@@ -68,8 +69,10 @@ class ProvisionTestCase(samba.tests.TestCaseInTempDir):
finally:
del ldb
os.unlink(path)
- os.unlink(secrets_tdb_path)
-
+ if os.path.exists(secrets_tdb_path):
+ os.unlink(secrets_tdb_path)
+ if os.path.exists(secrets_ntdb_path):
+ os.unlink(secrets_ntdb_path)
class FindNssTests(TestCase):
"""Test findnss() function."""
diff --git a/source4/scripting/python/samba/tests/upgradeprovision.py b/source4/scripting/python/samba/tests/upgradeprovision.py
index c1c70c4a88..93a6731c83 100644
--- a/source4/scripting/python/samba/tests/upgradeprovision.py
+++ b/source4/scripting/python/samba/tests/upgradeprovision.py
@@ -126,7 +126,7 @@ class UpdateSecretsTests(samba.tests.TestCaseInTempDir):
self.assertEquals(newmodules.msgs, refmodules.msgs)
def tearDown(self):
- for name in ["ref.ldb", "secrets.ldb", "secrets.tdb"]:
+ for name in ["ref.ldb", "secrets.ldb", "secrets.tdb", "secrets.tdb.bak", "secrets.ntdb"]:
path = os.path.join(self.tempdir, name)
if os.path.exists(path):
os.unlink(path)
diff --git a/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py b/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py
index 1de123c71d..a7cb298ed7 100644
--- a/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py
+++ b/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py
@@ -172,7 +172,7 @@ class UpgradeProvisionWithLdbTestCase(TestCaseInTempDir):
self.assertTrue(re.match(".*upgrade to.*", str(oem2)))
def tearDown(self):
- for name in ["ref.ldb", "secrets.ldb", "secrets.tdb", "sam.ldb"]:
+ for name in ["ref.ldb", "secrets.ldb", "secrets.tdb", "secrets.tdb.bak", "secrets.ntdb", "sam.ldb"]:
path = os.path.join(self.tempdir, name)
if os.path.exists(path):
os.unlink(path)