summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c4
-rw-r--r--source4/lib/ldb/common/ldb.c4
-rw-r--r--source4/lib/ldb/common/ldb_attributes.c3
-rw-r--r--source4/lib/ldb/common/ldb_controls.c4
-rw-r--r--source4/lib/ldb/common/ldb_debug.c4
-rw-r--r--source4/lib/ldb/common/ldb_dn.c4
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c7
-rw-r--r--source4/lib/ldb/common/ldb_match.c4
-rw-r--r--source4/lib/ldb/common/ldb_modules.c12
-rw-r--r--source4/lib/ldb/common/ldb_msg.c5
-rw-r--r--source4/lib/ldb/common/ldb_parse.c6
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c4
-rw-r--r--source4/lib/ldb/common/qsort.c9
-rw-r--r--source4/lib/ldb/include/includes.h23
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c5
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c7
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c8
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c4
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c5
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_pack.c4
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c5
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c5
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c4
-rw-r--r--source4/lib/ldb/modules/ldb_map.c5
-rw-r--r--source4/lib/ldb/modules/objectclass.c5
-rw-r--r--source4/lib/ldb/modules/operational.c6
-rw-r--r--source4/lib/ldb/modules/paged_results.c6
-rw-r--r--source4/lib/ldb/modules/rdn_name.c4
-rw-r--r--source4/lib/ldb/modules/schema.c4
-rw-r--r--source4/lib/ldb/modules/skel.c3
-rw-r--r--source4/lib/ldb/modules/sort.c4
-rw-r--r--source4/lib/ldb/samba/ldif_handlers.c4
-rw-r--r--source4/lib/ldb/tools/cmdline.c4
-rw-r--r--source4/lib/ldb/tools/ldbadd.c8
-rw-r--r--source4/lib/ldb/tools/ldbdel.c8
-rw-r--r--source4/lib/ldb/tools/ldbedit.c8
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c7
-rw-r--r--source4/lib/ldb/tools/ldbrename.c7
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c8
-rw-r--r--source4/lib/ldb/tools/ldbtest.c9
-rw-r--r--source4/lib/ldb/tools/oLschema2ldif.c9
41 files changed, 78 insertions, 171 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 4826ead946..2109e9b2da 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -27,9 +27,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-#include <ctype.h>
+#include "ldb/include/includes.h"
/*
default handler that just copies a ldb_val.
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 78e6a74425..41b1a3efb7 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -33,9 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
/*
initialise a ldb context
diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c
index bf955ece3d..13e721a266 100644
--- a/source4/lib/ldb/common/ldb_attributes.c
+++ b/source4/lib/ldb/common/ldb_attributes.c
@@ -30,8 +30,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
/*
add to the list of ldif handlers for this ldb context
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c
index e4c4c64a6f..d2729c82ab 100644
--- a/source4/lib/ldb/common/ldb_controls.c
+++ b/source4/lib/ldb/common/ldb_controls.c
@@ -33,9 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
/* check if a control with the specified "oid" exist and return it */
/* returns NULL if not found */
diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c
index d046c8cd1f..21b02956b8 100644
--- a/source4/lib/ldb/common/ldb_debug.c
+++ b/source4/lib/ldb/common/ldb_debug.c
@@ -33,9 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-
+#include "ldb/include/includes.h"
/*
this allows the user to choose their own debug function
diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index 4164814f4f..e0c6f4a103 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -35,9 +35,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-#include <ctype.h>
+#include "ldb/include/includes.h"
#define LDB_DN_NULL_FAILED(x) if (!(x)) goto failed
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 7ba6a00147..53dadcc6fe 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -37,12 +37,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-#include <ctype.h>
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
+#include "ldb/include/includes.h"
/*
diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c
index 84f051f497..810191c5ec 100644
--- a/source4/lib/ldb/common/ldb_match.c
+++ b/source4/lib/ldb/common/ldb_match.c
@@ -34,9 +34,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-
+#include "ldb/include/includes.h"
/*
check if the scope matches in a search result
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index f83f0b06ef..804bd654f3 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -34,17 +34,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
-#include "dlinklist.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#ifdef HAVE_DLOPEN_DISABLED
-#include <dlfcn.h>
-#endif
+#include "ldb/include/includes.h"
#define LDB_MODULE_PREFIX "modules:"
#define LDB_MODULE_PREFIX_LEN 8
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index deb32133c1..513a4de1f8 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -33,10 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
-#include <time.h>
+#include "ldb/include/includes.h"
/*
create a new ldb_message in a given memory context (NULL for top level)
diff --git a/source4/lib/ldb/common/ldb_parse.c b/source4/lib/ldb/common/ldb_parse.c
index 25e4b727df..52e7522b85 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -42,9 +42,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include <ctype.h>
-
+#include "ldb/include/includes.h"
/*
a filter is defined by:
@@ -135,7 +133,7 @@ char *ldb_binary_encode(void *mem_ctx, struct ldb_val val)
char *ldb_binary_encode_string(void *mem_ctx, const char *string)
{
struct ldb_val val;
- val.data = string;
+ val.data = discard_const(string);
val.length = strlen(string);
return ldb_binary_encode(mem_ctx, val);
}
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index a0aad12658..4a29ac45f7 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -33,9 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-#include <ctype.h>
+#include "ldb/include/includes.h"
/*
TODO:
diff --git a/source4/lib/ldb/common/qsort.c b/source4/lib/ldb/common/qsort.c
index 7b8dc55167..ef7be2c14e 100644
--- a/source4/lib/ldb/common/qsort.c
+++ b/source4/lib/ldb/common/qsort.c
@@ -26,11 +26,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
+#include "ldb/include/includes.h"
/* Byte-wise swap two items of size SIZE. */
#define SWAP(a, b, size) \
@@ -62,6 +58,9 @@ typedef struct
log(MAX_THRESH)). Since total_elements has type size_t, we get as
upper bound for log (total_elements):
bits per byte (CHAR_BIT) * sizeof(size_t). */
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
#define STACK_SIZE (CHAR_BIT * sizeof(size_t))
#define PUSH(low, high) ((void) ((top->lo = (low)), (top->hi = (high)), ++top))
#define POP(low, high) ((void) (--top, (low = top->lo), (high = top->hi)))
diff --git a/source4/lib/ldb/include/includes.h b/source4/lib/ldb/include/includes.h
index 4372d6b3f9..15eb18a5e8 100644
--- a/source4/lib/ldb/include/includes.h
+++ b/source4/lib/ldb/include/includes.h
@@ -1,7 +1,17 @@
+#ifndef _LDB_PRIVATE_INCLUDES_H_
+#define _LDB_PRIVATE_INCLUDES_H_
/*
a temporary includes file until I work on the ldb build system
*/
+#ifdef _SAMBA_BUILD_
+
+#include "system/filesys.h"
+#include "system/iconv.h"
+#include "system/time.h"
+
+#else /*_SAMBA_BUILD_*/
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
@@ -22,9 +32,16 @@
#include <stdint.h>
#endif
+#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
+
+#include "talloc.h"
+
+#endif /*_SAMBA_BUILD_*/
+
#include "ldb.h"
+#include "ldb_errors.h"
#include "ldb_private.h"
-#include "talloc.h"
+#include "dlinklist.h"
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
-#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
+#endif /*_LDB_PRIVATE_INCLUDES_H_*/
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index 2837296b68..a6a5822c9e 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -30,9 +30,8 @@
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-#include "ldb/include/ldb_errors.h"
+#include "ldb/include/includes.h"
+
#include "libcli/ldap/ldap.h"
#include "libcli/ldap/ldap_client.h"
#include "lib/cmdline/popt_common.h"
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index dffd0e969c..7233498eb3 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -33,9 +33,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_ldap/ldb_ldap.h"
/*
@@ -492,7 +491,7 @@ static int lldb_request(struct ldb_module *module, struct ldb_request *req)
req->op.search.scope,
req->op.search.tree,
req->op.search.attrs,
- req->op.search.res);
+ &req->op.search.res);
case LDB_REQ_ADD:
return lldb_add(module, req->op.add.message);
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index 2e8b88a090..4c00998fa9 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -33,11 +33,9 @@
* Author: Derrell Lipman (based on Andrew Tridgell's LDAP backend)
*/
-#include <stdarg.h>
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_sqlite3/ldb_sqlite3.h"
/*
@@ -818,7 +816,7 @@ static int lsqlite3_search_bytree(struct ldb_module * module, const struct ldb_d
char *norm_basedn;
char *sqlfilter;
char *errmsg;
- char *query;
+ char *query = NULL;
int ret, i;
/* create a local ctx */
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index 01f9338009..cfbe7b2ab3 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -33,8 +33,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_tdb/ldb_tdb.h"
#define LTDB_FLAG_CASE_INSENSITIVE (1<<0)
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index cf9ad3b7fe..93d0ebd6e9 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -33,9 +33,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_tdb/ldb_tdb.h"
/*
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index b037fe272a..e8654f7a53 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c
@@ -33,8 +33,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_tdb/ldb_tdb.h"
/* change this if the data format ever changes */
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index aa5cb40712..6701d1bd11 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -33,9 +33,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_tdb/ldb_tdb.h"
/*
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 0a9a99ccea..1be11bc64c 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -36,9 +36,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_tdb/ldb_tdb.h"
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
index 3a18f5df88..d4fc67c2d4 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
@@ -23,8 +23,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/ldb_tdb/ldb_tdb.h"
/*
diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c
index b056521f9f..4c2ef5b239 100644
--- a/source4/lib/ldb/modules/ldb_map.c
+++ b/source4/lib/ldb/modules/ldb_map.c
@@ -23,9 +23,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "ldb/modules/ldb_map.h"
/*
diff --git a/source4/lib/ldb/modules/objectclass.c b/source4/lib/ldb/modules/objectclass.c
index c38b3167e8..479d943a91 100644
--- a/source4/lib/ldb/modules/objectclass.c
+++ b/source4/lib/ldb/modules/objectclass.c
@@ -33,10 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/dlinklist.h"
+#include "ldb/include/includes.h"
/* It turns out the MMC assumes that the last objectClass in the list
* is the most specific subclass. As such, we must sort the list,
diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c
index 65d9f12e34..3deb9422f3 100644
--- a/source4/lib/ldb/modules/operational.c
+++ b/source4/lib/ldb/modules/operational.c
@@ -73,12 +73,8 @@
modifiersName: not supported by w2k3?
*/
-
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
-#include <time.h>
+#include "ldb/include/includes.h"
/*
construct a canonical name from a message
diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c
index 8e9fc28348..5e88052990 100644
--- a/source4/lib/ldb/modules/paged_results.c
+++ b/source4/lib/ldb/modules/paged_results.c
@@ -34,11 +34,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
-
-#include <time.h>
+#include "ldb/include/includes.h"
struct results_store {
char *cookie;
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index f35cff916c..1ac404bea6 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -33,9 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
-#include <time.h>
+#include "ldb/include/includes.h"
static struct ldb_message_element *rdn_name_find_attribute(const struct ldb_message *msg, const char *name)
{
diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c
index 9fb2efee30..9bf9a4d2c5 100644
--- a/source4/lib/ldb/modules/schema.c
+++ b/source4/lib/ldb/modules/schema.c
@@ -33,9 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#define SCHEMA_FLAG_RESET 0
#define SCHEMA_FLAG_MOD_MASK 0x003
diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c
index 10f730b2f9..e9b76be2ba 100644
--- a/source4/lib/ldb/modules/skel.c
+++ b/source4/lib/ldb/modules/skel.c
@@ -33,8 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
struct private_data {
diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c
index 88b967b276..9a0d449cf7 100644
--- a/source4/lib/ldb/modules/sort.c
+++ b/source4/lib/ldb/modules/sort.c
@@ -33,9 +33,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
struct opaque {
struct ldb_context *ldb;
diff --git a/source4/lib/ldb/samba/ldif_handlers.c b/source4/lib/ldb/samba/ldif_handlers.c
index 84270195dc..85f6b22756 100644
--- a/source4/lib/ldb/samba/ldif_handlers.c
+++ b/source4/lib/ldb/samba/ldif_handlers.c
@@ -23,8 +23,8 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
+
#include "librpc/gen_ndr/ndr_security.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "dsdb/samdb/samdb.h"
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index d1ad79b7f6..9b24b83239 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -23,9 +23,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
+
#ifdef _SAMBA_BUILD_
#include "lib/cmdline/popt_common.h"
#include "auth/auth.h"
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c
index 058f4dc751..0d5acd3787 100644
--- a/source4/lib/ldb/tools/ldbadd.c
+++ b/source4/lib/ldb/tools/ldbadd.c
@@ -33,15 +33,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
-
static int failures;
static void usage(void)
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index 6da8d0269f..26544d8a9e 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -33,15 +33,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
-
static int ldb_delete_recursive(struct ldb_context *ldb, const struct ldb_dn *dn)
{
int ret, i, total=0;
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index 4d47cf27c9..24fcf1a969 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -33,15 +33,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
-
static struct ldb_cmdline *options;
/*
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index 4c78e485b5..e785a42a23 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -33,14 +33,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
-
static int failures;
static void usage(void)
diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c
index 4b3b27c130..9c37744277 100644
--- a/source4/lib/ldb/tools/ldbrename.c
+++ b/source4/lib/ldb/tools/ldbrename.c
@@ -35,14 +35,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
-
static void usage(void)
{
printf("Usage: ldbrename [<options>] <olddn> <newdn>\n");
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index b9ce1282a3..4ce974c6fa 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -33,15 +33,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
-
static void usage(void)
{
printf("Usage: ldbsearch <options> <expression> <attrs...>\n");
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 7abc1bfcef..f2efd4d22a 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -33,16 +33,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_errors.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#include "system/time.h"
-#endif
-
static struct timeval tp1,tp2;
static struct ldb_cmdline *options;
diff --git a/source4/lib/ldb/tools/oLschema2ldif.c b/source4/lib/ldb/tools/oLschema2ldif.c
index 0fcd531987..b4fe421161 100644
--- a/source4/lib/ldb/tools/oLschema2ldif.c
+++ b/source4/lib/ldb/tools/oLschema2ldif.c
@@ -33,16 +33,9 @@
*/
#include "includes.h"
-#include "ldb/include/ldb.h"
-#include "ldb/include/ldb_private.h"
+#include "ldb/include/includes.h"
#include "ldb/tools/cmdline.h"
-#include <stdio.h>
-
-#ifdef _SAMBA_BUILD_
-#include "system/filesys.h"
-#endif
-
#define SCHEMA_UNKNOWN 0
#define SCHEMA_NAME 1
#define SCHEMA_SUP 2