From 26af14c39b88b0e7eb53657b89be65d865804688 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 2 Mar 2006 16:32:53 +0000 Subject: r13786: [merge] Add registration functions for LDB modules Applications that use LDB modules will now have to run ldb_global_init() before they can use LDB. The next step will be adding support for loading LDB modules from .so files. This will also allow us to use one LDB without difference between the standalone and the Samba-specific build (This used to be commit 52a235650514039bf8ffee99a784bbc1b6ae6b92) --- source4/lib/ldb/tools/cmdline.c | 2 ++ source4/lib/ldb/tools/ldbadd.c | 4 +++- source4/lib/ldb/tools/ldbdel.c | 2 ++ source4/lib/ldb/tools/ldbedit.c | 2 ++ source4/lib/ldb/tools/ldbmodify.c | 2 ++ source4/lib/ldb/tools/ldbrename.c | 2 ++ source4/lib/ldb/tools/ldbsearch.c | 4 +++- source4/lib/ldb/tools/ldbtest.c | 2 ++ source4/lib/ldb/tools/oLschema2ldif.c | 2 ++ 9 files changed, 20 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb/tools') diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index a67c41e67f..8f803c5118 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -71,6 +71,8 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const POPT_TABLEEND }; + ldb_global_init(); + #ifdef _SAMBA_BUILD_ r = ldb_register_samba_handlers(ldb); if (r != 0) { diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c index 0d5acd3787..6a0f510244 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -84,12 +84,14 @@ static int process_file(struct ldb_context *ldb, FILE *f) - int main(int argc, const char **argv) +int main(int argc, const char **argv) { struct ldb_context *ldb; int i, count=0; struct ldb_cmdline *options; + ldb_global_init(); + ldb = ldb_init(NULL); options = ldb_cmdline_process(ldb, argc, argv, usage); diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c index 26544d8a9e..749ce3f91c 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -79,6 +79,8 @@ static void usage(void) int ret, i; struct ldb_cmdline *options; + ldb_global_init(); + ldb = ldb_init(NULL); options = ldb_cmdline_process(ldb, argc, argv, usage); diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index 9cef81f1db..b4e2b0a848 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -281,6 +281,8 @@ static void usage(void) const char *expression = "(|(objectClass=*)(distinguishedName=*))"; const char * const * attrs = NULL; + ldb_global_init(); + ldb = ldb_init(NULL); options = ldb_cmdline_process(ldb, argc, argv, usage); diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c index e785a42a23..4ce49c2ce8 100644 --- a/source4/lib/ldb/tools/ldbmodify.c +++ b/source4/lib/ldb/tools/ldbmodify.c @@ -91,6 +91,8 @@ static int process_file(struct ldb_context *ldb, FILE *f) int i; struct ldb_cmdline *options; + ldb_global_init(); + ldb = ldb_init(NULL); options = ldb_cmdline_process(ldb, argc, argv, usage); diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c index 9c37744277..3229426875 100644 --- a/source4/lib/ldb/tools/ldbrename.c +++ b/source4/lib/ldb/tools/ldbrename.c @@ -58,6 +58,8 @@ static void usage(void) struct ldb_cmdline *options; const struct ldb_dn *dn1, *dn2; + ldb_global_init(); + ldb = ldb_init(NULL); options = ldb_cmdline_process(ldb, argc, argv, usage); diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index c380862c5d..fbf32c0777 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -148,7 +148,7 @@ static int do_search(struct ldb_context *ldb, return 0; } - int main(int argc, const char **argv) +int main(int argc, const char **argv) { struct ldb_context *ldb; struct ldb_dn *basedn = NULL; @@ -157,6 +157,8 @@ static int do_search(struct ldb_context *ldb, int ret = -1; const char *expression = "(|(objectClass=*)(distinguishedName=*))"; + ldb_global_init(); + ldb = ldb_init(NULL); options = ldb_cmdline_process(ldb, argc, argv, usage); diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index 69362d0f20..5fd75a0cab 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -376,6 +376,8 @@ static void usage(void) TALLOC_CTX *mem_ctx = talloc_new(NULL); struct ldb_context *ldb; + ldb_global_init(); + ldb = ldb_init(mem_ctx); options = ldb_cmdline_process(ldb, argc, argv, usage); diff --git a/source4/lib/ldb/tools/oLschema2ldif.c b/source4/lib/ldb/tools/oLschema2ldif.c index b4fe421161..288cf4c3c3 100644 --- a/source4/lib/ldb/tools/oLschema2ldif.c +++ b/source4/lib/ldb/tools/oLschema2ldif.c @@ -583,6 +583,8 @@ static void usage(void) FILE *in = stdin; FILE *out = stdout; + ldb_global_init(); + ctx = talloc_new(NULL); ldb_ctx = ldb_init(ctx); -- cgit