summaryrefslogtreecommitdiff
path: root/source3
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
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')
-rw-r--r--source3/include/secrets.h2
-rw-r--r--source3/passdb/py_passdb.c2
-rw-r--r--source3/passdb/secrets.c8
3 files changed, 6 insertions, 6 deletions
diff --git a/source3/include/secrets.h b/source3/include/secrets.h
index 57a1be0c3e..1eeb24c1c9 100644
--- a/source3/include/secrets.h
+++ b/source3/include/secrets.h
@@ -82,7 +82,7 @@ struct afs_keyfile {
/* The following definitions come from passdb/secrets.c */
-bool secrets_init_path(const char *private_dir);
+bool secrets_init_path(const char *private_dir, bool use_ntdb);
bool secrets_init(void);
struct db_context *secrets_db_ctx(void);
void secrets_shutdown(void);
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)