summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-05-05 11:25:29 +0200
committerKarolin Seeger <kseeger@samba.org>2011-05-17 09:19:40 +0200
commit6ba818bd8dcdfdf108755f3375eb087c655dde26 (patch)
treef2db21e54661e1f2b2be00966696b1621da2f6c4 /source3
parent7afa1f42c6a2c7e09fba8e51e3cacb56674c95cc (diff)
downloadsamba-6ba818bd8dcdfdf108755f3375eb087c655dde26.tar.gz
s3: only include tdb headers where needed.
Guenther (cherry picked from commit d8cfca3a9bd2b6b6c562fd202377d95a98eb5472) (cherry picked from commit 138da8f4b1eb4715b7fb259986b9c1e8ffae469e)
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 3646e04d0a3..c760dec4b4c 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 548d3a31c7b..a5fa1b7a249 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 ef291fb4ad6..36b6542da0d 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 ef35b0071d0..d657ee7f308 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 060f6fa6d1c..432e475ad2f 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 084c699c5bd..bba7d53a162 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 8fcb9f2bfc8..d6a196e9611 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 21bd96d3436..b928ed9f22c 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 4e7346c2c4f..9b3197f402e 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 f9a7dd6a6ff..298f4c16a54 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 35f8a14d0d4..365f0a06667 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 b3aa05c640a..5c57ac05cca 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 29c25c31222..b485bfe08e9 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 184da9b4fde..c3d863f9a44 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 67c37f34e73..f6ee0f3a43d 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 3e2fde0b8fd..70f29b795ec 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 9d38907a20c..6eac3182bee 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 7105e179d78..b1f6a5711ef 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 ab54ec9ca5f..de3ccab26ae 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 c84e8fa00b2..c2494e2293a 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 cbe5c7b5c2a..95ae0a3260d 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 b91ea7af834..7dd7dae5ac1 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 d39aace7b36..b4c91af098d 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 2aff935bdf0..654a538a884 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 f21abd57c65..37b08470dd9 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 facdbc7dc19..590c950a9cc 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 1a6c2123ed6..76e63e69689 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 232a8c37029..ba363501d8c 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 cea8d2f8a2e..3f1aa6da571 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 14d464451fa..91e98f6be83 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 f2e04152936..1e3313120ca 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 5b62565d62f..8892b8c7cdd 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 976b99023eb..d5691547198 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 8ac2601e22c..ca547175b7a 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 1785a4dacac..629f8a7d5e8 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 a51a99c9a2f..61894d4ee66 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 62af5be7eb4..c49fb247117 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 79c0ed196af..28461d0ac3d 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 c16d15807bd..8d544f12402 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 836f7df3d11..1060592d25f 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 1a16a60e50d..f56fa9a2f08 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 98ac46797fc..e321b905d5f 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 417eea777bb..d8be89363e5 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 785e893d3a5..f15bd4f754a 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 70accab9350..b836c2145b4 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 4bff290e28a..b22050632ea 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 fa79c687a3f..11bbe7ed36a 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 0fab3f7d8be..980986f95bf 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 4ed3305c158..8a2b444e012 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 b63d1ab5f55..b4c59ba5174 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 187cbaabc69..668317fedd3 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 b9063ccbb89..bdf85dbfc38 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 63c1f5dcb5d..8e6f46fe5cd 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 01be31a57f9..97d75fd4137 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 86d84ca68c6..adeb542c6ed 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 31ff3475d55..91e4a44b3ae 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 31defc65c9e..cff417b215e 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1004,7 +1004,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 5c74b928550..e2ccc74a87a 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 f76ef7eebf9..f30cba51410 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 4d0a839d137..76dd1c6a25b 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 e059a6432c0..383035e906c 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 88725e18a61..e406a65679e 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 11c87bb5b4f..7e728238d47 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 ea1b6815887..2759136657a 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 5e3dacf6240..1f4af335106 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 19e7f0e1d5f..57a5e1c6ba3 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 1a5a51a5b44..2a152444595 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 68a86257da2..4f902b5291a 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