summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2011-07-06 16:40:21 +0200
committerMichael Adam <obnox@samba.org>2011-07-29 12:23:13 +0200
commit1abdd9b2bb09d072496db5207814aefefe403f60 (patch)
tree19f220caaecca300aee085e215846983823f8900 /source3
parent75c7320497dc53d23bced5472faef7d9c31c1d9b (diff)
downloadsamba-1abdd9b2bb09d072496db5207814aefefe403f60.tar.gz
samba-1abdd9b2bb09d072496db5207814aefefe403f60.tar.bz2
samba-1abdd9b2bb09d072496db5207814aefefe403f60.zip
s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.
Also start new folder lib/dbwrap/ where dbwrap_open.c is stored and make the fallbacke implementation functoins non-static and create a dbwrap_private.h header file that contains their prototypes.
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in3
-rw-r--r--source3/groupdb/mapping_tdb.c1
-rw-r--r--source3/include/dbwrap.h5
-rw-r--r--source3/lib/conn_tdb.c1
-rw-r--r--source3/lib/dbwrap.c81
-rw-r--r--source3/lib/dbwrap/dbwrap_open.c92
-rw-r--r--source3/lib/dbwrap/dbwrap_open.h37
-rw-r--r--source3/lib/dbwrap/dbwrap_private.h38
-rw-r--r--source3/lib/g_lock.c1
-rw-r--r--source3/lib/serverid.c1
-rw-r--r--source3/lib/sessionid_tdb.c1
-rw-r--r--source3/lib/sharesec.c1
-rw-r--r--source3/locking/brlock.c1
-rw-r--r--source3/locking/locking.c1
-rw-r--r--source3/modules/nfs4_acls.c1
-rw-r--r--source3/modules/vfs_acl_tdb.c1
-rw-r--r--source3/modules/vfs_xattr_tdb.c1
-rw-r--r--source3/passdb/account_pol.c1
-rw-r--r--source3/passdb/pdb_tdb.c1
-rw-r--r--source3/passdb/secrets.c1
-rw-r--r--source3/printing/printer_list.c1
-rw-r--r--source3/registry/reg_backend_db.c1
-rw-r--r--source3/smbd/notify_internal.c1
-rw-r--r--source3/torture/torture.c1
-rw-r--r--source3/utils/dbwrap_tool.c1
-rw-r--r--source3/utils/dbwrap_torture.c1
-rw-r--r--source3/utils/net_idmap.c1
-rw-r--r--source3/utils/net_idmap_check.c1
-rw-r--r--source3/utils/status.c1
-rw-r--r--source3/winbindd/idmap_autorid.c1
-rw-r--r--source3/winbindd/idmap_tdb.c1
-rw-r--r--source3/winbindd/idmap_tdb2.c1
-rwxr-xr-xsource3/wscript_build4
33 files changed, 208 insertions, 78 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 51b0a7cb67..ddcc8be3f9 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -260,7 +260,8 @@ EXTRA_ALL_TARGETS = @EXTRA_ALL_TARGETS@
TDB_LIB_OBJ = lib/util_tdb.o ../lib/util/util_tdb.o \
../lib/util/tdb_wrap.o \
- lib/dbwrap.o lib/dbwrap_tdb.o \
+ lib/dbwrap.o lib/dbwrap/dbwrap_open.o \
+ lib/dbwrap_tdb.o \
lib/dbwrap_ctdb.o \
lib/g_lock.o \
lib/dbwrap_rbt.o
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index fc195cb348..cf038155ae 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -25,6 +25,7 @@
#include "passdb.h"
#include "groupdb/mapping.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "util_tdb.h"
#include "../libcli/security/security.h"
diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h
index 303a554938..194692ca60 100644
--- a/source3/include/dbwrap.h
+++ b/source3/include/dbwrap.h
@@ -58,11 +58,6 @@ struct db_context {
bool db_is_local(const char *name);
-struct db_context *db_open(TALLOC_CTX *mem_ctx,
- const char *name,
- int hash_size, int tdb_flags,
- int open_flags, mode_t mode);
-
struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx);
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c
index 50f0d9fa1b..669ddb2a3a 100644
--- a/source3/lib/conn_tdb.c
+++ b/source3/lib/conn_tdb.c
@@ -21,6 +21,7 @@
#include "system/filesys.h"
#include "smbd/globals.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
static struct db_context *connections_db_ctx(bool rw)
{
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c
index 83fc40efac..0774974ced 100644
--- a/source3/lib/dbwrap.c
+++ b/source3/lib/dbwrap.c
@@ -21,16 +21,19 @@
#include "includes.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_private.h"
#include "util_tdb.h"
#ifdef CLUSTER_SUPPORT
#include "ctdb_private.h"
#endif
+
+
/*
* Fall back using fetch_locked if no genuine fetch operation is provided
*/
-static int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
- TDB_DATA key, TDB_DATA *data)
+int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
+ TDB_DATA key, TDB_DATA *data)
{
struct db_record *rec;
@@ -48,11 +51,11 @@ static int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
* Fall back using fetch if no genuine parse operation is provided
*/
-static int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
- int (*parser)(TDB_DATA key,
- TDB_DATA data,
- void *private_data),
- void *private_data)
+int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
+ int (*parser)(TDB_DATA key,
+ TDB_DATA data,
+ void *private_data),
+ void *private_data)
{
TDB_DATA data;
int res;
@@ -93,67 +96,3 @@ bool db_is_local(const char *name)
#endif
return true;
}
-
-/**
- * open a database
- */
-struct db_context *db_open(TALLOC_CTX *mem_ctx,
- const char *name,
- int hash_size, int tdb_flags,
- int open_flags, mode_t mode)
-{
- struct db_context *result = NULL;
-#ifdef CLUSTER_SUPPORT
- const char *sockname = lp_ctdbd_socket();
-
- if(!sockname || !*sockname) {
- sockname = CTDB_PATH;
- }
-
- if (lp_clustering()) {
- const char *partname;
-
- if (!socket_exist(sockname)) {
- DEBUG(1, ("ctdb socket does not exist - is ctdb not "
- "running?\n"));
- return NULL;
- }
-
- /* ctdb only wants the file part of the name */
- partname = strrchr(name, '/');
- if (partname) {
- partname++;
- } else {
- partname = name;
- }
- /* allow ctdb for individual databases to be disabled */
- if (lp_parm_bool(-1, "ctdb", partname, True)) {
- result = db_open_ctdb(mem_ctx, partname, hash_size,
- tdb_flags, open_flags, mode);
- if (result == NULL) {
- DEBUG(0,("failed to attach to ctdb %s\n",
- partname));
- if (errno == 0) {
- errno = EIO;
- }
- return NULL;
- }
- }
- }
-
-#endif
-
- if (result == NULL) {
- result = db_open_tdb(mem_ctx, name, hash_size,
- tdb_flags, open_flags, mode);
- }
-
- if ((result != NULL) && (result->fetch == NULL)) {
- result->fetch = dbwrap_fallback_fetch;
- }
- if ((result != NULL) && (result->parse_record == NULL)) {
- result->parse_record = dbwrap_fallback_parse_record;
- }
-
- return result;
-}
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
new file mode 100644
index 0000000000..d6b2f30ef6
--- /dev/null
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -0,0 +1,92 @@
+/*
+ Unix SMB/CIFS implementation.
+ Database interface wrapper
+
+ Copyright (C) Volker Lendecke 2005-2007
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "dbwrap.h"
+#include "dbwrap/dbwrap_private.h"
+#include "dbwrap/dbwrap_open.h"
+#include "util_tdb.h"
+#ifdef CLUSTER_SUPPORT
+#include "ctdb_private.h"
+#endif
+
+/**
+ * open a database
+ */
+struct db_context *db_open(TALLOC_CTX *mem_ctx,
+ const char *name,
+ int hash_size, int tdb_flags,
+ int open_flags, mode_t mode)
+{
+ struct db_context *result = NULL;
+#ifdef CLUSTER_SUPPORT
+ const char *sockname = lp_ctdbd_socket();
+
+ if(!sockname || !*sockname) {
+ sockname = CTDB_PATH;
+ }
+
+ if (lp_clustering()) {
+ const char *partname;
+
+ if (!socket_exist(sockname)) {
+ DEBUG(1, ("ctdb socket does not exist - is ctdb not "
+ "running?\n"));
+ return NULL;
+ }
+
+ /* ctdb only wants the file part of the name */
+ partname = strrchr(name, '/');
+ if (partname) {
+ partname++;
+ } else {
+ partname = name;
+ }
+ /* allow ctdb for individual databases to be disabled */
+ if (lp_parm_bool(-1, "ctdb", partname, True)) {
+ result = db_open_ctdb(mem_ctx, partname, hash_size,
+ tdb_flags, open_flags, mode);
+ if (result == NULL) {
+ DEBUG(0,("failed to attach to ctdb %s\n",
+ partname));
+ if (errno == 0) {
+ errno = EIO;
+ }
+ return NULL;
+ }
+ }
+ }
+
+#endif
+
+ if (result == NULL) {
+ result = db_open_tdb(mem_ctx, name, hash_size,
+ tdb_flags, open_flags, mode);
+ }
+
+ if ((result != NULL) && (result->fetch == NULL)) {
+ result->fetch = dbwrap_fallback_fetch;
+ }
+ if ((result != NULL) && (result->parse_record == NULL)) {
+ result->parse_record = dbwrap_fallback_parse_record;
+ }
+
+ return result;
+}
diff --git a/source3/lib/dbwrap/dbwrap_open.h b/source3/lib/dbwrap/dbwrap_open.h
new file mode 100644
index 0000000000..153e91ad5d
--- /dev/null
+++ b/source3/lib/dbwrap/dbwrap_open.h
@@ -0,0 +1,37 @@
+/*
+ Unix SMB/CIFS implementation.
+ Database interface wrapper around tdb
+
+ Copyright (C) Volker Lendecke 2005-2007
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __DBWRAP_OPEN_H__
+#define __DBWRAP_OPEN_H__
+
+struct db_context;
+
+/**
+ * Convenience function that will determine whether to
+ * open a tdb database via the tdb backend or via the ctdb
+ * backend, based on lp_clustering() and a db-specific
+ * settings.
+ */
+struct db_context *db_open(TALLOC_CTX *mem_ctx,
+ const char *name,
+ int hash_size, int tdb_flags,
+ int open_flags, mode_t mode);
+
+#endif /* __DBWRAP_OPEN_H__ */
diff --git a/source3/lib/dbwrap/dbwrap_private.h b/source3/lib/dbwrap/dbwrap_private.h
new file mode 100644
index 0000000000..c8f3a1062f
--- /dev/null
+++ b/source3/lib/dbwrap/dbwrap_private.h
@@ -0,0 +1,38 @@
+/*
+ Unix SMB/CIFS implementation.
+ Database interface wrapper around tdb - private header
+
+ Copyright (C) Volker Lendecke 2005-2007
+ Copyright (C) Gregor Beck 2011
+ Copyright (C) Michael Adam 2011
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __DBWRAP_PRIVATE_H__
+#define __DBWRAP_PRIVATE_H__
+
+
+int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
+ TDB_DATA key, TDB_DATA *data);
+
+
+int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
+ int (*parser)(TDB_DATA key,
+ TDB_DATA data,
+ void *private_data),
+ void *private_data);
+
+#endif /* __DBWRAP_PRIVATE_H__ */
+
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index c4ac8e372b..3a983d5fb7 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "g_lock.h"
#include "util_tdb.h"
#include "ctdbd_conn.h"
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index 1a1141265a..f2ba07ab34 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -22,6 +22,7 @@
#include "serverid.h"
#include "util_tdb.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "lib/util/tdb_wrap.h"
struct serverid_key {
diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c
index de3ccab26a..dc3f61c33b 100644
--- a/source3/lib/sessionid_tdb.c
+++ b/source3/lib/sessionid_tdb.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "session.h"
#include "util_tdb.h"
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c
index 11ccb42300..fa67567537 100644
--- a/source3/lib/sharesec.c
+++ b/source3/lib/sharesec.c
@@ -22,6 +22,7 @@
#include "../libcli/security/security.h"
#include "../librpc/gen_ndr/ndr_security.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "util_tdb.h"
/*******************************************************************
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index a429768e69..70147f4844 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -29,6 +29,7 @@
#include "locking/proto.h"
#include "smbd/globals.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "serverid.h"
#include "messages.h"
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 81e93a555a..0c5076f806 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -40,6 +40,7 @@
#include "locking/proto.h"
#include "smbd/globals.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "serverid.h"
#include "messages.h"
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 6739e78050..6f52bd1cd7 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -24,6 +24,7 @@
#include "../libcli/security/dom_sid.h"
#include "../libcli/security/security.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "system/filesys.h"
#include "passdb/lookup_sid.h"
#include "util_tdb.h"
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 0b03896dd9..abfe6ee32c 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -27,6 +27,7 @@
#include "librpc/gen_ndr/ndr_xattr.h"
#include "../lib/crypto/crypto.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "auth.h"
#include "util_tdb.h"
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index 40ccf06dd9..18d0be573e 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -24,6 +24,7 @@
#include "librpc/gen_ndr/ndr_xattr.h"
#include "../librpc/gen_ndr/ndr_netlogon.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "util_tdb.h"
#undef DBGC_CLASS
diff --git a/source3/passdb/account_pol.c b/source3/passdb/account_pol.c
index c4a39e408f..1179f5a335 100644
--- a/source3/passdb/account_pol.c
+++ b/source3/passdb/account_pol.c
@@ -23,6 +23,7 @@
#include "system/filesys.h"
#include "passdb.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "lib/privileges.h"
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 28461d0ac3..1c40e24b28 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -26,6 +26,7 @@
#include "system/filesys.h"
#include "passdb.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "util_tdb.h"
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index c9101ca050..7ad79c14ec 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -29,6 +29,7 @@
#include "librpc/gen_ndr/ndr_secrets.h"
#include "secrets.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "util_tdb.h"
diff --git a/source3/printing/printer_list.c b/source3/printing/printer_list.c
index d28278d069..0aaa730c8e 100644
--- a/source3/printing/printer_list.c
+++ b/source3/printing/printer_list.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "util_tdb.h"
#include "printer_list.h"
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index e04374b917..0d56cc6169 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -31,6 +31,7 @@
#include "nt_printing.h"
#include "util_tdb.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/secdesc.h"
#undef DBGC_CLASS
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index a0193a4467..b55dfe976f 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -27,6 +27,7 @@
#include "system/filesys.h"
#include "librpc/gen_ndr/ndr_notify.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "smbd/smbd.h"
#include "messages.h"
#include "lib/util/tdb_wrap.h"
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 2c309289fa..cf0a5786b9 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -29,6 +29,7 @@
#include "memcache.h"
#include "nsswitch/winbind_client.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "talloc_dict.h"
#include "async_smb.h"
#include "libsmb/libsmb.h"
diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c
index 9061efd395..2210ab5597 100644
--- a/source3/utils/dbwrap_tool.c
+++ b/source3/utils/dbwrap_tool.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "messages.h"
typedef enum { OP_FETCH, OP_STORE, OP_DELETE, OP_ERASE, OP_LISTKEYS } dbwrap_op;
diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c
index 21d5e8c8b6..5ce98f9c8c 100644
--- a/source3/utils/dbwrap_torture.c
+++ b/source3/utils/dbwrap_torture.c
@@ -23,6 +23,7 @@
#include "system/filesys.h"
#include "popt_common.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "messages.h"
#if 0
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index 383035e906..b1388d265d 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -23,6 +23,7 @@
#include "secrets.h"
#include "idmap.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "net_idmap_check.h"
#include "util_tdb.h"
diff --git a/source3/utils/net_idmap_check.c b/source3/utils/net_idmap_check.c
index 3adc060a7c..76cd979164 100644
--- a/source3/utils/net_idmap_check.c
+++ b/source3/utils/net_idmap_check.c
@@ -27,6 +27,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "net.h"
#include "../libcli/security/dom_sid.h"
#include "cbuf.h"
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 001c5fd011..4bd18b6d0f 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -34,6 +34,7 @@
#include "system/filesys.h"
#include "popt_common.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "session.h"
#include "locking/proto.h"
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index cddbff2d47..c1a15803eb 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -26,6 +26,7 @@
#include "system/filesys.h"
#include "winbindd.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "idmap.h"
#include "../libcli/security/dom_sid.h"
#include "util_tdb.h"
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index d99d2f0e4e..6c326b4fde 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -29,6 +29,7 @@
#include "idmap.h"
#include "idmap_rw.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/security.h"
#include "util_tdb.h"
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 112978bdc3..d7cbb8aef6 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -37,6 +37,7 @@
#include "idmap.h"
#include "idmap_rw.h"
#include "dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
#include "../libcli/security/dom_sid.h"
#include "util_tdb.h"
diff --git a/source3/wscript_build b/source3/wscript_build
index 3fcd605f19..cdf64bebf9 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -14,7 +14,9 @@ bld.env.public_headers_skip = ['lib/ldb_compat.h']
bld.env.public_headers_allow_broken = True
TDB_LIB_SRC = '''
- lib/dbwrap.c lib/dbwrap_tdb.c
+ lib/dbwrap.c
+ lib/dbwrap/dbwrap_open.c
+ lib/dbwrap_tdb.c
lib/dbwrap_ctdb.c
lib/g_lock.c'''