From: Rusty Russell Date: Wed, 20 Feb 2013 04:29:42 +0000 (+1030) Subject: dbwrap_local_open: never open the .tdb if there is an .ntdb X-Git-Tag: tevent-0.9.18~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53aac0bc9384db68c5ff469b07ae757ca1051cec;p=thirdparty%2Fsamba.git 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 --- diff --git a/lib/dbwrap/dbwrap_local_open.c b/lib/dbwrap/dbwrap_local_open.c index 87c7c68418a..c2eb7b73eeb 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);