summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-05-05 11:25:29 +0200
committerGünther Deschner <gd@samba.org>2011-05-06 10:48:10 +0200
commitd8cfca3a9bd2b6b6c562fd202377d95a98eb5472 (patch)
tree96fc9d454a01cbb2c26a8db22f41b8bf0dc40879 /source3
parent8aae59a277fe4bf5a1a84cb4730e5772c9ffca8c (diff)
downloadsamba-d8cfca3a9bd2b6b6c562fd202377d95a98eb5472.tar.gz
samba-d8cfca3a9bd2b6b6c562fd202377d95a98eb5472.tar.bz2
samba-d8cfca3a9bd2b6b6c562fd202377d95a98eb5472.zip
s3: only include tdb headers where needed.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/groupdb/mapping.c1
-rw-r--r--source3/groupdb/mapping_tdb.c1
-rw-r--r--source3/include/ctdbd_conn.h2
-rw-r--r--source3/include/dbwrap.h2
-rw-r--r--source3/include/includes.h3
-rw-r--r--source3/include/printing.h7
-rw-r--r--source3/intl/lang_tdb.c1
-rw-r--r--source3/lib/ctdbd_conn.c1
-rw-r--r--source3/lib/dbwrap.c1
-rw-r--r--source3/lib/dbwrap_ctdb.c2
-rw-r--r--source3/lib/dbwrap_util.c1
-rw-r--r--source3/lib/eventlog/eventlog.c1
-rw-r--r--source3/lib/eventlog/eventlog.h2
-rw-r--r--source3/lib/g_lock.c1
-rw-r--r--source3/lib/gencache.c1
-rw-r--r--source3/lib/messages_ctdbd.c1
-rw-r--r--source3/lib/server_mutex.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/lib/talloc_dict.c1
-rw-r--r--source3/lib/tdb_validate.c1
-rw-r--r--source3/lib/util.c1
-rw-r--r--source3/lib/util_tdb.c2
-rw-r--r--source3/libnet/libnet_dssync_passdb.c1
-rw-r--r--source3/libsmb/samlogon_cache.c1
-rw-r--r--source3/libsmb/smb_share_modes.c1
-rw-r--r--source3/locking/locking.c1
-rw-r--r--source3/locking/posix.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/nmbd/nmbd_winsserver.c1
-rw-r--r--source3/param/loadparm.c1
-rw-r--r--source3/passdb/login_cache.c1
-rw-r--r--source3/passdb/machine_account_secrets.c1
-rw-r--r--source3/passdb/passdb.c1
-rw-r--r--source3/passdb/pdb_tdb.c1
-rw-r--r--source3/passdb/secrets.c1
-rw-r--r--source3/printing/notify.c1
-rw-r--r--source3/printing/nt_printing_migrate.c1
-rw-r--r--source3/printing/nt_printing_tdb.c1
-rw-r--r--source3/printing/printer_list.c1
-rw-r--r--source3/printing/printing.c1
-rw-r--r--source3/printing/printing_db.c3
-rw-r--r--source3/printing/tests/vlp.c1
-rw-r--r--source3/registry/reg_backend_db.c1
-rw-r--r--source3/registry/reg_objects.c1
-rw-r--r--source3/registry/reg_perfcount.c1
-rw-r--r--source3/rpc_server/eventlog/srv_eventlog_nt.c1
-rw-r--r--source3/rpc_server/spoolss/srv_spoolss_nt.c1
-rw-r--r--source3/smbd/files.c1
-rw-r--r--source3/smbd/globals.c1
-rw-r--r--source3/smbd/globals.h3
-rw-r--r--source3/smbd/mangle_hash.c1
-rw-r--r--source3/smbd/notify_internal.c1
-rw-r--r--source3/smbd/proto.h3
-rw-r--r--source3/smbd/statcache.c3
-rw-r--r--source3/torture/mangle_test.c1
-rw-r--r--source3/torture/torture.c1
-rw-r--r--source3/utils/net_idmap.c1
-rw-r--r--source3/utils/net_idmap_check.c1
-rw-r--r--source3/utils/net_printing.c1
-rw-r--r--source3/utils/smbcontrol.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
-rw-r--r--source3/winbindd/winbindd_cache.c1
68 files changed, 81 insertions, 8 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index d35f3c5f34..04af27bcf3 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -26,6 +26,7 @@
#include "groupdb/mapping.h"
#include "../libcli/security/security.h"
#include "lib/winbind_util.h"
+#include <tdb.h>
static const struct mapping_backend *backend;
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index 1137b8f658..60cdbf1447 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 "util_tdb.h"
#include "../libcli/security/security.h"
static struct db_context *db; /* used for driver files */
diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h
index ef291fb4ad..36b6542da0 100644
--- a/source3/include/ctdbd_conn.h
+++ b/source3/include/ctdbd_conn.h
@@ -20,6 +20,8 @@
#ifndef _CTDBD_CONN_H
#define _CTDBD_CONN_H
+#include <tdb.h>
+
struct ctdbd_connection;
struct messaging_context;
struct messaging_rec;
diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h
index ef35b0071d..d657ee7f30 100644
--- a/source3/include/dbwrap.h
+++ b/source3/include/dbwrap.h
@@ -20,6 +20,8 @@
#ifndef __DBWRAP_H__
#define __DBWRAP_H__
+#include <tdb.h>
+
struct db_record {
TDB_DATA key, value;
NTSTATUS (*store)(struct db_record *rec, TDB_DATA data, int flag);
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 59aa45afd7..ddac6d02d1 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -510,8 +510,6 @@ typedef char fstring[FSTRING_LEN];
#include "../lib/util/attr.h"
#include "../lib/util/tsort.h"
#include "../lib/util/dlinklist.h"
-#include <tdb.h>
-#include "util_tdb.h"
#include <talloc.h>
@@ -522,6 +520,7 @@ typedef char fstring[FSTRING_LEN];
#include "../lib/util/debug.h"
#include "../lib/util/debug_s3.h"
+#include "../libcli/util/ntstatus.h"
#include "libads/ads_status.h"
#include "../libcli/util/error.h"
#include "../lib/util/charset/charset.h"
diff --git a/source3/include/printing.h b/source3/include/printing.h
index 084c699c5b..bba7d53a16 100644
--- a/source3/include/printing.h
+++ b/source3/include/printing.h
@@ -158,9 +158,12 @@ extern struct printif iprint_printif;
/* There can be this many printing tdb's open, plus any locked ones. */
#define MAX_PRINT_DBS_OPEN 1
+struct TDB_DATA;
+struct tdb_context;
+
struct tdb_print_db {
struct tdb_print_db *next, *prev;
- TDB_CONTEXT *tdb;
+ struct tdb_context *tdb;
int ref_count;
fstring printer_name;
};
@@ -249,7 +252,7 @@ uint32_t print_parse_jobid(const char *fname);
struct tdb_print_db *get_print_db_byname(const char *printername);
void release_print_db( struct tdb_print_db *pdb);
void close_all_print_db(void);
-TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, bool cleanlist);
+struct TDB_DATA get_printer_notify_pid_list(struct tdb_context *tdb, const char *printer_name, bool cleanlist);
void print_queue_receive(struct messaging_context *msg,
void *private_data,
diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c
index 15793b7828..c6206c16e4 100644
--- a/source3/intl/lang_tdb.c
+++ b/source3/intl/lang_tdb.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "intl/lang_tdb.h"
+#include "util_tdb.h"
static TDB_CONTEXT *tdb;
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 9c353baba4..d27186996e 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "util_tdb.h"
#ifdef CLUSTER_SUPPORT
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c
index 4e7346c2c4..9b3197f402 100644
--- a/source3/lib/dbwrap.c
+++ b/source3/lib/dbwrap.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "dbwrap.h"
+#include "util_tdb.h"
#ifdef CLUSTER_SUPPORT
#include "ctdb_private.h"
#endif
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index f9a7dd6a6f..298f4c16a5 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -20,6 +20,8 @@
#include "includes.h"
#include "system/filesys.h"
+#include "lib/util/tdb_wrap.h"
+#include "util_tdb.h"
#ifdef CLUSTER_SUPPORT
#include "ctdb.h"
#include "ctdb_private.h"
diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c
index 35f8a14d0d..365f0a0666 100644
--- a/source3/lib/dbwrap_util.c
+++ b/source3/lib/dbwrap_util.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "dbwrap.h"
+#include "util_tdb.h"
int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr)
{
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index 4941199c5e..0ff0cb1fa8 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -24,6 +24,7 @@
#include "system/filesys.h"
#include "lib/eventlog/eventlog.h"
#include "../libcli/security/security.h"
+#include "util_tdb.h"
/* maintain a list of open eventlog tdbs with reference counts */
diff --git a/source3/lib/eventlog/eventlog.h b/source3/lib/eventlog/eventlog.h
index 29c25c3122..b485bfe08e 100644
--- a/source3/lib/eventlog/eventlog.h
+++ b/source3/lib/eventlog/eventlog.h
@@ -17,6 +17,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+#include <tdb.h>
+
/* Defines for TDB keys */
#define EVT_OLDEST_ENTRY "INFO/oldest_entry"
#define EVT_NEXT_RECORD "INFO/next_record"
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 184da9b4fd..c3d863f9a4 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 "g_lock.h"
+#include "util_tdb.h"
#include "ctdbd_conn.h"
#include "../lib/util/select.h"
#include "system/select.h"
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 19cc7c947c..7a86063de5 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "system/glob.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_TDB
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 3e2fde0b8f..70f29b795e 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -19,6 +19,7 @@
#include "includes.h"
#include "messages.h"
+#include "util_tdb.h"
#ifdef CLUSTER_SUPPORT
diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c
index 9d38907a20..6eac3182be 100644
--- a/source3/lib/server_mutex.c
+++ b/source3/lib/server_mutex.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "lib/util/tdb_wrap.h"
+#include "util_tdb.h"
/* For reasons known only to MS, many of their NT/Win2k versions
need serialised access only. Two connections at the same time
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index 7105e179d7..b1f6a5711e 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "serverid.h"
+#include "util_tdb.h"
#include "dbwrap.h"
#include "lib/util/tdb_wrap.h"
diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c
index ab54ec9ca5..de3ccab26a 100644
--- a/source3/lib/sessionid_tdb.c
+++ b/source3/lib/sessionid_tdb.c
@@ -21,6 +21,7 @@
#include "system/filesys.h"
#include "dbwrap.h"
#include "session.h"
+#include "util_tdb.h"
static struct db_context *session_db_ctx(void)
{
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c
index c84e8fa00b..c2494e2293 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 "util_tdb.h"
/*******************************************************************
Create the share security tdb.
diff --git a/source3/lib/talloc_dict.c b/source3/lib/talloc_dict.c
index cbe5c7b5c2..95ae0a3260 100644
--- a/source3/lib/talloc_dict.c
+++ b/source3/lib/talloc_dict.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "dbwrap.h"
#include "talloc_dict.h"
+#include "util_tdb.h"
struct talloc_dict {
struct db_context *db;
diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c
index b91ea7af83..7dd7dae5ac 100644
--- a/source3/lib/tdb_validate.c
+++ b/source3/lib/tdb_validate.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "system/filesys.h"
+#include "util_tdb.h"
#include "tdb_validate.h"
/*
diff --git a/source3/lib/util.c b/source3/lib/util.c
index db92f3c0d7..8d90569863 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "system/passwd.h"
#include "system/filesys.h"
+#include "util_tdb.h"
#include "ctdbd_conn.h"
#include "../lib/util/util_pw.h"
#include "messages.h"
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index 2aff935bdf..654a538a88 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -21,6 +21,8 @@
#include "includes.h"
#include "system/filesys.h"
+#include "util_tdb.h"
+
#undef malloc
#undef realloc
#undef calloc
diff --git a/source3/libnet/libnet_dssync_passdb.c b/source3/libnet/libnet_dssync_passdb.c
index 349b25a987..b8675d3d98 100644
--- a/source3/libnet/libnet_dssync_passdb.c
+++ b/source3/libnet/libnet_dssync_passdb.c
@@ -23,6 +23,7 @@
#include "../libcli/security/security.h"
#include "../libds/common/flags.h"
#include "../librpc/gen_ndr/ndr_drsuapi.h"
+#include "util_tdb.h"
#include "dbwrap.h"
#include "../libds/common/flag_mapping.h"
#include "passdb.h"
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c
index facdbc7dc1..590c950a9c 100644
--- a/source3/libsmb/samlogon_cache.c
+++ b/source3/libsmb/samlogon_cache.c
@@ -25,6 +25,7 @@
#include "system/filesys.h"
#include "librpc/gen_ndr/ndr_krb5pac.h"
#include "../libcli/security/security.h"
+#include "util_tdb.h"
#define NETSAMLOGON_TDB "netsamlogon_cache.tdb"
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 1a6c2123ed..76e63e6968 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -27,6 +27,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "smb_share_modes.h"
+#include <tdb.h>
/* Database context handle. */
struct smbdb_ctx {
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 1f63bdd4c4..9bb3b9cf2e 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -43,6 +43,7 @@
#include "../libcli/security/security.h"
#include "serverid.h"
#include "messages.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LOCKING
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index cea8d2f8a2..3f1aa6da57 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -25,6 +25,7 @@
#include "system/filesys.h"
#include "locking/proto.h"
#include "dbwrap.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_LOCKING
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 14d464451f..91e98f6be8 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -26,6 +26,7 @@
#include "include/dbwrap.h"
#include "system/filesys.h"
#include "passdb/lookup_sid.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_ACLS
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index f2e0415293..1e3313120c 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -28,6 +28,7 @@
#include "../lib/crypto/crypto.h"
#include "dbwrap.h"
#include "auth.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index b8281dda21..2cfea9cacd 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 "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index 976b99023e..d569154719 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "nmbd/nmbd.h"
+#include "util_tdb.h"
#define WINS_LIST "wins.dat"
#define WINS_VERSION 1
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index cfe8668772..bf504a41b7 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -53,6 +53,7 @@
#include "includes.h"
#include "system/filesys.h"
+#include "util_tdb.h"
#include "printing.h"
#include "lib/smbconf/smbconf.h"
#include "lib/smbconf/smbconf_init.h"
diff --git a/source3/passdb/login_cache.c b/source3/passdb/login_cache.c
index 1785a4daca..629f8a7d5e 100644
--- a/source3/passdb/login_cache.c
+++ b/source3/passdb/login_cache.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "passdb.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c
index a51a99c9a2..61894d4ee6 100644
--- a/source3/passdb/machine_account_secrets.c
+++ b/source3/passdb/machine_account_secrets.c
@@ -28,6 +28,7 @@
#include "secrets.h"
#include "dbwrap.h"
#include "../librpc/ndr/libndr.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index a2fc12ae4b..992f1b8741 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -29,6 +29,7 @@
#include "secrets.h"
#include "../libcli/security/security.h"
#include "../lib/util/util_pw.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 79c0ed196a..28461d0ac3 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -27,6 +27,7 @@
#include "passdb.h"
#include "dbwrap.h"
#include "../libcli/security/security.h"
+#include "util_tdb.h"
#if 0 /* when made a module use this */
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index c16d15807b..8d544f1240 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -30,6 +30,7 @@
#include "secrets.h"
#include "dbwrap.h"
#include "../libcli/security/security.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index 9e4b740859..0c7236ef3b 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -25,6 +25,7 @@
#include "nt_printing.h"
#include "printing/notify.h"
#include "messages.h"
+#include "util_tdb.h"
static TALLOC_CTX *send_ctx;
diff --git a/source3/printing/nt_printing_migrate.c b/source3/printing/nt_printing_migrate.c
index 7c8736875b..5fd0aae7fc 100644
--- a/source3/printing/nt_printing_migrate.c
+++ b/source3/printing/nt_printing_migrate.c
@@ -28,6 +28,7 @@
#include "librpc/gen_ndr/ndr_security.h"
#include "rpc_server/rpc_ncacn_np.h"
#include "auth.h"
+#include "util_tdb.h"
#define FORMS_PREFIX "FORMS/"
#define DRIVERS_PREFIX "DRIVERS/"
diff --git a/source3/printing/nt_printing_tdb.c b/source3/printing/nt_printing_tdb.c
index 98ac46797f..e321b905d5 100644
--- a/source3/printing/nt_printing_tdb.c
+++ b/source3/printing/nt_printing_tdb.c
@@ -26,6 +26,7 @@
#include "librpc/gen_ndr/spoolss.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "libcli/security/security.h"
+#include "util_tdb.h"
#define FORMS_PREFIX "FORMS/"
#define DRIVERS_PREFIX "DRIVERS/"
diff --git a/source3/printing/printer_list.c b/source3/printing/printer_list.c
index 417eea777b..d8be89363e 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 "util_tdb.h"
#include "printer_list.h"
#define PL_DB_NAME() lock_path("printer_list.tdb")
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 785e893d3a..f15bd4f754 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -32,6 +32,7 @@
#include "smbd/smbd.h"
#include "auth.h"
#include "messages.h"
+#include "util_tdb.h"
extern struct current_user current_user;
extern userdom_struct current_user_info;
diff --git a/source3/printing/printing_db.c b/source3/printing/printing_db.c
index 70accab935..b836c2145b 100644
--- a/source3/printing/printing_db.c
+++ b/source3/printing/printing_db.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "printing.h"
+#include "util_tdb.h"
static struct tdb_print_db *print_db_head;
@@ -159,7 +160,7 @@ void close_all_print_db(void)
messages. data needs freeing on exit.
****************************************************************************/
-TDB_DATA get_printer_notify_pid_list(TDB_CONTEXT *tdb, const char *printer_name, bool cleanlist)
+struct TDB_DATA get_printer_notify_pid_list(struct tdb_context *tdb, const char *printer_name, bool cleanlist)
{
TDB_DATA data;
size_t i;
diff --git a/source3/printing/tests/vlp.c b/source3/printing/tests/vlp.c
index 4bff290e28..b22050632e 100644
--- a/source3/printing/tests/vlp.c
+++ b/source3/printing/tests/vlp.c
@@ -23,6 +23,7 @@
#include "system/passwd.h"
#include "system/filesys.h"
#include "printing.h"
+#include "util_tdb.h"
#ifdef malloc
#undef malloc
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 6024a354c4..df0cb7f81e 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -28,6 +28,7 @@
#include "reg_backend_db.h"
#include "reg_objects.h"
#include "nt_printing.h"
+#include "util_tdb.h"
#include "dbwrap.h"
#undef DBGC_CLASS
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index 0fab3f7d8b..980986f95b 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -23,6 +23,7 @@
#include "includes.h"
#include "registry.h"
#include "reg_objects.h"
+#include "util_tdb.h"
#include "dbwrap.h"
#include "../libcli/registry/util_reg.h"
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c
index 4ed3305c15..8a2b444e01 100644
--- a/source3/registry/reg_perfcount.c
+++ b/source3/registry/reg_perfcount.c
@@ -25,6 +25,7 @@
#include "registry.h"
#include "reg_perfcount.h"
#include "../libcli/registry/util_reg.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_REGISTRY
diff --git a/source3/rpc_server/eventlog/srv_eventlog_nt.c b/source3/rpc_server/eventlog/srv_eventlog_nt.c
index b63d1ab5f5..b4c59ba517 100644
--- a/source3/rpc_server/eventlog/srv_eventlog_nt.c
+++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c
@@ -30,6 +30,7 @@
#include "rpc_client/cli_winreg.h"
#include "smbd/smbd.h"
#include "auth.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 720564f88d..c88faa363f 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -50,6 +50,7 @@
#include "auth.h"
#include "messages.h"
#include "rpc_server/spoolss/srv_spoolss_nt.h"
+#include "util_tdb.h"
/* macros stolen from s4 spoolss server */
#define SPOOLSS_BUFFER_UNION(fn,info,level) \
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index b9063ccbb8..bdf85dbfc3 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -21,6 +21,7 @@
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "libcli/security/security.h"
+#include "util_tdb.h"
#define VALID_FNUM(fnum) (((fnum) >= 0) && ((fnum) < real_max_open_files))
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 63c1f5dcb5..8e6f46fe5c 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -22,6 +22,7 @@
#include "smbd/globals.h"
#include "memcache.h"
#include "messages.h"
+#include <tdb.h>
#if defined(WITH_AIO)
struct aio_extra *aio_list_head = NULL;
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 01be31a57f..97d75fd413 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -47,7 +47,8 @@ struct fsp_singleton_cache {
extern const struct mangle_fns *mangle_fns;
extern unsigned char *chartest;
-extern TDB_CONTEXT *tdb_mangled_cache;
+struct tdb_context;
+extern struct tdb_context *tdb_mangled_cache;
/*
this determines how many characters are used from the original filename
diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c
index 0451809cac..575c35e458 100644
--- a/source3/smbd/mangle_hash.c
+++ b/source3/smbd/mangle_hash.c
@@ -25,6 +25,7 @@
#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "mangle.h"
+#include "util_tdb.h"
/* -------------------------------------------------------------------------- **
* Other stuff...
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index 176fa863a5..3098502218 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -30,6 +30,7 @@
#include "smbd/smbd.h"
#include "messages.h"
#include "lib/util/tdb_wrap.h"
+#include "util_tdb.h"
struct notify_context {
struct db_context *db_recursive;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 2ea01c2a5e..1f2b1a9cff 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -999,7 +999,8 @@ bool stat_cache_lookup(connection_struct *conn,
void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
const char *name);
void stat_cache_delete(const char *name);
-unsigned int fast_string_hash(TDB_DATA *key);
+struct TDB_DATA;
+unsigned int fast_string_hash(struct TDB_DATA *key);
bool reset_stat_cache( void );
/* The following definitions come from smbd/statvfs.c */
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index 5c74b92855..e2ccc74a87 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -25,6 +25,7 @@
#include "smbd/smbd.h"
#include "messages.h"
#include "smbprofile.h"
+#include <tdb.h>
/****************************************************************************
Stat cache code used in unix_convert.
@@ -376,7 +377,7 @@ void stat_cache_delete(const char *name)
JRA. Use a djb-algorithm hash for speed.
***************************************************************/
-unsigned int fast_string_hash(TDB_DATA *key)
+unsigned int fast_string_hash(struct TDB_DATA *key)
{
unsigned int n = 0;
const char *p;
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index 2794b4b57e..becb30ad11 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -21,6 +21,7 @@
#include "system/filesys.h"
#include "torture/proto.h"
#include "libsmb/clirap.h"
+#include "util_tdb.h"
extern int torture_numops;
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index fe9a5cb093..f16b5a748e 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -35,6 +35,7 @@
#include "trans2.h"
#include "libsmb/nmblib.h"
#include "../lib/util/tevent_ntstatus.h"
+#include "util_tdb.h"
extern char *optarg;
extern int optind;
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index e059a6432c..383035e906 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -25,6 +25,7 @@
#include "dbwrap.h"
#include "../libcli/security/security.h"
#include "net_idmap_check.h"
+#include "util_tdb.h"
#define ALLOC_CHECK(mem) do { \
if (!mem) { \
diff --git a/source3/utils/net_idmap_check.c b/source3/utils/net_idmap_check.c
index 88725e18a6..e406a65679 100644
--- a/source3/utils/net_idmap_check.c
+++ b/source3/utils/net_idmap_check.c
@@ -32,6 +32,7 @@
#include "cbuf.h"
#include "srprs.h"
#include <termios.h>
+#include "util_tdb.h"
static int traverse_commit(struct db_record *diff_rec, void* data);
static int traverse_check(struct db_record *rec, void* data);
diff --git a/source3/utils/net_printing.c b/source3/utils/net_printing.c
index ade399bf44..3e70f1a86f 100644
--- a/source3/utils/net_printing.c
+++ b/source3/utils/net_printing.c
@@ -28,6 +28,7 @@
#include "rpc_client/cli_spoolss.h"
#include "../libcli/security/security.h"
#include "../librpc/gen_ndr/ndr_security.h"
+#include "util_tdb.h"
#define FORMS_PREFIX "FORMS/"
#define DRIVERS_PREFIX "DRIVERS/"
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 0c14985bad..5bf5c5da7b 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -31,6 +31,7 @@
#include "printing/notify.h"
#include "libsmb/nmblib.h"
#include "messages.h"
+#include "util_tdb.h"
#if HAVE_LIBUNWIND_H
#include <libunwind.h>
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index 5e3dacf624..1f4af33510 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -28,6 +28,7 @@
#include "dbwrap.h"
#include "idmap.h"
#include "../libcli/security/dom_sid.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_IDMAP
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index 19e7f0e1d5..57a5e1c6ba 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -30,6 +30,7 @@
#include "idmap_rw.h"
#include "dbwrap.h"
#include "../libcli/security/security.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_IDMAP
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 1a5a51a5b4..2a15244459 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -38,6 +38,7 @@
#include "idmap_rw.h"
#include "dbwrap.h"
#include "../libcli/security/dom_sid.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_IDMAP
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 4fa2375152..d733be0672 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -33,6 +33,7 @@
#include "nss_info.h"
#include "../libcli/security/security.h"
#include "passdb/machine_sid.h"
+#include "util_tdb.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND