From 0020793515ade04f3ef5754717490e2eb2ca6bb9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 03:40:44 +0100 Subject: Fix static module list generation for ldb. (This used to be commit 92c1c0e9137f0845cac6cc96bf78711b6aaffe21) --- source4/build/smb_build/header.pm | 10 ++++++++-- source4/lib/ldb/common/ldb.c | 1 - source4/lib/ldb/config.mk | 19 +++++++++---------- source4/lib/ldb/ldb_ildap/config.mk | 1 - source4/lib/ldb/modules/paged_searches.c | 2 +- source4/lib/ldb/nssldb/ldb-nss.c | 5 ----- source4/lib/ldb/tools/ad2oLschema.c | 2 -- source4/lib/ldb/tools/cmdline.c | 2 -- source4/lib/ldb/tools/ldbadd.c | 2 -- 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 | 2 -- source4/lib/ldb/tools/ldbtest.c | 2 -- source4/lib/ldb/tools/oLschema2ldif.c | 2 -- source4/scripting/ejs/smbscript.c | 2 -- source4/smbd/server.c | 2 -- source4/torture/smbtorture.c | 2 -- source4/utils/net/net.c | 2 -- 20 files changed, 18 insertions(+), 48 deletions(-) diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm index 93240f1d17..c2bdbaf4c8 100644 --- a/source4/build/smb_build/header.pm +++ b/source4/build/smb_build/header.pm @@ -44,8 +44,14 @@ sub _prepare_build_h($) $DEFINE->{VAL} .= "\t$_, \\\n"; unless (/{/) { my $fn = $key->{INIT_FUNCTION_TYPE}; - $fn =~ s/\(\*\)/$_/; - $output .= "$fn;\n"; + my $n = $_; + if ($fn =~ /\(\*\)/) { + $fn =~ s/\(\*\)/$n/; + $output .= "$fn;\n"; + } else { + $n =~ s/\&//; + $output .= "$fn $n;\n"; + } } } diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index ce69256c69..5f2e5e3ffc 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -282,7 +282,6 @@ int ldb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, co int ret; const char *url2; /* We seem to need to do this here, or else some utilities don't get ldb backends */ - ldb_global_init(); ldb->flags = flags; diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 0e7caa381f..b44a317a70 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -3,7 +3,7 @@ [MODULE::ldb_asq] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -INIT_FUNCTION = ldb_asq_init +INIT_FUNCTION = &ldb_asq_module_ops SUBSYSTEM = LIBLDB OBJ_FILES = \ modules/asq.o @@ -15,7 +15,7 @@ OBJ_FILES = \ [MODULE::ldb_server_sort] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -INIT_FUNCTION = ldb_sort_init +INIT_FUNCTION = &ldb_server_sort_module_ops SUBSYSTEM = LIBLDB OBJ_FILES = \ modules/sort.o @@ -25,7 +25,7 @@ OBJ_FILES = \ ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_results] -INIT_FUNCTION = ldb_paged_results_init +INIT_FUNCTION = &ldb_paged_results_module_ops CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -37,7 +37,7 @@ OBJ_FILES = \ ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_searches] -INIT_FUNCTION = ldb_paged_searches_init +INIT_FUNCTION = &ldb_paged_searches_module_ops CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -52,7 +52,7 @@ OBJ_FILES = \ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = ldb_operational_init +INIT_FUNCTION = &ldb_operational_module_ops OBJ_FILES = \ modules/operational.o # End MODULE ldb_operational @@ -64,7 +64,7 @@ OBJ_FILES = \ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = ldb_rdn_name_init +INIT_FUNCTION = &ldb_rdn_name_module_ops OBJ_FILES = \ modules/rdn_name.o # End MODULE ldb_rdn_name @@ -88,7 +88,7 @@ OBJ_FILES = \ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = ldb_skel_init +INIT_FUNCTION = &ldb_skel_module_ops OBJ_FILES = modules/skel.o # End MODULE ldb_skel ################################################ @@ -99,7 +99,7 @@ OBJ_FILES = modules/skel.o SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC -INIT_FUNCTION = ldb_sqlite3_init +INIT_FUNCTION = &ldb_sqlite3_module_ops OBJ_FILES = \ ldb_sqlite3/ldb_sqlite3.o # End MODULE ldb_sqlite3 @@ -110,7 +110,6 @@ OBJ_FILES = \ [MODULE::ldb_tdb] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_tdb -INIT_FUNCTION = ldb_tdb_init OBJ_FILES = \ ldb_tdb/ldb_tdb.o \ ldb_tdb/ldb_search.o \ @@ -131,7 +130,7 @@ SO_VERSION = 0 OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include PC_FILE = ldb.pc -INIT_FUNCTION_TYPE = int (*) (void) +INIT_FUNCTION_TYPE = extern const struct ldb_module_ops OBJ_FILES = \ common/ldb.o \ common/ldb_ldif.o \ diff --git a/source4/lib/ldb/ldb_ildap/config.mk b/source4/lib/ldb/ldb_ildap/config.mk index 01d9ec88ff..3062dc886f 100644 --- a/source4/lib/ldb/ldb_ildap/config.mk +++ b/source4/lib/ldb/ldb_ildap/config.mk @@ -5,7 +5,6 @@ SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBCLI_LDAP CREDENTIALS -INIT_FUNCTION = ldb_ildap_init ALIASES = ldapi ldaps ldap OBJ_FILES = \ ldb_ildap.o diff --git a/source4/lib/ldb/modules/paged_searches.c b/source4/lib/ldb/modules/paged_searches.c index 88ebd13921..7406e91c9d 100644 --- a/source4/lib/ldb/modules/paged_searches.c +++ b/source4/lib/ldb/modules/paged_searches.c @@ -455,7 +455,7 @@ static int ps_init(struct ldb_module *module) return ldb_next_init(module); } -const struct ldb_module_ops ldb_pages_searches_module_ops = { +const struct ldb_module_ops ldb_paged_searches_module_ops = { .name = "paged_searches", .search = ps_search, .wait = ps_wait, diff --git a/source4/lib/ldb/nssldb/ldb-nss.c b/source4/lib/ldb/nssldb/ldb-nss.c index 199212dbbf..e256f41a4d 100644 --- a/source4/lib/ldb/nssldb/ldb-nss.c +++ b/source4/lib/ldb/nssldb/ldb-nss.c @@ -45,11 +45,6 @@ NSS_STATUS _ldb_nss_init(void) _ldb_nss_ctx->pid = mypid; - ret = ldb_global_init(); - if (ret != 0) { - goto failed; - } - _ldb_nss_ctx->ldb = ldb_init(_ldb_nss_ctx); if (_ldb_nss_ctx->ldb == NULL) { goto failed; diff --git a/source4/lib/ldb/tools/ad2oLschema.c b/source4/lib/ldb/tools/ad2oLschema.c index dec8a5f972..67b16dd06e 100644 --- a/source4/lib/ldb/tools/ad2oLschema.c +++ b/source4/lib/ldb/tools/ad2oLschema.c @@ -656,8 +656,6 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_ const char *target_str; enum convert_target target; - ldb_global_init(); - ctx = talloc_new(NULL); ldb = ldb_init(ctx); diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index 8ee1994615..c9c77c4e47 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -80,8 +80,6 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, { NULL } }; - ldb_global_init(); - #if (_SAMBA_BUILD_ >= 4) 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 d34193b86c..4ee66c4fc0 100644 --- a/source4/lib/ldb/tools/ldbadd.c +++ b/source4/lib/ldb/tools/ldbadd.c @@ -88,8 +88,6 @@ int main(int argc, const char **argv) int i, ret=0, 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 fcd0978779..184172b22b 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -77,8 +77,6 @@ int main(int argc, const char **argv) int ret = 0, 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 ed98a6d615..a9fd064bf8 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -279,8 +279,6 @@ int main(int argc, const char **argv) 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 ed12380095..dd6206b824 100644 --- a/source4/lib/ldb/tools/ldbmodify.c +++ b/source4/lib/ldb/tools/ldbmodify.c @@ -89,8 +89,6 @@ int main(int argc, const char **argv) int i, ret=LDB_SUCCESS; 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 c160e87ee4..b36310a500 100644 --- a/source4/lib/ldb/tools/ldbrename.c +++ b/source4/lib/ldb/tools/ldbrename.c @@ -56,8 +56,6 @@ int main(int argc, const char **argv) struct ldb_cmdline *options; 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 24ceb30963..e25bd19965 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -276,8 +276,6 @@ int main(int argc, const char **argv) 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 5c21dd3830..57a7848733 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -393,8 +393,6 @@ int main(int argc, const char **argv) 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 7b5f1b835c..1846a2c852 100644 --- a/source4/lib/ldb/tools/oLschema2ldif.c +++ b/source4/lib/ldb/tools/oLschema2ldif.c @@ -560,8 +560,6 @@ static void usage(void) struct ldb_cmdline *options; FILE *in = stdin; FILE *out = stdout; - ldb_global_init(); - ctx = talloc_new(NULL); ldb_ctx = ldb_init(ctx); diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c index a4f2e1cd43..9ed4aa490f 100644 --- a/source4/scripting/ejs/smbscript.c +++ b/source4/scripting/ejs/smbscript.c @@ -61,8 +61,6 @@ int main(int argc, const char **argv) lp_load(lp_ctx, dyn_CONFIGFILE); } - ldb_global_init(); - gensec_init(lp_ctx); mprSetCtx(mem_ctx); diff --git a/source4/smbd/server.c b/source4/smbd/server.c index c256eed96c..dd63ca1eca 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -282,8 +282,6 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ exit(1); } - ldb_global_init(); /* FIXME: */ - share_init(); gensec_init(cmdline_lp_ctx); /* FIXME: */ diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 371ddc7297..4eeea73003 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -615,8 +615,6 @@ int main(int argc,char *argv[]) alarm(max_runtime); } - ldb_global_init(); - if (extra_module != NULL) { init_module_fn fn = load_module(talloc_autofree_context(), poptGetOptArg(pc)); diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index 2c95e9033d..e0865c4416 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -182,8 +182,6 @@ static int binary_net(int argc, const char **argv) dcerpc_init(); - ldb_global_init(); - mem_ctx = talloc_init("net_context"); ctx = talloc(mem_ctx, struct net_context); if (!ctx) { -- cgit