r3783: - don't use make proto for ldb anymore
authorStefan Metzmacher <metze@samba.org>
Tue, 16 Nov 2004 09:00:52 +0000 (09:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:52 +0000 (13:05 -0500)
- split ldh.h out of samba's includes.h

- make ldb_context and ldb_module private to the subsystem

- use ltdb_ prefix for all ldb_tdb functions

metze

46 files changed:
source/auth/auth_sam.c
source/include/includes.h
source/include/structs.h
source/ldap_server/ldap_rootdse.c
source/ldap_server/ldap_simple_ldb.c
source/lib/db_wrap.c
source/lib/ldb/Makefile.ldb
source/lib/ldb/common/ldb.c
source/lib/ldb/common/ldb_alloc.c
source/lib/ldb/common/ldb_debug.c
source/lib/ldb/common/ldb_ldif.c
source/lib/ldb/common/ldb_modules.c
source/lib/ldb/common/ldb_msg.c
source/lib/ldb/common/ldb_parse.c
source/lib/ldb/common/ldb_utf8.c
source/lib/ldb/common/util.c
source/lib/ldb/config.mk
source/lib/ldb/include/includes.h
source/lib/ldb/include/ldb.h
source/lib/ldb/include/ldb_parse.h
source/lib/ldb/include/ldb_private.h [new file with mode: 0644]
source/lib/ldb/ldb_ldap/ldb_ldap.c
source/lib/ldb/ldb_tdb/ldb_cache.c
source/lib/ldb/ldb_tdb/ldb_index.c
source/lib/ldb/ldb_tdb/ldb_match.c
source/lib/ldb/ldb_tdb/ldb_pack.c
source/lib/ldb/ldb_tdb/ldb_search.c
source/lib/ldb/ldb_tdb/ldb_tdb.c
source/lib/ldb/ldb_tdb/ldb_tdb.h
source/lib/ldb/modules/skel.c
source/lib/ldb/modules/timestamps.c
source/lib/ldb/tools/ldbadd.c
source/lib/ldb/tools/ldbdel.c
source/lib/ldb/tools/ldbedit.c
source/lib/ldb/tools/ldbmodify.c
source/lib/ldb/tools/ldbrename.c
source/lib/ldb/tools/ldbsearch.c
source/lib/ldb/tools/ldbtest.c
source/lib/registry/reg_backend_ldb/reg_backend_ldb.c
source/rpc_server/common/gendb.c
source/rpc_server/netlogon/dcerpc_netlogon.c
source/rpc_server/netlogon/schannel_state.c
source/rpc_server/samr/dcesrv_samr.c
source/rpc_server/samr/samdb.c
source/rpc_server/samr/samr_password.c
source/rpc_server/spoolss/spoolssdb.c

index 7cba6e83b3f6162042f68f1897e8c1af30a238c4..501b5ca080898b42de717b202e7a8037c05ce6b6 100644 (file)
@@ -23,6 +23,7 @@
 #include "librpc/gen_ndr/ndr_samr.h"
 #include "system/time.h"
 #include "auth/auth.h"
+#include "lib/ldb/include/ldb.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
index c7cc1338f5d243f3f6249ffcfc347b172c1cfb88..10516f8989f530fb072b0ed13a16a95e4a2c5a95 100644 (file)
@@ -155,12 +155,12 @@ extern int errno;
 #include "version.h"
 #include "xfile.h"
 #include "talloc.h"
-#include "lib/ldb/include/ldb.h"
+#include "nt_status.h"
+#include "structs.h"
 #include "lib/tdb/include/tdb.h"
 #include "lib/tdb/include/spinlock.h"
 #include "lib/tdb/include/tdbutil.h"
 #include "db_wrap.h"
-#include "nt_status.h"
 #include "trans2.h"
 #include "nterr.h"
 #include "charset.h"
@@ -188,7 +188,6 @@ extern int errno;
 #include "smb_interfaces.h"
 #include "smbd/server.h"
 #include "smbd/service.h"
-#include "structs.h"
 #include "ntvfs/ntvfs.h"
 #include "cli_context.h"
 #include "nsswitch/winbind_client.h"
index 229c4890723fdfbb709f65ca0e951e7872a85128..4ec8f1f4d3f3146836112e8f4184bd67fd1664e0 100644 (file)
@@ -117,3 +117,5 @@ struct test_join;
 struct test_join_ads_dc;
 
 struct netr_LMSessionKey;
+
+struct ldb_message;
index 2b9efa11b47374d0f50a272891f15f1a2e013afd..5780809c784e86a33c72294fd3cc8538ac562512 100644 (file)
@@ -22,6 +22,7 @@
 #include "dynconfig.h"
 #include "ldap_server/ldap_server.h"
 #include "system/time.h"
+#include "lib/ldb/include/ldb.h"
 
 #define ATTR_BLOB_CONST(val) data_blob_talloc(mem_ctx, val, sizeof(val)-1)
 #define ATTR_SINGLE_NOVAL(ctx, attr, blob, num, nam) do { \
@@ -47,7 +48,8 @@ struct rootdse_db_context {
 /*
   this is used to catch debug messages from ldb
 */
-void rootdse_db_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap)  _PRINTF_ATTRIBUTE(3,0)
+static void rootdse_db_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0);
+static void rootdse_db_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap)
 {
        char *s = NULL;
        if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
@@ -73,7 +75,7 @@ static int rootdse_db_destructor(void *ctx)
   connect to the SAM database
   return an opaque context pointer on success, or NULL on failure
  */
-void *rootdse_db_connect(TALLOC_CTX *mem_ctx)
+static void *rootdse_db_connect(TALLOC_CTX *mem_ctx)
 {
        static struct rootdse_db_context *ctx;
        char *db_path;
index 4edd456c6eda80b8526a7fc652296c91887e1312..1b000f53eacca4d50735b2b15fb83286eaa65d3f 100644 (file)
@@ -22,6 +22,7 @@
 #include "includes.h"
 #include "ldap_server/ldap_server.h"
 #include "ldap_parse.h"
+#include "lib/ldb/include/ldb.h"
 
 /* TODO: samdb_context is not a pulblic struct */
 struct samdb_context {
index c7861854991b4bc32611173be41c8bbc727533ba..e9055399ad8dd26c47c9169296b96c5311df7875 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "includes.h"
 #include "dlinklist.h"
+#include "lib/ldb/include/ldb.h"
 
 static struct ldb_wrap *ldb_list;
 static struct tdb_wrap *tdb_list;
index 7666f5bd31213e0b784b62f304bc20708b754e46..a7c86b4e825f2424968fe6452eee298250986029 100644 (file)
@@ -74,9 +74,6 @@ manpages:
 clean:
        rm -f */*.o *~ */*~ $(BINS) $(LDB_LIB) man/man?/*.[13]
 
-proto:
-       perl ../../script/mkproto.pl */*.c > include/proto.h
-
 etags:
        etags */*.[ch]
 
index 4fe2088daf3ff308b65af35cce2a631a6f583cc3..0fb371011f7f0b2288e7281f11d0cfdeaf9b64a8 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 
 /* 
  connect to a database. The URL can either be one of the following forms
index 0053c5e73fa730d48a54ce678959df4f43f69a1b..7dc12b142e329e37c0aa0c3d30b74f60fc6610fe 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 
 
 /*
@@ -122,7 +124,7 @@ void *ldb_strdup(struct ldb_context *ldb, const char *str)
 /*
   a ldb wrapper for asprintf(), using ldb_malloc()
 */
-int ldb_asprintf(struct ldb_context *ldb, char **strp, const char *fmt, ...) _PRINTF_ATTRIBUTE(3, 4)
+int ldb_asprintf(struct ldb_context *ldb, char **strp, const char *fmt, ...)
 {
        int len, len2;
        va_list ap;
index 0a187cd62d48ebc18d3857ec1b978b3efbf8763b..6ba3f30b2d83665e58b049fb75a4e76e94f0f1da 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 
 
 /*
index 01706304d93e109bea577829b350c338f568ea3d..bd99468182d77909fdc84acef49b4f4e4d5ac763 100644 (file)
@@ -37,6 +37,8 @@
 */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include <ctype.h>
 
 
index 37be07c1ca79cbc422f06b2450860f3bf2d8cdcc..1a6a334b8d2d640dfa37dc1899aa47ea21a546c7 100644 (file)
@@ -34,6 +34,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "dlinklist.h"
 #include <sys/types.h> 
 #include <sys/stat.h> 
@@ -82,10 +84,10 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
 
        if (!modules && strcmp("ldap", ldb->modules->ops->name)) { /* no modules in the options, look for @MODULES in the db (not for ldap) */
                int ret, j, k;
-               char * attrs[] = { "@MODULE" };
+               const char * const attrs[] = { "@MODULE" , NULL};
                struct ldb_message **msg;
 
-               ret = ldb_search(ldb, "", LDB_SCOPE_BASE, "dn=@MODULES", (const char * const *)attrs, &msg);
+               ret = ldb_search(ldb, "", LDB_SCOPE_BASE, "dn=@MODULES", attrs, &msg);
                if (ret == 0) {
                        ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db\n");
                } else {
@@ -144,7 +146,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
 #ifdef HAVE_DLOPEN_DISABLED
                {
                        void *handle;
-                       init_ldb_module_function init;
+                       ldb_module_init_function init;
                        struct stat st;
                        const char *errstr;
 
@@ -160,7 +162,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
                                return -1;
                        }
 
-                       init = (init_ldb_module_function)dlsym(handle, "init_module");
+                       init = (ldb_module_init_function)dlsym(handle, "init_module");
 
                        errstr = dlerror();
                        if (errstr) {
index 170a7ae5e41a4d243b21f5227600cfa91e600888..18859c86dd2b4f6ed6c9eaeb71b87bb95fb5841a 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 
 
 /*
@@ -83,6 +85,31 @@ struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el,
        return NULL;
 }
 
+/*
+  duplicate a ldb_val structure
+*/
+struct ldb_val ldb_val_dup(struct ldb_context *ldb,
+                          const struct ldb_val *v)
+{
+       struct ldb_val v2;
+       v2.length = v->length;
+       if (v->length == 0) {
+               v2.data = NULL;
+               return v2;
+       }
+
+       /* the +1 is to cope with buggy C library routines like strndup
+          that look one byte beyond */
+       v2.data = ldb_malloc(ldb, v->length+1);
+       if (!v2.data) {
+               v2.length = 0;
+               return v2;
+       }
+
+       memcpy(v2.data, v->data, v->length);
+       ((char *)v2.data)[v->length] = 0;
+       return v2;
+}
 
 /*
   add an empty element to a message
index feec8fc0f22aa6269dd39f44412b142f9f15915e..1e00a05d5545ca395bf299189431bb66a608b376 100644 (file)
@@ -42,6 +42,8 @@
 */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/include/ldb_parse.h"
 #include <ctype.h>
 
index e92d318bae7c156580a017de7f9bb4022d2c572d..01bd8eb9acdd2f0de43e513ac89d74bffef7c7d2 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include <ctype.h>
 
 /*
index c8aa5019e2889da71a7555469a1af355e4653169..af738f352a99d6807d20c3e15a88689f6d788dcb 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 
 
 /*
index 46fd4e12ae5d15dde6881420439dfaded50f28cf..a026ae12294662eb34afd5e66fea4b14bd210ee3 100644 (file)
@@ -15,6 +15,7 @@ INIT_OBJ_FILES = \
                lib/ldb/ldb_ldap/ldb_ldap.o
 REQUIRED_SUBSYSTEMS = \
                EXT_LIB_LDAP
+NOPROTO = YES
 # End MODULE libldb_tdb
 ################################################
 
@@ -32,6 +33,7 @@ ADD_OBJ_FILES = \
                lib/ldb/ldb_tdb/ldb_cache.o
 REQUIRED_SUBSYSTEMS = \
                LIBTDB
+NOPROTO = YES
 # End MODULE libldb_tdb
 ################################################
 
@@ -51,6 +53,7 @@ ADD_OBJ_FILES = \
                lib/ldb/common/ldb_modules.o
 REQUIRED_SUBSYSTEMS = \
                LIBREPLACE
+NOPROTO = YES
 #
 # End SUBSYSTEM LIBLDB
 ################################################
index 44ff672266e9c28e41d967bda2329a30e27d23a1..4926e1524a4dc00b1e06972b138133ef2e95998a 100644 (file)
 #include <sys/time.h>
 #include <time.h>
 
-
-#ifndef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a,b)
-#endif
-
 #include "ldb.h"
-#include "tdb.h"
-#include "proto.h"
+#include "ldb_private.h"
 
 #ifdef HAVE_INTPTR_T
 #define discard_const(ptr) ((void *)((intptr_t)(ptr)))
index 6a06678e0eecc46b2563c1ff3f7d3d5c92b02e97..03d0cc7a3b4db7177653be6a7b2661c8c06c8f38 100644 (file)
@@ -121,39 +121,7 @@ struct ldb_context;
 typedef int (*ldb_traverse_fn)(struct ldb_context *, const struct ldb_message *);
 
 
-struct ldb_module_ops;
-
-/* basic module structure */
-struct ldb_module {
-       struct ldb_module *prev, *next;
-       struct ldb_context *ldb;
-       void *private_data;
-       const struct ldb_module_ops *ops;
-};
-
-/* 
-   these function pointers define the operations that a ldb module must perform
-   they correspond exactly to the ldb_*() interface 
-*/
-struct ldb_module_ops {
-       const char *name;
-       int (*close)(struct ldb_module *);
-       int (*search)(struct ldb_module *, const char *, enum ldb_scope,
-                     const char *, const char * const [], struct ldb_message ***);
-       int (*search_free)(struct ldb_module *, struct ldb_message **);
-       int (*add_record)(struct ldb_module *, const struct ldb_message *);
-       int (*modify_record)(struct ldb_module *, const struct ldb_message *);
-       int (*delete_record)(struct ldb_module *, const char *);
-       int (*rename_record)(struct ldb_module *, const char *, const char *);
-       const char * (*errstring)(struct ldb_module *);
-
-       /* this is called when the alloc ops changes to ensure we 
-          don't have any old allocated data in the context */
-       void (*cache_free)(struct ldb_module *);
-};
-
-/* the modules init function */
-typedef struct ldb_module *(*init_ldb_module_function)(void);
+struct ldb_module;
 
 /*
   the user can optionally supply a allocator function. It is presumed
@@ -180,22 +148,6 @@ struct ldb_debug_ops {
        void *context;
 };
 
-
-/*
-  every ldb connection is started by establishing a ldb_context
-*/
-struct ldb_context {
-       /* the operations provided by the backend */
-       struct ldb_module *modules;
-
-       /* memory allocation info */
-       struct ldb_alloc_ops alloc_ops;
-
-       /* memory allocation info */
-       struct ldb_debug_ops debug_ops;
-};
-
-
 #define LDB_FLG_RDONLY 1
 
 /* 
@@ -285,6 +237,9 @@ int ldb_ldif_write_file(struct ldb_context *ldb, FILE *f, const struct ldb_ldif
 
 /* useful functions for ldb_message structure manipulation */
 
+int ldb_dn_cmp(const char *dn1, const char *dn2);
+int ldb_attr_cmp(const char *dn1, const char *dn2);
+
 /* find an element within an message */
 struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, 
                                                 const char *attr_name);
@@ -305,6 +260,12 @@ int ldb_msg_add(struct ldb_context *ldb,
                struct ldb_message *msg, 
                const struct ldb_message_element *el, 
                int flags);
+int ldb_msg_add_value(struct ldb_context *ldb,
+                     struct ldb_message *msg, 
+                     const char *attr_name,
+                     struct ldb_val *val);
+int ldb_msg_add_string(struct ldb_context *ldb, struct ldb_message *msg, 
+                      const char *attr_name, char *str);
 
 /* compare two message elements - return 0 on match */
 int ldb_msg_element_compare(struct ldb_message_element *el1, 
@@ -313,19 +274,27 @@ int ldb_msg_element_compare(struct ldb_message_element *el1,
 /* find elements in a message and convert to a specific type, with
    a give default value if not found. Assumes that elements are
    single valued */
+const struct ldb_val *ldb_msg_find_ldb_val(const struct ldb_message *msg, const char *attr_name);
 int ldb_msg_find_int(const struct ldb_message *msg, 
                     const char *attr_name,
                     int default_value);
 unsigned int ldb_msg_find_uint(const struct ldb_message *msg, 
                               const char *attr_name,
                               unsigned int default_value);
+int64_t ldb_msg_find_int64(const struct ldb_message *msg, 
+                          const char *attr_name,
+                          int64_t default_value);
+uint64_t ldb_msg_find_uint64(const struct ldb_message *msg, 
+                            const char *attr_name,
+                            uint64_t default_value);
 double ldb_msg_find_double(const struct ldb_message *msg, 
                           const char *attr_name,
                           double default_value);
 const char *ldb_msg_find_string(const struct ldb_message *msg, 
                                const char *attr_name,
                                const char *default_value);
-
+struct ldb_val ldb_val_dup(struct ldb_context *ldb,
+                          const struct ldb_val *v);
 
 /*
   this allows the user to choose their own allocation function
@@ -341,6 +310,24 @@ int ldb_set_alloc(struct ldb_context *ldb,
                  void *(*alloc)(const void *context, void *ptr, size_t size),
                  void *context);
 
+/* these are used as type safe versions of the ldb allocation functions */
+#define ldb_malloc_p(ldb, type) (type *)ldb_malloc(ldb, sizeof(type))
+#define ldb_malloc_array_p(ldb, type, count) (type *)ldb_realloc_array(ldb, NULL, sizeof(type), count)
+#define ldb_realloc_p(ldb, p, type, count) (type *)ldb_realloc_array(ldb, p, sizeof(type), count)
+
+void *ldb_realloc(struct ldb_context *ldb, void *ptr, size_t size);
+void *ldb_malloc(struct ldb_context *ldb, size_t size);
+void ldb_free(struct ldb_context *ldb, void *ptr);
+void *ldb_strndup(struct ldb_context *ldb, const char *str, size_t maxlen);
+void *ldb_strdup(struct ldb_context *ldb, const char *str);
+void *ldb_realloc_array(struct ldb_context *ldb,
+                       void *ptr, size_t el_size, unsigned count);
+
+#ifndef PRINTF_ATTRIBUTE
+#define PRINTF_ATTRIBUTE(a,b)
+#endif
+int ldb_asprintf(struct ldb_context *ldb, char **strp, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
+
 /*
   this allows the user to set a debug function for error reporting
 */
@@ -352,10 +339,4 @@ int ldb_set_debug(struct ldb_context *ldb,
 /* this sets up debug to print messages on stderr */
 int ldb_set_debug_stderr(struct ldb_context *ldb);
 
-
-/* these are used as type safe versions of the ldb allocation functions */
-#define ldb_malloc_p(ldb, type) (type *)ldb_malloc(ldb, sizeof(type))
-#define ldb_malloc_array_p(ldb, type, count) (type *)ldb_realloc_array(ldb, NULL, sizeof(type), count)
-#define ldb_realloc_p(ldb, p, type, count) (type *)ldb_realloc_array(ldb, p, sizeof(type), count)
-
 #endif
index 930799d7b6f3a69dd3e4ca1b14637b1ec1b4c709..d9125d05ed8f2e096f87acd70a6e7b20b9e15146 100644 (file)
@@ -54,4 +54,7 @@ struct ldb_parse_tree {
        } u;
 };
 
+struct ldb_parse_tree *ldb_parse_tree(struct ldb_context *ldb, const char *s);
+void ldb_parse_tree_free(struct ldb_context *ldb, struct ldb_parse_tree *tree);
+
 #endif
diff --git a/source/lib/ldb/include/ldb_private.h b/source/lib/ldb/include/ldb_private.h
new file mode 100644 (file)
index 0000000..dfd388b
--- /dev/null
@@ -0,0 +1,126 @@
+/* 
+   ldb database library
+
+   Copyright (C) Andrew Tridgell  2004
+   Copyright (C) Stefan Metzmacher  2004
+
+     ** NOTE! The following LGPL license applies to the ldb
+     ** library. This does NOT imply that all of Samba is released
+     ** under the LGPL
+   
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/*
+ *  Name: ldb
+ *
+ *  Component: ldb private header
+ *
+ *  Description: defines internal ldb structures used by th esubsystem and modules
+ *
+ *  Author: Andrew Tridgell
+ *  Author: Stefan Metzmacher
+ */
+
+#ifndef _LDB_PRIVATE_H_
+#define _LDB_PRIVATE_H_ 1
+
+struct ldb_context;
+
+struct ldb_module_ops;
+
+/* basic module structure */
+struct ldb_module {
+       struct ldb_module *prev, *next;
+       struct ldb_context *ldb;
+       void *private_data;
+       const struct ldb_module_ops *ops;
+};
+
+/* 
+   these function pointers define the operations that a ldb module must perform
+   they correspond exactly to the ldb_*() interface 
+*/
+struct ldb_module_ops {
+       const char *name;
+       int (*close)(struct ldb_module *);
+       int (*search)(struct ldb_module *, const char *, enum ldb_scope,
+                     const char *, const char * const [], struct ldb_message ***);
+       int (*search_free)(struct ldb_module *, struct ldb_message **);
+       int (*add_record)(struct ldb_module *, const struct ldb_message *);
+       int (*modify_record)(struct ldb_module *, const struct ldb_message *);
+       int (*delete_record)(struct ldb_module *, const char *);
+       int (*rename_record)(struct ldb_module *, const char *, const char *);
+       const char * (*errstring)(struct ldb_module *);
+
+       /* this is called when the alloc ops changes to ensure we 
+          don't have any old allocated data in the context */
+       void (*cache_free)(struct ldb_module *);
+};
+
+/* the modules init function */
+typedef struct ldb_module *(*ldb_module_init_function)(void);
+
+/*
+  every ldb connection is started by establishing a ldb_context
+*/
+struct ldb_context {
+       /* the operations provided by the backend */
+       struct ldb_module *modules;
+
+       /* memory allocation info */
+       struct ldb_alloc_ops alloc_ops;
+
+       /* memory allocation info */
+       struct ldb_debug_ops debug_ops;
+};
+
+/* The following definitions come from lib/ldb/common/ldb_modules.c  */
+
+int ldb_load_modules(struct ldb_context *ldb, const char *options[]);
+int ldb_next_close(struct ldb_module *module);
+int ldb_next_search(struct ldb_module *module, 
+              const char *base,
+              enum ldb_scope scope,
+              const char *expression,
+              const char * const *attrs, struct ldb_message ***res);
+int ldb_next_search_free(struct ldb_module *module, struct ldb_message **msg);
+int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message);
+int ldb_next_modify_record(struct ldb_module *module, const struct ldb_message *message);
+int ldb_next_delete_record(struct ldb_module *module, const char *dn);
+int ldb_next_rename_record(struct ldb_module *module, const char *olddn, const char *newdn);
+const char *ldb_next_errstring(struct ldb_module *module);
+void ldb_next_cache_free(struct ldb_module *module);
+
+/* The following definitions come from lib/ldb/common/util.c  */
+int ldb_list_find(const void *needle, 
+             const void *base, size_t nmemb, size_t size, comparison_fn_t comp_fn);
+
+/* The following definitions come from lib/ldb/common/ldb_debug.c  */
+void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
+
+/* The following definitions come from lib/ldb/common/ldb_ldif.c  */
+char *ldb_base64_encode(struct ldb_context *ldb, const char *buf, int len);
+int ldb_should_b64_encode(const struct ldb_val *val);
+
+struct ldb_context *ltdb_connect(const char *url, 
+                                unsigned int flags, 
+                                const char *options[]);
+struct ldb_context *lldb_connect(const char *url, 
+                                unsigned int flags, 
+                                const char *options[]);
+struct ldb_module *timestamps_module_init(struct ldb_context *ldb, const char *options[]);
+
+#endif
index 7fb6a0b3f7bb7cc748ec8b8d204ede42fe04aed3..85604dfe760609e414f94c1f7f5b2650e8772a90 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/ldb_ldap/ldb_ldap.h"
 
 #if 0
index cf175090e6ac579090a2c631c0650ac8ab4cc6d4..a8eb9ae916e94726546fbaf7b05757a791412ec8 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/ldb_tdb/ldb_tdb.h"
 
 /*
index 93e358e4d2269559dc11b137f7e9d75fee0f6b2b..b651aa38c192bfed178961fb0fe07082ddc2a6a9 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/ldb_tdb/ldb_tdb.h"
 #include "ldb/include/ldb_parse.h"
 
@@ -523,7 +525,7 @@ static int ldb_index_filter(struct ldb_module *module, struct ldb_parse_tree *tr
                        return -1;
                }
 
-               if (ldb_message_match(module, &msg, tree, base, scope) == 1) {
+               if (ltdb_message_match(module, &msg, tree, base, scope) == 1) {
                        ret = ltdb_add_attr_results(module, &msg, attrs, &count, res);
                }
                ltdb_search_dn1_free(module, &msg);
@@ -860,7 +862,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
                return 0;
        }
 
-       ret = ltdb_unpack_data(module->ldb, &data, &msg);
+       ret = ltdb_unpack_data(module, &data, &msg);
        if (ret != 0) {
                return -1;
        }
@@ -871,7 +873,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
 
        ret = ltdb_index_add(module, &msg);
 
-       ltdb_unpack_data_free(module->ldb, &msg);
+       ltdb_unpack_data_free(module, &msg);
 
        return ret;
 }
index 52e9f5afc7cbcc55fbc4b1199f0339334a968f48..4a51cfddf0181f4f625599c5bb36636c9af864f5 100644 (file)
  */
 
 #include "includes.h"
-#include <fnmatch.h>
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/ldb_tdb/ldb_tdb.h"
 #include "ldb/include/ldb_parse.h"
-
+#include <fnmatch.h>
 
 /*
   see if two ldb_val structures contain the same data as integers
   return 1 for a match, 0 for a mis-match
 */
-static int ldb_val_equal_integer(const struct ldb_val *v1, const struct ldb_val *v2)
+static int ltdb_val_equal_integer(const struct ldb_val *v1, const struct ldb_val *v2)
 {
        int i1, i2;
 
@@ -56,7 +57,7 @@ static int ldb_val_equal_integer(const struct ldb_val *v1, const struct ldb_val
   see if two ldb_val structures contain the same data as case insensitive strings
   return 1 for a match, 0 for a mis-match
 */
-static int ldb_val_equal_case_insensitive(const struct ldb_val *v1, 
+static int ltdb_val_equal_case_insensitive(const struct ldb_val *v1, 
                                          const struct ldb_val *v2)
 {
        if (v1->length != v2->length) {
@@ -73,10 +74,11 @@ static int ldb_val_equal_case_insensitive(const struct ldb_val *v1,
   and case insensitive
   return 1 for a match, 0 for a mis-match
 */
-static int ldb_val_equal_wildcard_ci(struct ldb_context *ldb,
+static int ltdb_val_equal_wildcard_ci(struct ldb_module *module,
                                     const struct ldb_val *v1, 
                                     const struct ldb_val *v2)
 {
+       struct ldb_context *ldb = module->ldb;
        char *s1, *s2;
        int ret;
 
@@ -110,13 +112,13 @@ static int ldb_val_equal_wildcard_ci(struct ldb_context *ldb,
   see if two ldb_val structures contain the same data with wildcards
   return 1 for a match, 0 for a mis-match
 */
-static int ldb_val_equal_wildcard(struct ldb_context *ldb,
+static int ltdb_val_equal_wildcard(struct ldb_module *module,
                                  const struct ldb_val *v1, 
                                  const struct ldb_val *v2,
                                  int flags)
 {
        if (flags & LTDB_FLAG_CASE_INSENSITIVE) {
-               return ldb_val_equal_wildcard_ci(ldb, v1, v2);
+               return ltdb_val_equal_wildcard_ci(module, v1, v2);
        }
        if (!v1->data || !v2->data) {
                return v1->data == v2->data;
@@ -137,13 +139,13 @@ static int ldb_val_equal_wildcard(struct ldb_context *ldb,
 
   return 1 for a match, 0 for a mis-match
 */
-static int ldb_val_equal_objectclass(struct ldb_module *module, 
+static int ltdb_val_equal_objectclass(struct ldb_module *module, 
                                     const struct ldb_val *v1, const struct ldb_val *v2)
 {
        struct ltdb_private *ltdb = module->private_data;
        unsigned int i;
 
-       if (ldb_val_equal_case_insensitive(v1, v2) == 1) {
+       if (ltdb_val_equal_case_insensitive(v1, v2) == 1) {
                return 1;
        }
 
@@ -152,7 +154,7 @@ static int ldb_val_equal_objectclass(struct ldb_module *module,
                if (ldb_attr_cmp(el->name, v2->data) == 0) {
                        unsigned int j;
                        for (j=0;j<el->num_values;j++) {
-                               if (ldb_val_equal_objectclass(module, v1, &el->values[j])) {
+                               if (ltdb_val_equal_objectclass(module, v1, &el->values[j])) {
                                        return 1;
                                }
                        }
@@ -171,27 +173,26 @@ static int ldb_val_equal_objectclass(struct ldb_module *module,
   
   return 1 for a match, 0 for a mis-match
 */
-int ldb_val_equal(struct ldb_module *module,
+int ltdb_val_equal(struct ldb_module *module,
                  const char *attr_name,
                  const struct ldb_val *v1, const struct ldb_val *v2)
 {
-       struct ldb_context *ldb = module->ldb;
        int flags = ltdb_attribute_flags(module, attr_name);
 
        if (flags & LTDB_FLAG_OBJECTCLASS) {
-               return ldb_val_equal_objectclass(module, v1, v2);
+               return ltdb_val_equal_objectclass(module, v1, v2);
        }
 
        if (flags & LTDB_FLAG_INTEGER) {
-               return ldb_val_equal_integer(v1, v2);
+               return ltdb_val_equal_integer(v1, v2);
        }
 
        if (flags & LTDB_FLAG_WILDCARD) {
-               return ldb_val_equal_wildcard(ldb, v1, v2, flags);
+               return ltdb_val_equal_wildcard(module, v1, v2, flags);
        }
 
        if (flags & LTDB_FLAG_CASE_INSENSITIVE) {
-               return ldb_val_equal_case_insensitive(v1, v2);
+               return ltdb_val_equal_case_insensitive(v1, v2);
        }
 
        if (v1->length != v2->length) return 0;
@@ -280,7 +281,7 @@ static int match_leaf(struct ldb_module *module,
                                return 1;
                        }
                        for (j=0;j<msg->elements[i].num_values;j++) {
-                               if (ldb_val_equal(module, msg->elements[i].name,
+                               if (ltdb_val_equal(module, msg->elements[i].name,
                                                  &msg->elements[i].values[j], 
                                                  &tree->u.simple.value)) {
                                        return 1;
@@ -300,7 +301,7 @@ static int match_leaf(struct ldb_module *module,
 
   this is a recursive function, and does short-circuit evaluation
  */
-int ldb_message_match(struct ldb_module *module, 
+int ltdb_message_match(struct ldb_module *module, 
                      struct ldb_message *msg,
                      struct ldb_parse_tree *tree,
                      const char *base,
@@ -314,11 +315,11 @@ int ldb_message_match(struct ldb_module *module,
                break;
 
        case LDB_OP_NOT:
-               return ! ldb_message_match(module, msg, tree->u.not.child, base, scope);
+               return ! ltdb_message_match(module, msg, tree->u.not.child, base, scope);
 
        case LDB_OP_AND:
                for (i=0;i<tree->u.list.num_elements;i++) {
-                       v = ldb_message_match(module, msg, tree->u.list.elements[i],
+                       v = ltdb_message_match(module, msg, tree->u.list.elements[i],
                                              base, scope);
                        if (!v) return 0;
                }
@@ -326,7 +327,7 @@ int ldb_message_match(struct ldb_module *module,
 
        case LDB_OP_OR:
                for (i=0;i<tree->u.list.num_elements;i++) {
-                       v = ldb_message_match(module, msg, tree->u.list.elements[i],
+                       v = ltdb_message_match(module, msg, tree->u.list.elements[i],
                                              base, scope);
                        if (v) return 1;
                }
index ad856d2fafb383b10206779d502f32d862fefca9..9515beeaa78db78994a28a51294f8a202e90e51b 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/ldb_tdb/ldb_tdb.h"
 
 /* change this if the data format ever changes */
@@ -65,10 +67,11 @@ static unsigned int pull_uint32(uint8_t *p, int ofs)
 
   caller frees the data buffer after use
 */
-int ltdb_pack_data(struct ldb_context *ldb,
+int ltdb_pack_data(struct ldb_module *module,
                   const struct ldb_message *message,
                   struct TDB_DATA *data)
 {
+       struct ldb_context *ldb = module->ldb;
        unsigned int i, j, real_elements=0;
        size_t size;
        char *p;
@@ -138,9 +141,10 @@ int ltdb_pack_data(struct ldb_context *ldb,
 /*
   free the memory allocated from a ltdb_unpack_data()
 */
-void ltdb_unpack_data_free(struct ldb_context *ldb,
+void ltdb_unpack_data_free(struct ldb_module *module,
                           struct ldb_message *message)
 {
+       struct ldb_context *ldb = module->ldb;
        unsigned int i;
 
        for (i=0;i<message->num_elements;i++) {
@@ -160,10 +164,11 @@ void ltdb_unpack_data_free(struct ldb_context *ldb,
   TDB_DATA data. This means the caller only has to free the elements
   and values arrays. This can be done with ltdb_unpack_data_free()
 */
-int ltdb_unpack_data(struct ldb_context *ldb,
+int ltdb_unpack_data(struct ldb_module *module,
                     const struct TDB_DATA *data,
                     struct ldb_message *message)
 {
+       struct ldb_context *ldb = module->ldb;
        char *p;
        unsigned int remaining;
        unsigned int i, j;
@@ -274,7 +279,7 @@ int ltdb_unpack_data(struct ldb_context *ldb,
        return 0;
 
 failed:
-       ltdb_unpack_data_free(ldb, message);
+       ltdb_unpack_data_free(module, message);
 
        return -1;
 }
index cb93483881470c897db12edae6947965b13f76d3..903c4cb80210e6afe97b4d254ddc378c7c450020 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/ldb_tdb/ldb_tdb.h"
 #include "ldb/include/ldb_parse.h"
 
@@ -55,34 +57,6 @@ static void msg_free_all_parts(struct ldb_context *ldb, struct ldb_message *msg)
 }
 
 
-/*
-  duplicate a ldb_val structure
-*/
-struct ldb_val ldb_val_dup(struct ldb_context *ldb,
-                          const struct ldb_val *v)
-{
-       struct ldb_val v2;
-       v2.length = v->length;
-       if (v->length == 0) {
-               v2.data = NULL;
-               return v2;
-       }
-
-       /* the +1 is to cope with buggy C library routines like strndup
-          that look one byte beyond */
-       v2.data = ldb_malloc(ldb, v->length+1);
-       if (!v2.data) {
-               v2.length = 0;
-               return v2;
-       }
-
-       memcpy(v2.data, v->data, v->length);
-       ((char *)v2.data)[v->length] = 0;
-       return v2;
-}
-
-
-
 /*
   add one element to a message
 */
@@ -319,7 +293,7 @@ int ltdb_search_dn1(struct ldb_module *module, const char *dn, struct ldb_messag
        msg->num_elements = 0;
        msg->elements = NULL;
 
-       ret = ltdb_unpack_data(ldb, &tdb_data2, msg);
+       ret = ltdb_unpack_data(module, &tdb_data2, msg);
        if (ret == -1) {
                ldb_free(ldb, tdb_data2.dptr);
                return -1;              
@@ -439,7 +413,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
        }
 
        /* unpack the record */
-       ret = ltdb_unpack_data(sinfo->module->ldb, &data, &msg);
+       ret = ltdb_unpack_data(sinfo->module, &data, &msg);
        if (ret == -1) {
                sinfo->failures++;
                return 0;
@@ -450,9 +424,9 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
        }
 
        /* see if it matches the given expression */
-       if (!ldb_message_match(sinfo->module, &msg, sinfo->tree, 
+       if (!ltdb_message_match(sinfo->module, &msg, sinfo->tree, 
                               sinfo->base, sinfo->scope)) {
-               ltdb_unpack_data_free(sinfo->module->ldb, &msg);
+               ltdb_unpack_data_free(sinfo->module, &msg);
                return 0;
        }
 
@@ -462,7 +436,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
                sinfo->failures++;
        }
 
-       ltdb_unpack_data_free(sinfo->module->ldb, &msg);
+       ltdb_unpack_data_free(sinfo->module, &msg);
 
        return ret;
 }
index a2aa5a7aca7a989796b9a1cebf5b592d14dd4f6b..5f6af43f94d3c96a9a90cc9b4b4ec6300c4fe013 100644 (file)
@@ -36,6 +36,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include "ldb/ldb_tdb/ldb_tdb.h"
 
 /*
@@ -195,7 +197,7 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg
                return -1;
        }
 
-       ret = ltdb_pack_data(ldb, msg, &tdb_data);
+       ret = ltdb_pack_data(module, msg, &tdb_data);
        if (ret == -1) {
                ldb_free(ldb, tdb_key.dptr);
                return -1;
@@ -439,7 +441,7 @@ static int msg_delete_element(struct ldb_module *module,
        el = &msg->elements[found];
 
        for (i=0;i<el->num_values;i++) {
-               if (ldb_val_equal(module, msg->elements[i].name, &el->values[i], val)) {
+               if (ltdb_val_equal(module, msg->elements[i].name, &el->values[i], val)) {
                        if (i<el->num_values-1) {
                                memmove(&el->values[i], &el->values[i+1],
                                        sizeof(el->values[i])*(el->num_values-(i+1)));
@@ -483,7 +485,7 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
                return -1;
        }
 
-       ret = ltdb_unpack_data(ldb, &tdb_data, &msg2);
+       ret = ltdb_unpack_data(module, &tdb_data, &msg2);
        if (ret == -1) {
                ldb_free(ldb, tdb_key.dptr);
                free(tdb_data.dptr);
@@ -551,13 +553,13 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
 
        ldb_free(ldb, tdb_key.dptr);
        free(tdb_data.dptr);
-       ltdb_unpack_data_free(ldb, &msg2);
+       ltdb_unpack_data_free(module, &msg2);
        return ret;
 
 failed:
        ldb_free(ldb, tdb_key.dptr);
        free(tdb_data.dptr);
-       ltdb_unpack_data_free(ldb, &msg2);
+       ltdb_unpack_data_free(module, &msg2);
        return -1;
 }
 
index b6660c5825464a955a7822b6ec99248857b1a088..7b926e21a2633a7d9083d6eed3b881d4b85a9020 100644 (file)
@@ -1,3 +1,8 @@
+
+#ifdef STANDALONE
+#include "tdb.h"
+#endif
+
 /* this private structure is used by the ltdb backend in the
    ldb_context */
 struct ltdb_private {
@@ -43,3 +48,67 @@ struct ltdb_private {
 #define LTDB_FLAG_WILDCARD         (1<<2)
 #define LTDB_FLAG_OBJECTCLASS      (1<<3)
 #define LTDB_FLAG_HIDDEN           (1<<4)
+
+/* The following definitions come from lib/ldb/ldb_tdb/ldb_cache.c  */
+
+void ltdb_cache_free(struct ldb_module *module);
+int ltdb_cache_load(struct ldb_module *module);
+int ltdb_increase_sequence_number(struct ldb_module *module);
+int ltdb_attribute_flags(struct ldb_module *module, const char *attr_name);
+
+/* The following definitions come from lib/ldb/ldb_tdb/ldb_index.c  */
+
+struct ldb_parse_tree;
+
+int ltdb_search_indexed(struct ldb_module *module, 
+                       const char *base,
+                       enum ldb_scope scope,
+                       struct ldb_parse_tree *tree,
+                       const char * const attrs[], struct ldb_message ***res);
+int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg);
+int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg);
+int ltdb_reindex(struct ldb_module *module);
+
+/* The following definitions come from lib/ldb/ldb_tdb/ldb_pack.c  */
+
+int ltdb_pack_data(struct ldb_module *module,
+                  const struct ldb_message *message,
+                  struct TDB_DATA *data);
+void ltdb_unpack_data_free(struct ldb_module *module,
+                          struct ldb_message *message);
+int ltdb_unpack_data(struct ldb_module *module,
+                    const struct TDB_DATA *data,
+                    struct ldb_message *message);
+
+/* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c  */
+
+int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name, 
+                     const struct ldb_val *val);
+void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
+int ltdb_search_dn1(struct ldb_module *module, const char *dn, struct ldb_message *msg);
+int ltdb_search_dn(struct ldb_module *module, char *dn,
+                  const char * const attrs[], struct ldb_message ***res);
+int ltdb_add_attr_results(struct ldb_module *module, struct ldb_message *msg,
+                         const char * const attrs[], 
+                         unsigned int *count, 
+                         struct ldb_message ***res);
+int ltdb_search_free(struct ldb_module *module, struct ldb_message **msgs);
+int ltdb_search(struct ldb_module *module, const char *base,
+               enum ldb_scope scope, const char *expression,
+               const char * const attrs[], struct ldb_message ***res);
+
+/* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c  */
+struct TDB_DATA ltdb_key(struct ldb_module *module, const char *dn);
+int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
+int ltdb_delete_noindex(struct ldb_module *module, const char *dn);
+int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg);
+
+/* The following definitions come from lib/ldb/ldb_tdb/ldb_match.c  */
+int ltdb_val_equal(struct ldb_module *module,
+                 const char *attr_name,
+                 const struct ldb_val *v1, const struct ldb_val *v2);
+int ltdb_message_match(struct ldb_module *module, 
+                     struct ldb_message *msg,
+                     struct ldb_parse_tree *tree,
+                     const char *base,
+                     enum ldb_scope scope);
index 1d6314ee74a5f25ca0f9f24cab14ac70e1c771d6..331a2de5e4dfef5cc4f46191ed10d19a8b742ee3 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 
 /* close */
 static int skel_close(struct ldb_module *module)
index 64d7616fb1451c5ea9e3d98f11d6faea99a9af60..521c59d241203f22c315ec8f073fb378a8da8c8f 100644 (file)
@@ -33,6 +33,8 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_private.h"
 #include <time.h>
 
 static int timestamps_close(struct ldb_module *module)
index b0c9d8a3665b8da203a3aeaf3fc663294824a7ca..d7f890b155356c9b595355d3dddd34e2c30ababb 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
 
 static int failures;
 
index 839cb4cbe2c30a4736adadc92760ccafe89b6686..dc1c734284af545604906ebeb1966150dd54fa35 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
 
 static int ldb_delete_recursive(struct ldb_context *ldb, const char *dn)
 {
index fc3b28872edf0aa547ba7a7648f128c9e602a0c5..fd45248c0e93b8d9f55ae1d9c63d6fb2a0f7906e 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
 
 static int verbose;
 
index ac8958f4ac2e584bc0e96a7cfd561462a5ac9058..a660b814da20f524ec8ddca9a16a745f7a466748 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
 
 static int failures;
 
index 17b445c9e5a461313336e5fa8d4f3d8e59a73386..f702cbd7f2566c8f50eafe57f63ea19e6f0ab59d 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
 
 static void usage(void)
 {
index 81c46b437c520f31218f173d98bdbff6ace883d6..9f6b2f617a6457141ecb0c1aab663bac272f4a87 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
 
 static void usage(void)
 {
index 5d90dc797d32e7814af29c0fc6ec5031da5d871f..f3be8e1e5c3ff54da5c4b3e5f06f38e66ba2d3a8 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "includes.h"
+#include "ldb/include/ldb.h"
 
 static const char *ldb_url;
 static const char *base_dn = "ou=Ldb Test,ou=People,o=University of Michigan,c=US";
index bdebe34ff4d4b6468e8479f0e7082556170c6387..380a8010f22b19d5ddba20a35dc0538f4d435f71 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "includes.h"
 #include "registry.h"
+#include "lib/ldb/include/ldb.h"
 
 static char *reg_path_to_ldb(TALLOC_CTX *mem_ctx, const char *path, const char *add)
 {
index 0e6ddb0693bdfa5cf6bef66d5c00325ed2a66ccd..2aea42787a0224b7fa7acf1e91ba395c44e5720a 100644 (file)
@@ -22,6 +22,7 @@
 */
 
 #include "includes.h"
+#include "lib/ldb/include/ldb.h"
 
 /*
   search the sam for the specified attributes - va_list variant
index dcdcd7237cb19793b5286bee187b06bcfead3996..c4a4208667c81b8da4a815d0bbc00ddd896df8b5 100644 (file)
@@ -26,6 +26,7 @@
 #include "rpc_server/common/common.h"
 #include "librpc/gen_ndr/ndr_dcom.h"
 #include "auth/auth.h"
+#include "lib/ldb/include/ldb.h"
 
 struct server_pipe_state {
        struct netr_Credential client_challenge;
index 61e755bc0f3bbb7192b324a704e002e7c5e29a0b..e02ef04ad5faa29fd31a4ad9bf559ad3e93624b8 100644 (file)
@@ -23,6 +23,7 @@
 #include "includes.h"
 #include "system/time.h"
 #include "auth/auth.h"
+#include "lib/ldb/include/ldb.h"
 
 /* a reasonable amount of time to keep credentials live */
 #define SCHANNEL_CREDENTIALS_EXPIRY 600
index 4ed5948b6a811dda3f69f09c6cf43fc657f356ae..6aec38a4fb2e0429f1b8488996f3aa4eb1481ae5 100644 (file)
@@ -26,7 +26,7 @@
 #include "rpc_server/common/common.h"
 #include "rpc_server/samr/dcesrv_samr.h"
 #include "system/time.h"
-
+#include "lib/ldb/include/ldb.h"
 
 
 /*
index 15796a695e3f7cf85ffa3dd1cd4387a6cfb5c48e..488c48cd50345029cf882a318920954edfb64662 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "includes.h"
 #include "librpc/gen_ndr/ndr_netlogon.h"
+#include "lib/ldb/include/ldb.h"
 
 /*
   connect to the SAM database
index c45bababa69d8e239fe92ec67b1d98b7f74421f5..8e88abfc16c1fe086152c6bdfb630a5ccfa9d7a7 100644 (file)
@@ -27,6 +27,7 @@
 #include "rpc_server/samr/dcesrv_samr.h"
 #include "system/time.h"
 #include "lib/crypto/crypto.h"
+#include "lib/ldb/include/ldb.h"
 
 /* 
   samr_ChangePasswordUser 
index a19ad14981b528ac592ba0d2cc8c3cae5ac4f57d..cec9ade0d474cf11da15f63bbffd2abbd7ddb849 100644 (file)
@@ -22,6 +22,7 @@
 */
 
 #include "includes.h"
+#include "lib/ldb/include/ldb.h"
 
 struct spoolssdb_context {
        struct ldb_context *ldb;
@@ -30,7 +31,8 @@ struct spoolssdb_context {
 /*
   this is used to catch debug messages from ldb
 */
-void spoolssdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) _PRINTF_ATTRIBUTE(3, 0)
+static void spoolssdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3, 0);
+static void spoolssdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap)
 {
        char *s = NULL;
        if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {