summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-02-13 11:07:06 +1100
committerAmitay Isaacs <amitay@samba.org>2012-02-13 03:02:09 +0100
commitbee55a29578e8eab66c36de9b2526769b05b8dba (patch)
treee384fbe1fd027906d6c23b2714ceacb08a99daf9 /source4/dsdb/samdb
parentcaf485a2bd0453b7d22600f9106a2026b1a50c79 (diff)
downloadsamba-bee55a29578e8eab66c36de9b2526769b05b8dba.tar.gz
samba-bee55a29578e8eab66c36de9b2526769b05b8dba.tar.bz2
samba-bee55a29578e8eab66c36de9b2526769b05b8dba.zip
s4-dsdb: Check if metadata.tdb exists, before trying to open it
This fixes the error output from tdb2 when metadata module tries to create metadata.tdb first time. This error is reported since metadata module tries to check if tdb exists by trying to open tdb file. Autobuild-User: Amitay Isaacs <amitay@samba.org> Autobuild-Date: Mon Feb 13 03:02:09 CET 2012 on sn-devel-104
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_metadata.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition_metadata.c b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
index acf414b1c2..e3f0fb5c01 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_metadata.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
@@ -152,6 +152,7 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
const char *sam_name;
char *filename, *dirname;
int open_flags;
+ struct stat statbuf;
data = talloc_get_type_abort(ldb_module_get_private(module),
struct partition_private_data);
@@ -193,6 +194,11 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
mkdir(dirname, 0700);
talloc_free(dirname);
+ } else {
+ if (stat(filename, &statbuf) != 0) {
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
}
lp_ctx = talloc_get_type_abort(ldb_get_opaque(ldb, "loadparm"),