From 53aac0bc9384db68c5ff469b07ae757ca1051cec Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 20 Feb 2013 14:59:42 +1030 Subject: 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 Reviewed-by: Andrew Bartlett --- lib/dbwrap/dbwrap_local_open.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/dbwrap') 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); -- cgit