From bee55a29578e8eab66c36de9b2526769b05b8dba Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Mon, 13 Feb 2012 11:07:06 +1100 Subject: 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 Autobuild-Date: Mon Feb 13 03:02:09 CET 2012 on sn-devel-104 --- source4/dsdb/samdb/ldb_modules/partition_metadata.c | 6 ++++++ 1 file changed, 6 insertions(+) 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"), -- cgit