1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

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
This commit is contained in:
Amitay Isaacs 2012-02-13 11:07:06 +11:00 committed by Amitay Isaacs
parent caf485a2bd
commit bee55a2957

View File

@ -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"),