summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2013-02-20 14:59:42 +1030
committerRusty Russell <rusty@rustcorp.com.au>2013-02-20 07:09:19 +0100
commit2f4b21bb57c4f96c5f5b57a69d022c142d8088d5 (patch)
treeccc1865699e47eaf9702953ae9a59f746fe4afa2 /source3/passdb
parent3c9c3029f2bcf10ef614dd9f923d02232db3ac8d (diff)
downloadsamba-2f4b21bb57c4f96c5f5b57a69d022c142d8088d5.tar.gz
samba-2f4b21bb57c4f96c5f5b57a69d022c142d8088d5.tar.bz2
samba-2f4b21bb57c4f96c5f5b57a69d022c142d8088d5.zip
ntdb: switch between secrets.tdb and secrets.ntdb depending on 'use ntdb'
Since we open with dbwrap, it auto-converts old tdbs (which it will rename to secrets.tdb.bak once it's done). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date(master): Wed Feb 20 07:09:19 CET 2013 on sn-devel-104
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/py_passdb.c2
-rw-r--r--source3/passdb/secrets.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index 6984061714..3fd14cdc41 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -3638,7 +3638,7 @@ static PyObject *py_set_secrets_dir(PyObject *self, PyObject *args)
}
/* Initialize secrets database */
- if (!secrets_init_path(private_dir)) {
+ if (!secrets_init_path(private_dir, lp_use_ntdb())) {
PyErr_Format(py_pdb_error, "Cannot open secrets file database in '%s'",
private_dir);
talloc_free(frame);
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 8f314a76cf..f97510db21 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -55,7 +55,7 @@ static void get_rand_seed(void *userdata, int *new_seed)
}
/* open up the secrets database with specified private_dir path */
-bool secrets_init_path(const char *private_dir)
+bool secrets_init_path(const char *private_dir, bool use_ntdb)
{
char *fname = NULL;
unsigned char dummy;
@@ -70,8 +70,8 @@ bool secrets_init_path(const char *private_dir)
}
frame = talloc_stackframe();
- fname = talloc_asprintf(frame, "%s/secrets.tdb",
- private_dir);
+ fname = talloc_asprintf(frame, "%s/secrets.%s",
+ private_dir, use_ntdb ? "ntdb" : "tdb");
if (fname == NULL) {
TALLOC_FREE(frame);
return False;
@@ -105,7 +105,7 @@ bool secrets_init_path(const char *private_dir)
/* open up the secrets database */
bool secrets_init(void)
{
- return secrets_init_path(lp_private_dir());
+ return secrets_init_path(lp_private_dir(), lp_use_ntdb());
}
struct db_context *secrets_db_ctx(void)