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 05:31:19 +0100 |
commit | 53aac0bc9384db68c5ff469b07ae757ca1051cec (patch) | |
tree | ed81834f3fb4022b973747577ab26d0f7f8cf31e | |
parent | f3c0d1d7fe71be7e8b2d1a9780586f8654b46469 (diff) | |
download | samba-53aac0bc9384db68c5ff469b07ae757ca1051cec.tar.gz samba-53aac0bc9384db68c5ff469b07ae757ca1051cec.tar.bz2 samba-53aac0bc9384db68c5ff469b07ae757ca1051cec.zip |
dbwrap_local_open: never open the .tdb if there is an .ntdb
This provides an extra safety check that everyone is using one or the
other: you can't create a tdb file if there's an ntdb file.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | lib/dbwrap/dbwrap_local_open.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/dbwrap/dbwrap_local_open.c b/lib/dbwrap/dbwrap_local_open.c index 87c7c68418..c2eb7b73ee 100644 --- a/lib/dbwrap/dbwrap_local_open.c +++ b/lib/dbwrap/dbwrap_local_open.c @@ -214,6 +214,11 @@ struct db_context *dbwrap_local_open(TALLOC_CTX *mem_ctx, ntdb_flags, open_flags, mode, lock_order); #endif } else { + if (!streq(ntdbname, tdbname) && file_exist(ntdbname)) { + DEBUG(0, ("Refusing to open '%s' when '%s' exists\n", + tdbname, ntdbname)); + goto out; + } db = db_open_tdb(mem_ctx, lp_ctx, tdbname, hash_size, tdb_flags, open_flags, mode, lock_order); |