summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-01-29 18:39:30 -0500
committerSimo Sorce <idra@samba.org>2009-01-30 01:02:03 -0500
commit380874ef863866c94c999ef53252b9d30df65e88 (patch)
treeaafdb720253d5a6013e2a23a0e81b0a9b90f054b /source4/lib/ldb/common
parenta5f0640bf99e6f7e38b0b1e7a7a56f8f58ec7e47 (diff)
downloadsamba-380874ef863866c94c999ef53252b9d30df65e88.tar.gz
samba-380874ef863866c94c999ef53252b9d30df65e88.tar.bz2
samba-380874ef863866c94c999ef53252b9d30df65e88.zip
Fix the mess with ldb includes.
Separate again the public from the private headers. Add a new header specific for modules. Also add service function for modules as now ldb_context and ldb_module are opaque structures for them.
Diffstat (limited to 'source4/lib/ldb/common')
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c2
-rw-r--r--source4/lib/ldb/common/ldb.c17
-rw-r--r--source4/lib/ldb/common/ldb_attributes.c2
-rw-r--r--source4/lib/ldb/common/ldb_controls.c2
-rw-r--r--source4/lib/ldb/common/ldb_debug.c2
-rw-r--r--source4/lib/ldb/common/ldb_dn.c2
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c2
-rw-r--r--source4/lib/ldb/common/ldb_match.c2
-rw-r--r--source4/lib/ldb/common/ldb_modules.c37
-rw-r--r--source4/lib/ldb/common/ldb_msg.c2
-rw-r--r--source4/lib/ldb/common/ldb_parse.c2
-rw-r--r--source4/lib/ldb/common/ldb_utf8.c2
-rw-r--r--source4/lib/ldb/common/qsort.c2
13 files changed, 63 insertions, 13 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 5ec86b5b8f..80725ec04f 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -25,7 +25,7 @@
see rfc2252
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
#include "system/locale.h"
#include "ldb_handlers.h"
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index fe55d1499a..2fb5a8f9be 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -32,7 +32,7 @@
* Author: Andrew Tridgell
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
/*
initialise a ldb context
@@ -481,6 +481,11 @@ void ldb_set_create_perms(struct ldb_context *ldb, unsigned int perms)
ldb->create_perms = perms;
}
+unsigned int ldb_get_create_perms(struct ldb_context *ldb)
+{
+ return ldb->create_perms;
+}
+
void ldb_set_event_context(struct ldb_context *ldb, struct tevent_context *ev)
{
ldb->ev_ctx = ev;
@@ -491,6 +496,16 @@ struct tevent_context * ldb_get_event_context(struct ldb_context *ldb)
return ldb->ev_ctx;
}
+void ldb_request_set_state(struct ldb_request *req, int state)
+{
+ req->handle->state = state;
+}
+
+int ldb_request_get_status(struct ldb_request *req)
+{
+ return req->handle->status;
+}
+
/*
start an ldb request
NOTE: the request must be a talloc context.
diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c
index 001bc45ee1..4d688a4d7e 100644
--- a/source4/lib/ldb/common/ldb_attributes.c
+++ b/source4/lib/ldb/common/ldb_attributes.c
@@ -28,7 +28,7 @@
message matching logic generic
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
/*
add a attribute to the ldb_schema
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c
index 6fad5012b6..0c587e0905 100644
--- a/source4/lib/ldb/common/ldb_controls.c
+++ b/source4/lib/ldb/common/ldb_controls.c
@@ -31,7 +31,7 @@
* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "ldb_private.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 0f78e37c1c..f8009eb8a3 100644
--- a/source4/lib/ldb/common/ldb_debug.c
+++ b/source4/lib/ldb/common/ldb_debug.c
@@ -31,7 +31,7 @@
* Author: Andrew Tridgell
*/
-#include "ldb_includes.h"
+#include "ldb_private.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 02e21a2b25..402d629501 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -33,7 +33,7 @@
* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
#include <ctype.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 619c10e11e..400fb352ff 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -35,7 +35,7 @@
see RFC2849 for the LDIF format definition
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
#include "system/locale.h"
/*
diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c
index 4cde739d67..c622701d30 100644
--- a/source4/lib/ldb/common/ldb_match.c
+++ b/source4/lib/ldb/common/ldb_match.c
@@ -32,7 +32,7 @@
* Author: Andrew Tridgell
*/
-#include "ldb_includes.h"
+#include "ldb_private.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 8db28d262c..03d1e6ebe2 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -31,7 +31,7 @@
* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
#if (_SAMBA_BUILD_ >= 4)
#include "includes.h"
@@ -486,6 +486,41 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
} while (0)
+struct ldb_module *ldb_module_new(TALLOC_CTX *memctx,
+ struct ldb_context *ldb,
+ const char *module_name,
+ const struct ldb_module_ops *ops)
+{
+ struct ldb_module *module;
+
+ module = talloc(memctx, struct ldb_module);
+ if (!module) {
+ ldb_oom(ldb);
+ return NULL;
+ }
+ talloc_set_name_const(module, module_name);
+ module->ldb = ldb;
+ module->prev = module->next = NULL;
+ module->ops = ops;
+
+ return module;
+}
+
+struct ldb_context *ldb_module_get_ctx(struct ldb_module *module)
+{
+ return module->ldb;
+}
+
+void *ldb_module_get_private(struct ldb_module *module)
+{
+ return module->private_data;
+}
+
+void ldb_module_set_private(struct ldb_module *module, void *private_data)
+{
+ module->private_data = private_data;
+}
+
/*
helper functions to call the next module in chain
*/
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 2f5fe1d18c..ad53a3d29d 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -31,7 +31,7 @@
* Author: Andrew Tridgell
*/
-#include "ldb_includes.h"
+#include "ldb_private.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 b233975220..654a635abf 100644
--- a/source4/lib/ldb/common/ldb_parse.c
+++ b/source4/lib/ldb/common/ldb_parse.c
@@ -40,7 +40,7 @@
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
#include "system/locale.h"
/*
diff --git a/source4/lib/ldb/common/ldb_utf8.c b/source4/lib/ldb/common/ldb_utf8.c
index 69ee2b6964..0a8a89ac1d 100644
--- a/source4/lib/ldb/common/ldb_utf8.c
+++ b/source4/lib/ldb/common/ldb_utf8.c
@@ -31,7 +31,7 @@
* Author: Andrew Tridgell
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
#include "system/locale.h"
diff --git a/source4/lib/ldb/common/qsort.c b/source4/lib/ldb/common/qsort.c
index 0fa76d3b47..1a0b886b8c 100644
--- a/source4/lib/ldb/common/qsort.c
+++ b/source4/lib/ldb/common/qsort.c
@@ -23,7 +23,7 @@
* Simo Sorce <idra@samba.org> 2005
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
/* Byte-wise swap two items of size SIZE. */
#define SWAP(a, b, size) \