diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-02-20 14:59:42 +1030 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-02-20 07:09:19 +0100 |
commit | 2f4b21bb57c4f96c5f5b57a69d022c142d8088d5 (patch) | |
tree | ccc1865699e47eaf9702953ae9a59f746fe4afa2 /source4/dsdb/samdb/ldb_modules | |
parent | 3c9c3029f2bcf10ef614dd9f923d02232db3ac8d (diff) | |
download | samba-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 'source4/dsdb/samdb/ldb_modules')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/secrets_tdb_sync.c | 13 |
1 files changed, 10 insertions, 3 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(); |