From dd4ffd868b59f12a190af49eadfece34a395b34d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 17 Feb 2008 22:57:04 +0100 Subject: Fix paths for talloc into unpacked directory (rsync commands). Michael (This used to be commit 2839d7f67a0d3ed5b4841bf3c12ce73972636b88) --- source4/lib/talloc/web/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/talloc/web/index.html b/source4/lib/talloc/web/index.html index e53e8960a8..90f6577b2d 100644 --- a/source4/lib/talloc/web/index.html +++ b/source4/lib/talloc/web/index.html @@ -35,8 +35,8 @@ svn. To fetch via svn use the following command: To fetch via rsync use this command:
-  rsync -Pavz samba.org::ftp/unpacked/samba4/source/lib/talloc .
-  rsync -Pavz samba.org::ftp/unpacked/samba4/source/lib/libreplace .
+  rsync -Pavz samba.org::ftp/unpacked/samba_4_0_test/source/lib/talloc .
+  rsync -Pavz samba.org::ftp/unpacked/samba_4_0_test/source/lib/libreplace .
 

-- cgit From c65cded541ff123ee6d126f757f541961e9ad717 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 18 Feb 2008 22:49:32 +0100 Subject: Adapt source code checkout information to git repo in talloc website. Michael (This used to be commit 254be79799acc69db88a5500a2f755c84553f8ef) --- source4/lib/talloc/web/index.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/talloc/web/index.html b/source4/lib/talloc/web/index.html index 90f6577b2d..628030ad4c 100644 --- a/source4/lib/talloc/web/index.html +++ b/source4/lib/talloc/web/index.html @@ -24,12 +24,13 @@ bugzilla bug tracking system.

Download

-You can download the latest release either via rsync or anonymous -svn. To fetch via svn use the following command: +You can download the latest release either via rsync or git. +To fetch via git use the following command:
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/talloc talloc
-  svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0/source/lib/replace libreplace
+  git-clone git://git.samba.org/samba.git samba
+  cd samba
+  git checkout -b samba4 origin/v4-0-test
 
To fetch via rsync use this command: -- cgit From 5233e43ec7e96afb905f026309b0894178c96499 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 19 Feb 2008 17:25:42 +0100 Subject: Remove relict SAMBA_CONFIGURE_CPPFLAGS from lib/replace. Michael (This used to be commit d10cbb533c18a6d74160477d34a81bbd4cd6c7c8) --- source4/lib/replace/getifaddrs.m4 | 3 --- 1 file changed, 3 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 index 297a82d0c3..4259d1a7a3 100644 --- a/source4/lib/replace/getifaddrs.m4 +++ b/source4/lib/replace/getifaddrs.m4 @@ -43,8 +43,6 @@ iface=no; # look for a method of finding the list of network interfaces iface=no; AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_IFACE_GETIFADDRS,[ -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS}" AC_TRY_RUN([ #define NO_CONFIG_H 1 #define HAVE_IFACE_GETIFADDRS 1 @@ -52,7 +50,6 @@ AC_TRY_RUN([ #include "$libreplacedir/replace.c" #include "$libreplacedir/getifaddrs.c"], samba_cv_HAVE_IFACE_GETIFADDRS=yes,samba_cv_HAVE_IFACE_GETIFADDRS=no,samba_cv_HAVE_IFACE_GETIFADDRS=cross)]) -CPPFLAGS="$SAVE_CPPFLAGS" if test x"$samba_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available]) else -- cgit From 836bab841cff78c40714048f8024535cb7a147f9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 19 Feb 2008 23:00:43 +0100 Subject: Add configure test for vdeplug library. (This used to be commit 89590d7dfe0735093a4a5b66eeed9276df043ac9) --- source4/lib/socket_wrapper/config.m4 | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/socket_wrapper/config.m4 b/source4/lib/socket_wrapper/config.m4 index f3ffb895a9..8ff91075bb 100644 --- a/source4/lib/socket_wrapper/config.m4 +++ b/source4/lib/socket_wrapper/config.m4 @@ -20,3 +20,10 @@ fi AC_SUBST(DEFAULT_TEST_OPTIONS) AC_SUBST(HAVE_SOCKET_WRAPPER) AC_SUBST(SOCKET_WRAPPER_OBJS) + +# Look for the vdeplug library +AC_CHECK_HEADERS(libvdeplug.h) +if test x"$ac_cv_header_libvdeplug_h" = xyes; then + AC_DEFINE(HAVE_VDEPLUG, 1, [Whether the VDE plug library is available]) + SMB_EXT_LIB(VDEPLUG,[-lvdeplug],[],[],[]) +fi -- cgit From 15b86081cd2df734479fcaf92a482c7896bef605 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 19 Feb 2008 23:53:04 +0100 Subject: Factor out IP marshalling into separate function. (This used to be commit 2548c2a1e7dab8abc00f8f49374a08cc0b427552) --- source4/lib/socket_wrapper/socket_wrapper.c | 79 ++++++++++++++++------------- 1 file changed, 43 insertions(+), 36 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c index 574d8ec5e4..644365a665 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.c +++ b/source4/lib/socket_wrapper/socket_wrapper.c @@ -1,5 +1,5 @@ /* - * Copyright (C) Jelmer Vernooij 2005 + * Copyright (C) Jelmer Vernooij 2005,2008 * Copyright (C) Stefan Metzmacher 2006 * * All rights reserved. @@ -212,7 +212,6 @@ struct socket_info static struct socket_info *sockets; - const char *socket_wrapper_dir(void) { const char *s = getenv("SOCKET_WRAPPER_DIR"); @@ -908,40 +907,31 @@ static int swrap_get_pcap_fd(const char *fname) return fd; } -static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *addr, - enum swrap_packet_type type, - const void *buf, size_t len) +static struct swrap_packet *swrap_marshall_packet(struct socket_info *si, + const struct sockaddr *addr, + enum swrap_packet_type type, + const void *buf, size_t len, + size_t *packet_len) { const struct sockaddr_in *src_addr; const struct sockaddr_in *dest_addr; - const char *file_name; unsigned long tcp_seq = 0; unsigned long tcp_ack = 0; unsigned char tcp_ctl = 0; int unreachable = 0; - struct timeval tv; - struct swrap_packet *packet; - size_t packet_len = 0; - int fd; - file_name = socket_wrapper_pcap_file(); - if (!file_name) { - return; - } + struct timeval tv; switch (si->family) { case AF_INET: -#ifdef HAVE_IPV6 - case AF_INET6: -#endif break; default: - return; + return NULL; } switch (type) { case SWRAP_CONNECT_SEND: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; src_addr = (const struct sockaddr_in *)si->myname; dest_addr = (const struct sockaddr_in *)addr; @@ -955,7 +945,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_CONNECT_RECV: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; dest_addr = (const struct sockaddr_in *)si->myname; src_addr = (const struct sockaddr_in *)addr; @@ -969,7 +959,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_CONNECT_UNREACH: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; dest_addr = (const struct sockaddr_in *)si->myname; src_addr = (const struct sockaddr_in *)addr; @@ -983,7 +973,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_CONNECT_ACK: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; src_addr = (const struct sockaddr_in *)si->myname; dest_addr = (const struct sockaddr_in *)addr; @@ -995,7 +985,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_ACCEPT_SEND: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; dest_addr = (const struct sockaddr_in *)si->myname; src_addr = (const struct sockaddr_in *)addr; @@ -1009,7 +999,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_ACCEPT_RECV: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; src_addr = (const struct sockaddr_in *)si->myname; dest_addr = (const struct sockaddr_in *)addr; @@ -1023,7 +1013,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_ACCEPT_ACK: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; dest_addr = (const struct sockaddr_in *)si->myname; src_addr = (const struct sockaddr_in *)addr; @@ -1051,10 +1041,9 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add src_addr = (const struct sockaddr_in *)si->peername; if (si->type == SOCK_DGRAM) { - swrap_dump_packet(si, si->peername, + return swrap_marshall_packet(si, si->peername, SWRAP_SENDTO_UNREACH, - buf, len); - return; + buf, len, packet_len); } tcp_seq = si->io.pck_rcv; @@ -1068,7 +1057,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add src_addr = (const struct sockaddr_in *)si->peername; if (si->type == SOCK_DGRAM) { - return; + return NULL; } tcp_seq = si->io.pck_rcv; @@ -1094,7 +1083,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add src_addr = (const struct sockaddr_in *)si->peername; if (si->type == SOCK_DGRAM) { - return; + return NULL; } tcp_seq = si->io.pck_rcv; @@ -1128,7 +1117,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_CLOSE_SEND: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; src_addr = (const struct sockaddr_in *)si->myname; dest_addr = (const struct sockaddr_in *)si->peername; @@ -1142,7 +1131,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_CLOSE_RECV: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; dest_addr = (const struct sockaddr_in *)si->myname; src_addr = (const struct sockaddr_in *)si->peername; @@ -1156,7 +1145,7 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; case SWRAP_CLOSE_ACK: - if (si->type != SOCK_STREAM) return; + if (si->type != SOCK_STREAM) return NULL; src_addr = (const struct sockaddr_in *)si->myname; dest_addr = (const struct sockaddr_in *)si->peername; @@ -1167,15 +1156,33 @@ static void swrap_dump_packet(struct socket_info *si, const struct sockaddr *add break; default: - return; + return NULL; } swrapGetTimeOfDay(&tv); - packet = swrap_packet_init(&tv, src_addr, dest_addr, si->type, + return swrap_packet_init(&tv, src_addr, dest_addr, si->type, (const unsigned char *)buf, len, tcp_seq, tcp_ack, tcp_ctl, unreachable, - &packet_len); + packet_len); +} + +static void swrap_dump_packet(struct socket_info *si, + const struct sockaddr *addr, + enum swrap_packet_type type, + const void *buf, size_t len) +{ + const char *file_name; + struct swrap_packet *packet; + size_t packet_len = 0; + int fd; + + file_name = socket_wrapper_pcap_file(); + if (!file_name) { + return; + } + + packet = swrap_marshall_packet(si, addr, type, buf, len, &packet_len); if (!packet) { return; } -- cgit From 71bc5acead0e16473273eb8741373e865b6d2c44 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 01:37:53 +0100 Subject: Allow ldb backends without init function, use init function-less ldb modules. (This used to be commit 141ee91272fb4dafca0149f679e17721b6a3011e) --- source4/lib/ldb/Makefile.in | 2 +- source4/lib/ldb/common/ldb.c | 9 +++++++++ source4/lib/ldb/common/ldb_modules.c | 9 +++++++-- source4/lib/ldb/ldb.mk | 2 +- source4/lib/ldb/tests/sample_module.c | 9 ++------- 5 files changed, 20 insertions(+), 11 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in index 756beb1fed..d88f82b726 100644 --- a/source4/lib/ldb/Makefile.in +++ b/source4/lib/ldb/Makefile.in @@ -125,7 +125,7 @@ realdistclean:: distclean check:: test @PYTHON_CHECK_TARGET@ -check-soloading: sample_module.$(SHLIBEXT) +check-soloading: sample.$(SHLIBEXT) LDB_MODULES_PATH=$(builddir) $(srcdir)/tests/test-soloading.sh test:: all check-soloading diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 87f791cb38..ffda705a0b 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -135,6 +135,15 @@ int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *op } } + if (fn == NULL) { + char *symbol_name = talloc_asprintf(ldb, "ldb_%s_connect", backend); + if (symbol_name == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + fn = ldb_dso_load_symbol(ldb, backend, symbol_name); + talloc_free(symbol_name); + } + talloc_free(backend); if (fn == NULL) { diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 18070bdb86..2dae40ddb0 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -257,8 +257,13 @@ int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, str } if (ops == NULL) { - ops = ldb_dso_load_symbol(ldb, module_list[i], - "ldb_module_ops"); + char *symbol_name = talloc_asprintf(ldb, "ldb_%s_module_ops", + module_list[i]); + if (symbol_name == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + ops = ldb_dso_load_symbol(ldb, module_list[i], symbol_name); + talloc_free(symbol_name); } if (ops == NULL) { diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk index 6119f085d8..cc920178bc 100644 --- a/source4/lib/ldb/ldb.mk +++ b/source4/lib/ldb/ldb.mk @@ -31,7 +31,7 @@ lib/libldb.a: $(OBJS) ar -rv $@ $(OBJS) @-ranlib $@ -sample_module.$(SHLIBEXT): tests/sample_module.o +sample.$(SHLIBEXT): tests/sample_module.o $(MDLD) $(MDLD_FLAGS) -o $@ tests/sample_module.o bin/ldbadd: tools/ldbadd.o tools/cmdline.o $(LIBS) diff --git a/source4/lib/ldb/tests/sample_module.c b/source4/lib/ldb/tests/sample_module.c index 8ab1d33146..1a9e72c907 100644 --- a/source4/lib/ldb/tests/sample_module.c +++ b/source4/lib/ldb/tests/sample_module.c @@ -32,12 +32,7 @@ int sample_add(struct ldb_module *mod, struct ldb_request *req) return ldb_next_request(mod, req); } -static const struct ldb_module_ops sample_ops = { - .name = "sample_module", +const struct ldb_module_ops ldb_sample_module_ops = { + .name = "sample", .add = sample_add, }; - -int init_module(void) -{ - return ldb_register_module(&sample_ops); -} -- cgit From 16109a40c0abd8c30a5eb9bf9ef692bfae9dfc7d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 01:54:32 +0100 Subject: Use struct-based rather than function-based initialization for ldb modules everywhere. (This used to be commit 85c96a325867f7bcdb412ebc53f8a47dbf7cd89b) --- source4/lib/ldb/ldb_map/ldb_map.c | 38 +------------------------------ source4/lib/ldb/ldb_map/ldb_map.h | 17 +++++++++++--- source4/lib/ldb/ldb_map/ldb_map_private.h | 7 ------ source4/lib/ldb/modules/asq.c | 8 +------ source4/lib/ldb/modules/operational.c | 7 +----- source4/lib/ldb/modules/paged_results.c | 8 +------ source4/lib/ldb/modules/paged_searches.c | 8 +------ source4/lib/ldb/modules/rdn_name.c | 8 +------ source4/lib/ldb/modules/skel.c | 7 +----- source4/lib/ldb/modules/sort.c | 7 +----- 10 files changed, 22 insertions(+), 93 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index 9582f36130..9c189feb11 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -1186,7 +1186,7 @@ static int map_wait_all(struct ldb_handle *handle) } /* Wait for pending requests to finish. */ -static int map_wait(struct ldb_handle *handle, enum ldb_wait_type type) +int map_wait(struct ldb_handle *handle, enum ldb_wait_type type) { if (type == LDB_WAIT_ALL) { return map_wait_all(handle); @@ -1199,16 +1199,6 @@ static int map_wait(struct ldb_handle *handle, enum ldb_wait_type type) /* Module initialization * ===================== */ -/* Provided module operations */ -static const struct ldb_module_ops map_ops = { - .name = "ldb_map", - .add = map_add, - .modify = map_modify, - .del = map_delete, - .rename = map_rename, - .search = map_search, - .wait = map_wait, -}; /* Builtin mappings for DNs and objectClasses */ static const struct ldb_map_attribute builtin_attribute_maps[] = { @@ -1344,12 +1334,6 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data return LDB_SUCCESS; } -/* Copy the list of provided module operations. */ -_PUBLIC_ struct ldb_module_ops ldb_map_get_ops(void) -{ - return map_ops; -} - /* Initialize global private data. */ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs, const struct ldb_map_objectclass *ocls, @@ -1393,23 +1377,3 @@ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attrib return LDB_SUCCESS; } - -/* Usage note for initialization of this module: - * - * ldb_map is meant to be used from a different module that sets up - * the mappings and gets registered in ldb. - * - * 'ldb_map_init' initializes the private data of this module and - * stores the attribute and objectClass maps in there. It also looks - * up the '@MAP' special DN so requests can be redirected to the - * remote partition. - * - * This function should be called from the 'init_context' op of the - * module using ldb_map. - * - * 'ldb_map_get_ops' returns a copy of ldb_maps module operations. - * - * It should be called from the initialize function of the using - * module, which should then override the 'init_context' op with a - * function making the appropriate calls to 'ldb_map_init'. - */ diff --git a/source4/lib/ldb/ldb_map/ldb_map.h b/source4/lib/ldb/ldb_map/ldb_map.h index ef4da4e654..e40bb9cd7e 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.h +++ b/source4/lib/ldb/ldb_map/ldb_map.h @@ -155,8 +155,19 @@ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attr const char *add_objectclass, const char *name); -/* get copy of map_ops */ -struct ldb_module_ops -ldb_map_get_ops(void); +int map_add(struct ldb_module *module, struct ldb_request *req); +int map_search(struct ldb_module *module, struct ldb_request *req); +int map_rename(struct ldb_module *module, struct ldb_request *req); +int map_delete(struct ldb_module *module, struct ldb_request *req); +int map_modify(struct ldb_module *module, struct ldb_request *req); +int map_wait(struct ldb_handle *handle, enum ldb_wait_type type); + +#define LDB_MAP_OPS \ + .add = map_add, \ + .modify = map_modify, \ + .del = map_delete, \ + .rename = map_rename, \ + .search = map_search, \ + .wait = map_wait, #endif /* __LDB_MAP_H__ */ diff --git a/source4/lib/ldb/ldb_map/ldb_map_private.h b/source4/lib/ldb/ldb_map/ldb_map_private.h index 2c35097069..58a9f2704e 100644 --- a/source4/lib/ldb/ldb_map/ldb_map_private.h +++ b/source4/lib/ldb/ldb_map/ldb_map_private.h @@ -98,20 +98,13 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, /* The following definitions come from lib/ldb/modules/ldb_map_inbound.c */ int map_add_do_remote(struct ldb_handle *handle); int map_add_do_local(struct ldb_handle *handle); -int map_add(struct ldb_module *module, struct ldb_request *req); int map_modify_do_remote(struct ldb_handle *handle); int map_modify_do_local(struct ldb_handle *handle); -int map_modify(struct ldb_module *module, struct ldb_request *req); int map_delete_do_remote(struct ldb_handle *handle); int map_delete_do_local(struct ldb_handle *handle); -int map_delete(struct ldb_module *module, struct ldb_request *req); int map_rename_do_remote(struct ldb_handle *handle); int map_rename_do_fixup(struct ldb_handle *handle); int map_rename_do_local(struct ldb_handle *handle); -int map_rename(struct ldb_module *module, struct ldb_request *req); - -/* The following definitions come from lib/ldb/modules/ldb_map_outbound.c */ -int map_search(struct ldb_module *module, struct ldb_request *req); diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c index b6a8594166..eb27263b16 100644 --- a/source4/lib/ldb/modules/asq.c +++ b/source4/lib/ldb/modules/asq.c @@ -473,15 +473,9 @@ static int asq_init(struct ldb_module *module) return ldb_next_init(module); } - -static const struct ldb_module_ops asq_ops = { +const struct ldb_module_ops ldb_asq_module_ops = { .name = "asq", .search = asq_search, .wait = asq_wait, .init_context = asq_init }; - -int ldb_asq_init(void) -{ - return ldb_register_module(&asq_ops); -} diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index 45f23aa0c1..7dc4ae08c3 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -304,13 +304,8 @@ static int operational_init(struct ldb_module *ctx) return ldb_next_init(ctx); } -static const struct ldb_module_ops operational_ops = { +const struct ldb_module_ops ldb_operational_module_ops = { .name = "operational", .search = operational_search, .init_context = operational_init }; - -int ldb_operational_init(void) -{ - return ldb_register_module(&operational_ops); -} diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index ee1bbe0335..b62b1f92cb 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -549,15 +549,9 @@ static int paged_request_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops paged_ops = { +const struct ldb_module_ops ldb_paged_results_module_ops = { .name = "paged_results", .search = paged_search, .wait = paged_wait, .init_context = paged_request_init }; - -int ldb_paged_results_init(void) -{ - return ldb_register_module(&paged_ops); -} - diff --git a/source4/lib/ldb/modules/paged_searches.c b/source4/lib/ldb/modules/paged_searches.c index fd580a3c4a..88ebd13921 100644 --- a/source4/lib/ldb/modules/paged_searches.c +++ b/source4/lib/ldb/modules/paged_searches.c @@ -455,15 +455,9 @@ static int ps_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops ps_ops = { +const struct ldb_module_ops ldb_pages_searches_module_ops = { .name = "paged_searches", .search = ps_search, .wait = ps_wait, .init_context = ps_init }; - -int ldb_paged_searches_init(void) -{ - return ldb_register_module(&ps_ops); -} - diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index 1a0ddbb3c4..c4de8e8da8 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -326,15 +326,9 @@ static int rdn_name_wait(struct ldb_handle *handle, enum ldb_wait_type type) return rdn_name_wait_once(handle); } -static const struct ldb_module_ops rdn_name_ops = { +const struct ldb_module_ops ldb_rdn_name_module_ops = { .name = "rdn_name", .add = rdn_name_add, .rename = rdn_name_rename, .wait = rdn_name_wait }; - - -int ldb_rdn_name_init(void) -{ - return ldb_register_module(&rdn_name_ops); -} diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c index 5400c502f1..0cd29ac4b7 100644 --- a/source4/lib/ldb/modules/skel.c +++ b/source4/lib/ldb/modules/skel.c @@ -116,7 +116,7 @@ static int skel_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops skel_ops = { +const struct ldb_module_ops ldb_skel_module_ops = { .name = "skel", .init_context = skel_init, .search = skel_search, @@ -129,8 +129,3 @@ static const struct ldb_module_ops skel_ops = { .end_transaction = skel_end_trans, .del_transaction = skel_del_trans, }; - -int ldb_skel_init(void) -{ - return ldb_register_module(&skel_ops); -} diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c index 89b9a4fb19..746befa559 100644 --- a/source4/lib/ldb/modules/sort.c +++ b/source4/lib/ldb/modules/sort.c @@ -450,14 +450,9 @@ static int server_sort_init(struct ldb_module *module) return ldb_next_init(module); } -static const struct ldb_module_ops server_sort_ops = { +const struct ldb_module_ops ldb_server_sort_module_ops = { .name = "server_sort", .search = server_sort_search, .wait = server_sort_wait, .init_context = server_sort_init }; - -int ldb_sort_init(void) -{ - return ldb_register_module(&server_sort_ops); -} -- cgit From e3661a6181a7fbeffb02745adda509c01779d5ca Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 01:56:55 +0100 Subject: Use function-based initialization for ildap backend. (This used to be commit 46e5027f56722fbe19af36aad1ab03ea1c862f43) --- source4/lib/ldb/ldb_ildap/ldb_ildap.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index a834e912d4..8ad6830c43 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -811,9 +811,6 @@ failed: return -1; } -int ldb_ildap_init(void) -{ - return ldb_register_backend("ldap", ildb_connect) + - ldb_register_backend("ldapi", ildb_connect) + - ldb_register_backend("ldaps", ildb_connect); -} +ldb_connect_fn ldb_ldap_connect = ildb_connect; +ldb_connect_fn ldb_ldapi_connect = ildb_connect; +ldb_connect_fn ldb_ldaps_connect = ildb_connect; -- cgit From 995788536e5ba7b3a0e67e377a9769b279d0b8ae Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 02:57:07 +0100 Subject: Remove more function-based inits. (This used to be commit b1a7810f3e70f9a831d9b8e85d531e448072adaf) --- source4/lib/ldb/common/ldb.c | 59 +++++++++++++++++++++------ source4/lib/ldb/common/ldb_modules.c | 66 ++++++++++--------------------- source4/lib/ldb/include/ldb_private.h | 37 +++++++++++------ source4/lib/ldb/ldb_ildap/ldb_ildap.c | 18 +++++++-- source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 8 ++-- source4/lib/ldb/ldb_tdb/ldb_tdb.c | 8 ++-- 6 files changed, 118 insertions(+), 78 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index ffda705a0b..ce69256c69 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -56,20 +56,51 @@ struct ldb_context *ldb_init(void *mem_ctx) return ldb; } -struct ldb_backend { - const char *name; - ldb_connect_fn connect_fn; - struct ldb_backend *prev, *next; +static struct backends_list_entry { + struct ldb_backend_ops *ops; + struct backends_list_entry *prev, *next; } *ldb_backends = NULL; +#ifndef STATIC_LIBLDB_BACKENDS + +#ifdef HAVE_LDB_LDAP +#define LDAP_INIT &ldb_ldap_backend_ops, \ + &ldb_ildap_backend_ops, \ + &ldb_ldaps_backend_ops, +#else +#define LDAP_INIT +#endif + +#ifdef HAVE_LDB_SQLITE3 +#define SQLITE3_INIT &ldb_sqlite3_backend_ops, +#else +#define SQLITE3_INIT +#endif + +#define STATIC_LIBLDB_BACKENDS \ + LDAP_INIT \ + SQLITE3_INIT \ + &ldb_tdb_backend_ops, \ + NULL +#endif + +const static struct ldb_backend_ops *builtin_backends[] = { + STATIC_LIBLDB_BACKENDS +}; static ldb_connect_fn ldb_find_backend(const char *url) { - struct ldb_backend *backend; + struct backends_list_entry *backend; + int i; + + for (i = 0; builtin_backends[i]; i++) { + if (strncmp(builtin_backends[i]->name, url, strlen(builtin_backends[i]->name)) == 0) + return builtin_backends[i]->connect_fn; + } for (backend = ldb_backends; backend; backend = backend->next) { - if (strncmp(backend->name, url, strlen(backend->name)) == 0) { - return backend->connect_fn; + if (strncmp(backend->ops->name, url, strlen(backend->ops->name)) == 0) { + return backend->ops->connect_fn; } } @@ -81,7 +112,8 @@ static ldb_connect_fn ldb_find_backend(const char *url) */ int ldb_register_backend(const char *url_prefix, ldb_connect_fn connectfn) { - struct ldb_backend *backend = talloc(talloc_autofree_context(), struct ldb_backend); + struct ldb_backend_ops *backend = talloc(talloc_autofree_context(), struct ldb_backend_ops); + struct backends_list_entry *entry = talloc(talloc_autofree_context(), struct backends_list_entry); if (ldb_find_backend(url_prefix)) { return LDB_SUCCESS; @@ -91,7 +123,8 @@ int ldb_register_backend(const char *url_prefix, ldb_connect_fn connectfn) backend->name = talloc_strdup(backend, url_prefix); backend->connect_fn = connectfn; - DLIST_ADD(ldb_backends, backend); + entry->ops = backend; + DLIST_ADD(ldb_backends, entry); return LDB_SUCCESS; } @@ -136,11 +169,15 @@ int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *op } if (fn == NULL) { - char *symbol_name = talloc_asprintf(ldb, "ldb_%s_connect", backend); + struct ldb_backend_ops *ops; + char *symbol_name = talloc_asprintf(ldb, "ldb_%s_backend_ops", backend); if (symbol_name == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - fn = ldb_dso_load_symbol(ldb, backend, symbol_name); + ops = ldb_dso_load_symbol(ldb, backend, symbol_name); + if (ops != NULL) { + fn = ops->connect_fn; + } talloc_free(symbol_name); } diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 2dae40ddb0..7da7b9ba34 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -126,9 +126,30 @@ static struct ops_list_entry { struct ops_list_entry *next; } *registered_modules = NULL; +#ifndef STATIC_LIBLDB_MODULES + +#define STATIC_LIBLDB_MODULES \ + ldb_operational_module_ops, \ + ldb_rdn_name_module_ops, \ + ldb_paged_results_module_ops, \ + ldb_sort_module_ops, \ + ldb_asq_module_ops, \ + NULL +#endif + +const static struct ldb_module_ops *builtin_modules[] = { + STATIC_LIBLDB_MODULES +}; + static const struct ldb_module_ops *ldb_find_module_ops(const char *name) { struct ops_list_entry *e; + int i; + + for (i = 0; builtin_modules[i]; i++) { + if (strcmp(builtin_modules[i]->name, name) == 0) + return builtin_modules[i]; + } for (e = registered_modules; e; e = e->next) { if (strcmp(e->ops->name, name) == 0) @@ -138,51 +159,6 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name) return NULL; } -#ifndef STATIC_LIBLDB_MODULES - -#ifdef HAVE_LDB_LDAP -#define LDAP_INIT ldb_ldap_init, -#else -#define LDAP_INIT -#endif - -#ifdef HAVE_LDB_SQLITE3 -#define SQLITE3_INIT ldb_sqlite3_init, -#else -#define SQLITE3_INIT -#endif - -#define STATIC_LIBLDB_MODULES \ - LDAP_INIT \ - SQLITE3_INIT \ - ldb_tdb_init, \ - ldb_operational_init, \ - ldb_rdn_name_init, \ - ldb_paged_results_init, \ - ldb_sort_init, \ - ldb_asq_init, \ - NULL -#endif - -int ldb_global_init(void) -{ - int (*static_init_fns[])(void) = { STATIC_LIBLDB_MODULES }; - - static int initialized = 0; - int ret = 0, i; - - if (initialized) - return 0; - - initialized = 1; - - for (i = 0; static_init_fns[i]; i++) { - if (static_init_fns[i]() == -1) - ret = -1; - } - - return ret; -} int ldb_register_module(const struct ldb_module_ops *ops) { diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index d9f2defdc9..d2dcc675a5 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -41,6 +41,8 @@ struct ldb_context; struct ldb_module_ops; +struct ldb_backend_ops; + /* basic module structure */ struct ldb_module { struct ldb_module *prev, *next; @@ -70,9 +72,16 @@ struct ldb_module_ops { int (*sequence_number)(struct ldb_module *, struct ldb_request *); }; + typedef int (*ldb_connect_fn) (struct ldb_context *ldb, const char *url, unsigned int flags, const char *options[], struct ldb_module **module); + +struct ldb_backend_ops { + const char *name; + ldb_connect_fn connect_fn; +}; + const char *ldb_default_modules_dir(void); /* @@ -170,17 +179,23 @@ void ldb_debug_set(struct ldb_context *ldb, enum ldb_debug_level level, /* The following definitions come from lib/ldb/common/ldb_ldif.c */ int ldb_should_b64_encode(const struct ldb_val *val); -int ldb_objectclass_init(void); -int ldb_operational_init(void); -int ldb_paged_results_init(void); -int ldb_rdn_name_init(void); -int ldb_schema_init(void); -int ldb_asq_init(void); -int ldb_sort_init(void); -int ldb_ldap_init(void); -int ldb_ildap_init(void); -int ldb_tdb_init(void); -int ldb_sqlite3_init(void); +extern const struct ldb_module_ops ldb_objectclass_module_ops; +extern const struct ldb_module_ops ldb_operational_module_ops; +extern const struct ldb_module_ops ldb_paged_results_module_ops; +extern const struct ldb_module_ops ldb_rdn_name_module_ops; +extern const struct ldb_module_ops ldb_schema_module_ops; +extern const struct ldb_module_ops ldb_asq_module_ops; +extern const struct ldb_module_ops ldb_sort_module_ops; +extern const struct ldb_module_ops ldb_ldap_module_ops; +extern const struct ldb_module_ops ldb_ildap_module_ops; +extern const struct ldb_module_ops ldb_tdb_module_ops; +extern const struct ldb_module_ops ldb_sqlite3_module_ops; + +extern const struct ldb_backend_ops ldb_tdb_backend_ops; +extern const struct ldb_backend_ops ldb_sqlite3_backend_ops; +extern const struct ldb_backend_ops ldb_ldap_backend_ops; +extern const struct ldb_backend_ops ldb_ildap_backend_ops; +extern const struct ldb_backend_ops ldb_ldaps_backend_ops; int ldb_match_msg(struct ldb_context *ldb, const struct ldb_message *msg, diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index 8ad6830c43..fb7100e3c1 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -811,6 +811,18 @@ failed: return -1; } -ldb_connect_fn ldb_ldap_connect = ildb_connect; -ldb_connect_fn ldb_ldapi_connect = ildb_connect; -ldb_connect_fn ldb_ldaps_connect = ildb_connect; +const struct ldb_backend_ops ldb_ldap_backend_ops { + .name = "ldap", + .connect_fn = ildb_connect +}; + +const struct ldb_backend_ops ldb_ildap_backend_ops { + .name = "ildap", + .connect_fn = ildb_connect +}; + +const struct ldb_backend_ops ldb_ldaps_backend_ops { + .name = "ldaps", + .connect_fn = ildb_connect +}; + diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index 1ec3b1aabd..8742e257f3 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -1903,7 +1903,7 @@ failed: return -1; } -int ldb_sqlite3_init(void) -{ - return ldb_register_backend("sqlite3", lsqlite3_connect); -} +const struct ldb_backend_ops ldb_sqlite3_backend_ops = { + .name = "sqlite3", + .connect_fn = lsqlite3_connect +}; diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 45a8109584..11d6c30710 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -1107,7 +1107,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url, return 0; } -int ldb_tdb_init(void) -{ - return ldb_register_backend("tdb", ltdb_connect); -} +const struct ldb_backend_ops ldb_tdb_backend_ops = { + .name = "tdb", + .connect_fn = ltdb_connect +}; -- cgit 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/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 -- 15 files changed, 10 insertions(+), 38 deletions(-) (limited to 'source4/lib') 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); -- cgit From 39a817d310964f8e9a63cfb096b3ad24fa03bd5e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 04:33:43 +0100 Subject: Fix use of some modules (needed _PUBLIC_). (This used to be commit ce332130ea77159832da23bab760fa26921719e2) --- source4/lib/ldb/ldb_ildap/ldb_ildap.c | 6 +++--- source4/lib/ldb/ldb_ldap/ldb_ldap.c | 20 ++++++++++++++------ source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 2 +- source4/lib/ldb/modules/paged_searches.c | 2 +- source4/lib/ldb/tests/sample_module.c | 2 +- source4/lib/util/attr.h | 2 -- source4/lib/util/util.h | 3 ++- 7 files changed, 22 insertions(+), 15 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c index fb7100e3c1..995b584f51 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -811,17 +811,17 @@ failed: return -1; } -const struct ldb_backend_ops ldb_ldap_backend_ops { +_PUBLIC_ const struct ldb_backend_ops ldb_ldap_backend_ops = { .name = "ldap", .connect_fn = ildb_connect }; -const struct ldb_backend_ops ldb_ildap_backend_ops { +_PUBLIC_ const struct ldb_backend_ops ldb_ildap_backend_ops = { .name = "ildap", .connect_fn = ildb_connect }; -const struct ldb_backend_ops ldb_ldaps_backend_ops { +_PUBLIC_ const struct ldb_backend_ops ldb_ldaps_backend_ops = { .name = "ldaps", .connect_fn = ildb_connect }; diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index d897350c2f..3f6ff3fd5b 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -826,9 +826,17 @@ failed: return -1; } -int ldb_ldap_init(void) -{ - return ldb_register_backend("ldap", lldb_connect) + - ldb_register_backend("ldapi", lldb_connect) + - ldb_register_backend("ldaps", lldb_connect); -} +_PUBLIC_ struct ldb_backend_ops ldb_ldap_backend_ops = { + .name = "ldap", + .connect_fn = lldb_connect +}; + +_PUBLIC_ struct ldb_backend_ops ldb_ldapi_backend_ops = { + .name = "ldapi", + .connect_fn = lldb_connect +}; + +_PUBLIC_ struct ldb_backend_ops ldb_ldaps_backend_ops = { + .name = "ldaps", + .connect_fn = lldb_connect +}; diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index 8742e257f3..214e7eec5f 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -1903,7 +1903,7 @@ failed: return -1; } -const struct ldb_backend_ops ldb_sqlite3_backend_ops = { +_PUBLIC_ const struct ldb_backend_ops ldb_sqlite3_backend_ops = { .name = "sqlite3", .connect_fn = lsqlite3_connect }; diff --git a/source4/lib/ldb/modules/paged_searches.c b/source4/lib/ldb/modules/paged_searches.c index 7406e91c9d..40e87f70d6 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_paged_searches_module_ops = { +_PUBLIC_ 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/tests/sample_module.c b/source4/lib/ldb/tests/sample_module.c index 1a9e72c907..98d8e865dd 100644 --- a/source4/lib/ldb/tests/sample_module.c +++ b/source4/lib/ldb/tests/sample_module.c @@ -32,7 +32,7 @@ int sample_add(struct ldb_module *mod, struct ldb_request *req) return ldb_next_request(mod, req); } -const struct ldb_module_ops ldb_sample_module_ops = { +_PUBLIC_ const struct ldb_module_ops ldb_sample_module_ops = { .name = "sample", .add = sample_add, }; diff --git a/source4/lib/util/attr.h b/source4/lib/util/attr.h index 8f6c4f5d8a..f64b272a67 100644 --- a/source4/lib/util/attr.h +++ b/source4/lib/util/attr.h @@ -29,13 +29,11 @@ /** Feel free to add definitions for other compilers here. */ #endif -#ifndef _PUBLIC_ #ifdef HAVE_VISIBILITY_ATTR # define _PUBLIC_ __attribute__((visibility("default"))) #else # define _PUBLIC_ #endif -#endif #ifndef _DEPRECATED_ #if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h index 9e106052f2..550b60c625 100644 --- a/source4/lib/util/util.h +++ b/source4/lib/util/util.h @@ -21,6 +21,8 @@ #ifndef _SAMBA_UTIL_H_ #define _SAMBA_UTIL_H_ +#include "util/attr.h" + #include "charset/charset.h" /* for TALLOC_CTX */ @@ -36,7 +38,6 @@ struct smbsrv_tcon; extern const char *logfile; extern const char *panic_action; -#include "util/attr.h" #include "util/time.h" #include "util/data_blob.h" #include "util/xfile.h" -- cgit From 62e849d918e76ac27096999792c46e3230b0663a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 1 Feb 2008 20:03:05 +0100 Subject: NetBSD needs LD_LIBRARY_PATH (cherry picked from commit d64b19e77aa499c1ee1aaf788ddf3d6fd36253e4) (This used to be commit 4c77550d80b0cfc80bc2cac500fc27e0c43dad64) --- source4/lib/replace/libreplace_ld.m4 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace_ld.m4 b/source4/lib/replace/libreplace_ld.m4 index 2aec698967..f0d10c1e3e 100644 --- a/source4/lib/replace/libreplace_ld.m4 +++ b/source4/lib/replace/libreplace_ld.m4 @@ -289,6 +289,9 @@ AC_DEFUN([AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR], *linux*) LIB_PATH_VAR=LD_LIBRARY_PATH ;; + *netbsd*) + LIB_PATH_VAR=LD_LIBRARY_PATH + ;; *solaris*) LIB_PATH_VAR=LD_LIBRARY_PATH ;; -- cgit From db2447a7a2b1d39a6849b53f7864e9283daacb6a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 1 Feb 2008 14:23:56 +0100 Subject: NetBSD does not support AI_ADDRCONFIG (cherry picked from commit fb3f7f4046fa195baf5116598772d9016238637f) (This used to be commit e8f3653414c12fb752c096d848dc962008d90439) --- source4/lib/replace/system/network.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/system/network.h b/source4/lib/replace/system/network.h index 53bef66d48..d09e3f71f8 100644 --- a/source4/lib/replace/system/network.h +++ b/source4/lib/replace/system/network.h @@ -163,8 +163,15 @@ void rep_freeifaddrs(struct ifaddrs *); #endif #ifndef AI_ADDRCONFIG +/* + * logic copied from AI_NUMERICHOST + */ +#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO) +#define AI_ADDRCONFIG 0 +#else #define AI_ADDRCONFIG 0x0020 #endif +#endif #ifndef AI_NUMERICSERV /* -- cgit From 7d7b74feb272a4cc00f68d1a343d14d17ff19fe6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 12:17:18 +0100 Subject: Allow building ldb as static library again \o/ (This used to be commit a57adcfdd32fa9516eb092f7568e213347c583d7) --- source4/lib/ldb/config.mk | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index b44a317a70..6027acd0c7 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -127,7 +127,6 @@ PRIVATE_DEPENDENCIES = \ [LIBRARY::LIBLDB] VERSION = 0.0.1 SO_VERSION = 0 -OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include PC_FILE = ldb.pc INIT_FUNCTION_TYPE = extern const struct ldb_module_ops -- cgit From 8f57595c18a51161db93cd05730be37bcb850a17 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 20 Feb 2008 12:43:37 +0100 Subject: libreplace: change samba_cv_ to libreplace_cv_ in getifaddrs.m4 Michael (This used to be commit acab9def2a1e3460bef8baae6efc66d9dfad6eac) --- source4/lib/replace/getifaddrs.m4 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 index 4259d1a7a3..4cf86d89cc 100644 --- a/source4/lib/replace/getifaddrs.m4 +++ b/source4/lib/replace/getifaddrs.m4 @@ -7,7 +7,7 @@ AC_CHECK_MEMBERS([struct sockaddr.sa_len], [#include ]) dnl test for getifaddrs and freeifaddrs -AC_CACHE_CHECK([for getifaddrs and freeifaddrs],samba_cv_HAVE_GETIFADDRS,[ +AC_CACHE_CHECK([for getifaddrs and freeifaddrs],libreplace_cv_HAVE_GETIFADDRS,[ AC_TRY_COMPILE([ #include #if STDC_HEADERS @@ -24,8 +24,8 @@ struct ifaddrs *ifp = NULL; int ret = getifaddrs (&ifp); freeifaddrs(ifp); ], -samba_cv_HAVE_GETIFADDRS=yes,samba_cv_HAVE_GETIFADDRS=no)]) -if test x"$samba_cv_HAVE_GETIFADDRS" = x"yes"; then +libreplace_cv_HAVE_GETIFADDRS=yes,libreplace_cv_HAVE_GETIFADDRS=no)]) +if test x"$libreplace_cv_HAVE_GETIFADDRS" = x"yes"; then AC_DEFINE(HAVE_GETIFADDRS,1,[Whether the system has getifaddrs]) AC_DEFINE(HAVE_FREEIFADDRS,1,[Whether the system has freeifaddrs]) AC_DEFINE(HAVE_STRUCT_IFADDRS,1,[Whether struct ifaddrs is available]) @@ -42,15 +42,15 @@ iface=no; ################## # look for a method of finding the list of network interfaces iface=no; -AC_CACHE_CHECK([for iface getifaddrs],samba_cv_HAVE_IFACE_GETIFADDRS,[ +AC_CACHE_CHECK([for iface getifaddrs],libreplace_cv_HAVE_IFACE_GETIFADDRS,[ AC_TRY_RUN([ #define NO_CONFIG_H 1 #define HAVE_IFACE_GETIFADDRS 1 #define AUTOCONF_TEST 1 #include "$libreplacedir/replace.c" #include "$libreplacedir/getifaddrs.c"], - samba_cv_HAVE_IFACE_GETIFADDRS=yes,samba_cv_HAVE_IFACE_GETIFADDRS=no,samba_cv_HAVE_IFACE_GETIFADDRS=cross)]) -if test x"$samba_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then + libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available]) else LIBREPLACEOBJ="${LIBREPLACEOBJ} getifaddrs.o" @@ -58,39 +58,39 @@ fi if test $iface = no; then -AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[ +AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[ AC_TRY_RUN([ #define HAVE_IFACE_AIX 1 #define AUTOCONF_TEST 1 #undef _XOPEN_SOURCE_EXTENDED #include "$libreplacedir/getifaddrs.c"], - samba_cv_HAVE_IFACE_AIX=yes,samba_cv_HAVE_IFACE_AIX=no,samba_cv_HAVE_IFACE_AIX=cross)]) -if test x"$samba_cv_HAVE_IFACE_AIX" = x"yes"; then + libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available]) fi fi if test $iface = no; then -AC_CACHE_CHECK([for iface ifconf],samba_cv_HAVE_IFACE_IFCONF,[ +AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[ AC_TRY_RUN([ #define HAVE_IFACE_IFCONF 1 #define AUTOCONF_TEST 1 #include "$libreplacedir/getifaddrs.c"], - samba_cv_HAVE_IFACE_IFCONF=yes,samba_cv_HAVE_IFACE_IFCONF=no,samba_cv_HAVE_IFACE_IFCONF=cross)]) -if test x"$samba_cv_HAVE_IFACE_IFCONF" = x"yes"; then + libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available]) fi fi if test $iface = no; then -AC_CACHE_CHECK([for iface ifreq],samba_cv_HAVE_IFACE_IFREQ,[ +AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[ AC_TRY_RUN([ #define HAVE_IFACE_IFREQ 1 #define AUTOCONF_TEST 1 #include "$libreplacedir/getifaddrs.c"], - samba_cv_HAVE_IFACE_IFREQ=yes,samba_cv_HAVE_IFACE_IFREQ=no,samba_cv_HAVE_IFACE_IFREQ=cross)]) -if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then + libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)]) +if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available]) fi fi -- cgit From 7f3913659f150ca7020177ab85f9c36b908807a9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 20 Feb 2008 12:46:20 +0100 Subject: libreplace: change samba_cv_ to libreplace_cv_ in getpass.m4. Michael (This used to be commit d3b3d3ec9ff64108b4cd5b7c912ab4ea207256cb) --- source4/lib/replace/getpass.m4 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getpass.m4 b/source4/lib/replace/getpass.m4 index c4da9aae59..b93817f9d3 100644 --- a/source4/lib/replace/getpass.m4 +++ b/source4/lib/replace/getpass.m4 @@ -1,22 +1,22 @@ -AC_CHECK_FUNC(getpass, samba_cv_HAVE_GETPASS=yes) -AC_CHECK_FUNC(getpassphrase, samba_cv_HAVE_GETPASSPHRASE=yes) -if test x"$samba_cv_HAVE_GETPASS" = x"yes" -a x"$samba_cv_HAVE_GETPASSPHRASE" = x"yes"; then +AC_CHECK_FUNC(getpass, libreplace_cv_HAVE_GETPASS=yes) +AC_CHECK_FUNC(getpassphrase, libreplace_cv_HAVE_GETPASSPHRASE=yes) +if test x"$libreplace_cv_HAVE_GETPASS" = x"yes" -a x"$libreplace_cv_HAVE_GETPASSPHRASE" = x"yes"; then AC_DEFINE(REPLACE_GETPASS_BY_GETPASSPHRASE, 1, [getpass returns <9 chars where getpassphrase returns <265 chars]) AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced]) LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o" else -AC_CACHE_CHECK([whether getpass should be replaced],samba_cv_REPLACE_GETPASS,[ +AC_CACHE_CHECK([whether getpass should be replaced],libreplace_cv_REPLACE_GETPASS,[ SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$libreplacedir/" AC_TRY_COMPILE([ #include "confdefs.h" #define NO_CONFIG_H #include "$libreplacedir/getpass.c" -],[],samba_cv_REPLACE_GETPASS=yes,samba_cv_REPLACE_GETPASS=no) +],[],libreplace_cv_REPLACE_GETPASS=yes,libreplace_cv_REPLACE_GETPASS=no) CPPFLAGS="$SAVE_CPPFLAGS" ]) -if test x"$samba_cv_REPLACE_GETPASS" = x"yes"; then +if test x"$libreplace_cv_REPLACE_GETPASS" = x"yes"; then AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced]) LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o" fi -- cgit From ab665b0b0553f7909a217373d0690d99bd80d2db Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 20 Feb 2008 12:49:30 +0100 Subject: libreplace: change samba_cv_ to libreplace_cv_ in system/config.m4. Michael (This used to be commit 00c173bfba9c659750bf231fbd9278dd38aa8bfc) --- source4/lib/replace/system/config.m4 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/system/config.m4 b/source4/lib/replace/system/config.m4 index 1c05733126..66c2bd652a 100644 --- a/source4/lib/replace/system/config.m4 +++ b/source4/lib/replace/system/config.m4 @@ -18,7 +18,7 @@ AC_CHECK_HEADERS(sys/capability.h) case "$host_os" in *linux*) -AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[ +AC_CACHE_CHECK([for broken RedHat 7.2 system header files],libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[ AC_TRY_COMPILE([ #ifdef HAVE_SYS_VFS_H #include @@ -29,14 +29,14 @@ AC_TRY_COMPILE([ ],[ int i; ], - samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no, - samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes + libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no, + libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes )]) -if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then +if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files]) fi -AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[ +AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[ AC_TRY_COMPILE([ #ifdef HAVE_SYS_CAPABILITY_H #include @@ -45,10 +45,10 @@ AC_TRY_COMPILE([ ],[ __s8 i; ], - samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no, - samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes + libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no, + libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes )]) -if test x"$samba_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then +if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h]) fi ;; -- cgit From 2c134f3cd5de1851c8cb5900b830cca25892d735 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 20 Feb 2008 12:53:07 +0100 Subject: libreplace: change samba_cv_ to libreplace_cv_ in libreplace.m4. Michael (This used to be commit 83387ecccfe95b80525bf53c5fc9e945ffee10ec) --- source4/lib/replace/libreplace.m4 | 72 +++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4 index 6d1d6b8afc..2e0cd34f4a 100644 --- a/source4/lib/replace/libreplace.m4 +++ b/source4/lib/replace/libreplace.m4 @@ -85,10 +85,10 @@ AC_INCLUDES_DEFAULT #endif] ) -AC_CACHE_CHECK([for working mmap],samba_cv_HAVE_MMAP,[ +AC_CACHE_CHECK([for working mmap],libreplace_cv_HAVE_MMAP,[ AC_TRY_RUN([#include "$libreplacedir/test/shared_mmap.c"], - samba_cv_HAVE_MMAP=yes,samba_cv_HAVE_MMAP=no,samba_cv_HAVE_MMAP=cross)]) -if test x"$samba_cv_HAVE_MMAP" = x"yes"; then + libreplace_cv_HAVE_MMAP=yes,libreplace_cv_HAVE_MMAP=no,libreplace_cv_HAVE_MMAP=cross)]) +if test x"$libreplace_cv_HAVE_MMAP" = x"yes"; then AC_DEFINE(HAVE_MMAP,1,[Whether mmap works]) fi @@ -120,7 +120,7 @@ if test x"$libreplace_cv_USABLE_NET_IF_H" = x"yes";then AC_DEFINE(HAVE_NET_IF_H, 1, usability of net/if.h) fi -AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[ +AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[ AC_TRY_RUN([ #include #include @@ -133,8 +133,8 @@ main() { struct in_addr ip; ip.s_addr = 0x12345678; if (strcmp(inet_ntoa(ip),"18.52.86.120") && strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } exit(1);}], - samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)]) -if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then + libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)]) +if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced]) fi @@ -182,7 +182,7 @@ AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) -AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[ +AC_CACHE_CHECK([for secure mkstemp],libreplace_cv_HAVE_SECURE_MKSTEMP,[ AC_TRY_RUN([#include #include #include @@ -197,10 +197,10 @@ main() { if ((st.st_mode & 0777) != 0600) exit(1); exit(0); }], -samba_cv_HAVE_SECURE_MKSTEMP=yes, -samba_cv_HAVE_SECURE_MKSTEMP=no, -samba_cv_HAVE_SECURE_MKSTEMP=cross)]) -if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then +libreplace_cv_HAVE_SECURE_MKSTEMP=yes, +libreplace_cv_HAVE_SECURE_MKSTEMP=no, +libreplace_cv_HAVE_SECURE_MKSTEMP=cross)]) +if test x"$libreplace_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure]) fi @@ -209,7 +209,7 @@ AC_CHECK_HEADERS(stdio.h strings.h) AC_CHECK_DECLS([snprintf, vsnprintf, asprintf, vasprintf]) AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf) -AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[ +AC_CACHE_CHECK([for C99 vsnprintf],libreplace_cv_HAVE_C99_VSNPRINTF,[ AC_TRY_RUN([ #include #include @@ -243,43 +243,43 @@ void foo(const char *format, ...) { } main() { foo("hello"); } ], -samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)]) -if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then +libreplace_cv_HAVE_C99_VSNPRINTF=yes,libreplace_cv_HAVE_C99_VSNPRINTF=no,libreplace_cv_HAVE_C99_VSNPRINTF=cross)]) +if test x"$libreplace_cv_HAVE_C99_VSNPRINTF" = x"yes"; then AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf]) fi dnl VA_COPY -AC_CACHE_CHECK([for va_copy],samba_cv_HAVE_VA_COPY,[ +AC_CACHE_CHECK([for va_copy],libreplace_cv_HAVE_VA_COPY,[ AC_TRY_LINK([#include va_list ap1,ap2;], [va_copy(ap1,ap2);], -samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)]) -if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then +libreplace_cv_HAVE_VA_COPY=yes,libreplace_cv_HAVE_VA_COPY=no)]) +if test x"$libreplace_cv_HAVE_VA_COPY" = x"yes"; then AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) fi -if test x"$samba_cv_HAVE_VA_COPY" != x"yes"; then -AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE___VA_COPY,[ +if test x"$libreplace_cv_HAVE_VA_COPY" != x"yes"; then +AC_CACHE_CHECK([for __va_copy],libreplace_cv_HAVE___VA_COPY,[ AC_TRY_LINK([#include va_list ap1,ap2;], [__va_copy(ap1,ap2);], -samba_cv_HAVE___VA_COPY=yes,samba_cv_HAVE___VA_COPY=no)]) -if test x"$samba_cv_HAVE___VA_COPY" = x"yes"; then +libreplace_cv_HAVE___VA_COPY=yes,libreplace_cv_HAVE___VA_COPY=no)]) +if test x"$libreplace_cv_HAVE___VA_COPY" = x"yes"; then AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available]) fi fi dnl __FUNCTION__ macro -AC_CACHE_CHECK([for __FUNCTION__ macro],samba_cv_HAVE_FUNCTION_MACRO,[ +AC_CACHE_CHECK([for __FUNCTION__ macro],libreplace_cv_HAVE_FUNCTION_MACRO,[ AC_TRY_COMPILE([#include ], [printf("%s\n", __FUNCTION__);], -samba_cv_HAVE_FUNCTION_MACRO=yes,samba_cv_HAVE_FUNCTION_MACRO=no)]) -if test x"$samba_cv_HAVE_FUNCTION_MACRO" = x"yes"; then +libreplace_cv_HAVE_FUNCTION_MACRO=yes,libreplace_cv_HAVE_FUNCTION_MACRO=no)]) +if test x"$libreplace_cv_HAVE_FUNCTION_MACRO" = x"yes"; then AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro]) else dnl __func__ macro - AC_CACHE_CHECK([for __func__ macro],samba_cv_HAVE_func_MACRO,[ + AC_CACHE_CHECK([for __func__ macro],libreplace_cv_HAVE_func_MACRO,[ AC_TRY_COMPILE([#include ], [printf("%s\n", __func__);], - samba_cv_HAVE_func_MACRO=yes,samba_cv_HAVE_func_MACRO=no)]) - if test x"$samba_cv_HAVE_func_MACRO" = x"yes"; then + libreplace_cv_HAVE_func_MACRO=yes,libreplace_cv_HAVE_func_MACRO=no)]) + if test x"$libreplace_cv_HAVE_func_MACRO" = x"yes"; then AC_DEFINE(HAVE_func_MACRO,1,[Whether there is a __func__ macro]) fi fi @@ -302,7 +302,7 @@ eprintf("bla", "bar"); ], AC_DEFINE(HAVE__VA_ARGS__MACRO, 1, [Whether the __VA_ARGS__ macro is available])) -AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [ +AC_CACHE_CHECK([for sig_atomic_t type],libreplace_cv_sig_atomic_t, [ AC_TRY_COMPILE([ #include #if STDC_HEADERS @@ -310,30 +310,30 @@ AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [ #include #endif #include ],[sig_atomic_t i = 0], - samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)]) -if test x"$samba_cv_sig_atomic_t" = x"yes"; then + libreplace_cv_sig_atomic_t=yes,libreplace_cv_sig_atomic_t=no)]) +if test x"$libreplace_cv_sig_atomic_t" = x"yes"; then AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type]) fi -AC_CACHE_CHECK([for O_DIRECT flag to open(2)],samba_cv_HAVE_OPEN_O_DIRECT,[ +AC_CACHE_CHECK([for O_DIRECT flag to open(2)],libreplace_cv_HAVE_OPEN_O_DIRECT,[ AC_TRY_COMPILE([ #include #ifdef HAVE_FCNTL_H #include #endif], [int fd = open("/dev/null", O_DIRECT);], -samba_cv_HAVE_OPEN_O_DIRECT=yes,samba_cv_HAVE_OPEN_O_DIRECT=no)]) -if test x"$samba_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then +libreplace_cv_HAVE_OPEN_O_DIRECT=yes,libreplace_cv_HAVE_OPEN_O_DIRECT=no)]) +if test x"$libreplace_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT]) fi dnl Check if the C compiler understands volatile (it should, being ANSI). -AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [ +AC_CACHE_CHECK([that the C compiler understands volatile],libreplace_cv_volatile, [ AC_TRY_COMPILE([#include ],[volatile int i = 0], - samba_cv_volatile=yes,samba_cv_volatile=no)]) -if test x"$samba_cv_volatile" = x"yes"; then + libreplace_cv_volatile=yes,libreplace_cv_volatile=no)]) +if test x"$libreplace_cv_volatile" = x"yes"; then AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile]) fi -- cgit From 39a6495c86679d5e970012a0d1f5cd375e56450c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 19:40:20 +0100 Subject: Make more module init functions public, since they are compiled with -fvisibility=hidden. Not doing this causes failures on Mac OS X. (This used to be commit da1a9438bd89569077ef1eaa9dc977b5f9d62836) --- source4/lib/events/events_select.c | 2 +- source4/lib/events/events_standard.c | 2 +- source4/lib/socket/socket_ip.c | 4 ++-- source4/lib/socket/socket_unix.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/events/events_select.c b/source4/lib/events/events_select.c index 3f9eeb5617..f4b7e4e5eb 100644 --- a/source4/lib/events/events_select.c +++ b/source4/lib/events/events_select.c @@ -300,7 +300,7 @@ bool events_select_init(void) } #if _SAMBA_BUILD_ -NTSTATUS s4_events_select_init(void) +_PUBLIC_ NTSTATUS s4_events_select_init(void) { if (!events_select_init()) { return NT_STATUS_INTERNAL_ERROR; diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index 5e529d66ab..7b945b154d 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -602,7 +602,7 @@ bool events_standard_init(void) } #if _SAMBA_BUILD_ -NTSTATUS s4_events_standard_init(void) +_PUBLIC_ NTSTATUS s4_events_standard_init(void) { if (!events_standard_init()) { return NT_STATUS_INTERNAL_ERROR; diff --git a/source4/lib/socket/socket_ip.c b/source4/lib/socket/socket_ip.c index e61b6d82fc..bca0aab924 100644 --- a/source4/lib/socket/socket_ip.c +++ b/source4/lib/socket/socket_ip.c @@ -540,7 +540,7 @@ static const struct socket_ops ipv4_ops = { .fn_get_fd = ip_get_fd }; -const struct socket_ops *socket_ipv4_ops(enum socket_type type) +_PUBLIC_ const struct socket_ops *socket_ipv4_ops(enum socket_type type) { return &ipv4_ops; } @@ -977,7 +977,7 @@ static const struct socket_ops ipv6_tcp_ops = { .fn_get_fd = ip_get_fd }; -const struct socket_ops *socket_ipv6_ops(enum socket_type type) +_PUBLIC_ const struct socket_ops *socket_ipv6_ops(enum socket_type type) { return &ipv6_tcp_ops; } diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index cac4b8e913..af7d2bb79f 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/lib/socket/socket_unix.c @@ -414,7 +414,7 @@ static const struct socket_ops unixdom_ops = { .fn_get_fd = unixdom_get_fd }; -const struct socket_ops *socket_unixdom_ops(enum socket_type type) +_PUBLIC_ const struct socket_ops *socket_unixdom_ops(enum socket_type type) { return &unixdom_ops; } -- cgit From 910a1cafdf253255510d3aff7cc2385da43331dd Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 20 Feb 2008 20:05:51 +0100 Subject: Support dlopen(NULL, ...) on HPUX. (This used to be commit 53c70b5f77a3b9abaab783590e66278129173d5f) --- source4/lib/replace/dlfcn.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/dlfcn.c b/source4/lib/replace/dlfcn.c index 42848848e8..3b109d7e40 100644 --- a/source4/lib/replace/dlfcn.c +++ b/source4/lib/replace/dlfcn.c @@ -35,6 +35,8 @@ void *rep_dlopen(const char *name, int flags) #endif { #ifdef HAVE_SHL_LOAD + if (name == NULL) + return PROG_HANDLE; return (void *)shl_load(name, flags, 0); #else return NULL; -- cgit From 49b3a4829325967df9d1e616ad32e5379ce6cf5d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 21 Feb 2008 09:53:11 +1100 Subject: Until the new ldb changes land, make ldb_wait set the error string. This makes it easier to track down which module only returned and error code, but not the error string. Andrew Bartlett (This used to be commit c4d502f68fbd5d5bc2ac5bb6369950379c9176fc) --- source4/lib/ldb/common/ldb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 87f791cb38..5601a33191 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -463,11 +463,17 @@ static int ldb_autotransaction_request(struct ldb_context *ldb, struct ldb_reque int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type) { + int ret; if (!handle) { return LDB_SUCCESS; } - return handle->module->ops->wait(handle, type); + ret = handle->module->ops->wait(handle, type); + if (!ldb_errstring(handle->module->ldb)) { + /* Set a default error string, to place the blame somewhere */ + ldb_asprintf_errstring(handle->module->ldb, "error waiting on module %s: %s (%d)", handle->module->ops->name, ldb_strerror(ret), ret); + } + return ret; } /* set the specified timeout or, if timeout is 0 set the default timeout */ -- cgit From 37deca2d41d74faa7abe060a21340263bd6d66f7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 14:16:02 +0100 Subject: Avoid use of global_loadparm. (This used to be commit c5a95bbe0ce55c29e135a9c6058bf192ec3bb546) --- source4/lib/tdr/tdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/tdr/tdr.c b/source4/lib/tdr/tdr.c index f75cac9810..2ad099174d 100644 --- a/source4/lib/tdr/tdr.c +++ b/source4/lib/tdr/tdr.c @@ -154,7 +154,7 @@ NTSTATUS tdr_pull_charset(struct tdr_pull *tdr, TALLOC_CTX *ctx, const char **v, TDR_PULL_NEED_BYTES(tdr, el_size*length); - ret = convert_string_talloc(ctx, lp_iconv_convenience(global_loadparm), chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v)); + ret = convert_string_talloc(ctx, tdr->iconv_convenience, chset, CH_UNIX, tdr->data.data+tdr->offset, el_size*length, discard_const_p(void *, v)); if (ret == -1) { return NT_STATUS_INVALID_PARAMETER; -- cgit From ede79ae482b16c3cea65d3019bc1a68f07354e89 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 15:38:35 +0100 Subject: Remove more uses of global_loadparm. (This used to be commit 58a5b1de2b093fe642eb11d76d12db0edf60c25c) --- source4/lib/util/ms_fnmatch.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/util/ms_fnmatch.c b/source4/lib/util/ms_fnmatch.c index 1fb57b07a4..5e04ec1f4b 100644 --- a/source4/lib/util/ms_fnmatch.c +++ b/source4/lib/util/ms_fnmatch.c @@ -64,8 +64,9 @@ static int ms_fnmatch_core(const char *p, const char *n, codepoint_t c, c2; int i; size_t size, size_n; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); - while ((c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &size))) { + while ((c = next_codepoint(iconv_convenience, p, &size))) { p += size; switch (c) { @@ -75,7 +76,7 @@ static int ms_fnmatch_core(const char *p, const char *n, return null_match(p); } for (i=0; n[i]; i += size_n) { - next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n); + next_codepoint(iconv_convenience, n+i, &size_n); if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) { return 0; } @@ -94,7 +95,7 @@ static int ms_fnmatch_core(const char *p, const char *n, return -1; } for (i=0; n[i]; i += size_n) { - next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n); + next_codepoint(iconv_convenience, n+i, &size_n); if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) return 0; if (n+i == ldot) { if (ms_fnmatch_core(p, n+i+size_n, max_n+1, ldot) == 0) return 0; @@ -110,7 +111,7 @@ static int ms_fnmatch_core(const char *p, const char *n, if (! *n) { return -1; } - next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n); + next_codepoint(iconv_convenience, n, &size_n); n += size_n; break; @@ -124,7 +125,7 @@ static int ms_fnmatch_core(const char *p, const char *n, break; } if (! *n) return null_match(p); - next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n); + next_codepoint(iconv_convenience, n, &size_n); n += size_n; break; @@ -134,12 +135,12 @@ static int ms_fnmatch_core(const char *p, const char *n, return 0; } if (*n != '.') return -1; - next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n); + next_codepoint(iconv_convenience, n, &size_n); n += size_n; break; default: - c2 = next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n); + c2 = next_codepoint(iconv_convenience, n, &size_n); if (c != c2 && codepoint_cmpi(c, c2) != 0) { return -1; } -- cgit From e36b159e8c3d8b41823c09a612938cbf1b6e544b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 21 Feb 2008 15:51:40 +0100 Subject: ldb_sqlite: fix the build metze (This used to be commit 14c8e3101cc3b0138a551afdf3a94f4bb11bb21d) --- source4/lib/ldb/config.mk | 1 - source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 6027acd0c7..d6980f341a 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -99,7 +99,6 @@ OBJ_FILES = modules/skel.o SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC -INIT_FUNCTION = &ldb_sqlite3_module_ops OBJ_FILES = \ ldb_sqlite3/ldb_sqlite3.o # End MODULE ldb_sqlite3 diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c index 214e7eec5f..8742e257f3 100644 --- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c +++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c @@ -1903,7 +1903,7 @@ failed: return -1; } -_PUBLIC_ const struct ldb_backend_ops ldb_sqlite3_backend_ops = { +const struct ldb_backend_ops ldb_sqlite3_backend_ops = { .name = "sqlite3", .connect_fn = lsqlite3_connect }; -- cgit From 48307b54f95395fbd201d92d738b482f80cd15ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 16:01:19 +0100 Subject: Remove more uses of global_loadparm. (This used to be commit 3430cc60972b94d0d238bc39f473feed96949c5d) --- source4/lib/registry/patchfile.c | 4 +++- source4/lib/registry/patchfile_dotreg.c | 10 ++++++++-- source4/lib/registry/registry.h | 7 +++---- source4/lib/registry/tests/generic.c | 14 +++++++------- source4/lib/registry/tools/regshell.c | 7 ++++--- source4/lib/registry/tools/regtree.c | 2 +- source4/lib/registry/util.c | 18 ++++++++++++------ 7 files changed, 38 insertions(+), 24 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index fa1367bbd2..a4579010cd 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -23,6 +23,7 @@ #include "lib/registry/patchfile.h" #include "lib/registry/registry.h" #include "system/filesys.h" +#include "param/param.h" _PUBLIC_ WERROR reg_preg_diff_load(int fd, @@ -30,6 +31,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, void *callback_data); _PUBLIC_ WERROR reg_dotreg_diff_load(int fd, + struct smb_iconv_convenience *iconv_convenience, const struct reg_diff_callbacks *callbacks, void *callback_data); @@ -306,7 +308,7 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename, return reg_preg_diff_load(fd, callbacks, callback_data); } else { /* Must be a normal .REG file */ - return reg_dotreg_diff_load(fd, callbacks, callback_data); + return reg_dotreg_diff_load(fd, lp_iconv_convenience(global_loadparm), callbacks, callback_data); } } diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index ebcafc92af..46ea7c0008 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -26,6 +26,7 @@ #include "lib/registry/patchfile.h" #include "lib/registry/registry.h" #include "system/filesys.h" +#include "param/param.h" /** * @file @@ -36,6 +37,7 @@ struct dotreg_data { int fd; + struct smb_iconv_convenience *iconv_convenience; }; static WERROR reg_dotreg_diff_add_key(void *_data, const char *key_name) @@ -64,7 +66,7 @@ static WERROR reg_dotreg_diff_set_value(void *_data, const char *path, fdprintf(data->fd, "\"%s\"=%s:%s\n", value_name, str_regtype(value_type), - reg_val_data_string(NULL, value_type, value)); + reg_val_data_string(NULL, data->iconv_convenience, value_type, value)); return WERR_OK; } @@ -107,6 +109,8 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, data = talloc_zero(ctx, struct dotreg_data); *callback_data = data; + data->iconv_convenience = lp_iconv_convenience(global_loadparm); + if (filename) { data->fd = open(filename, O_CREAT, 0755); if (data->fd == -1) { @@ -135,6 +139,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, * Load diff file */ _PUBLIC_ WERROR reg_dotreg_diff_load(int fd, + struct smb_iconv_convenience *iconv_convenience, const struct reg_diff_callbacks *callbacks, void *callback_data) { @@ -239,7 +244,8 @@ _PUBLIC_ WERROR reg_dotreg_diff_load(int fd, q++; } - reg_string_to_val(line, q?p:"REG_SZ", q?q:p, + reg_string_to_val(line, iconv_convenience, + q?p:"REG_SZ", q?q:p, &value_type, &value); error = callbacks->set_value(callback_data, curkey, line, diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index fac9180378..5e0b971a1d 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -254,11 +254,10 @@ WERROR reg_create_key(TALLOC_CTX *mem_ctx, /* Utility functions */ const char *str_regtype(int type); -char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, - const DATA_BLOB data); -char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, +char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t type, const DATA_BLOB data); +char *reg_val_description(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *name, uint32_t type, const DATA_BLOB data); -bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, +bool reg_string_to_val(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, const char *name, struct registry_key **result); diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index 25a89793bd..145e599504 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -45,7 +45,7 @@ static bool test_reg_val_data_string_dword(struct torture_context *ctx) uint32_t d = 0x20; DATA_BLOB db = { (uint8_t *)&d, sizeof(d) }; torture_assert_str_equal(ctx, "0x20", - reg_val_data_string(ctx, REG_DWORD, db), + reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD, db), "dword failed"); return true; } @@ -56,11 +56,11 @@ static bool test_reg_val_data_string_sz(struct torture_context *ctx) db.length = convert_string_talloc(ctx, lp_iconv_convenience(ctx->lp_ctx), CH_UNIX, CH_UTF16, "bla", 3, (void **)&db.data); torture_assert_str_equal(ctx, "bla", - reg_val_data_string(ctx, REG_SZ, db), + reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db), "sz failed"); db.length = 4; torture_assert_str_equal(ctx, "bl", - reg_val_data_string(ctx, REG_SZ, db), + reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_SZ, db), "sz failed"); return true; } @@ -70,7 +70,7 @@ static bool test_reg_val_data_string_binary(struct torture_context *ctx) uint8_t x[] = { 0x1, 0x2, 0x3, 0x4 }; DATA_BLOB db = { x, 4 }; torture_assert_str_equal(ctx, "01020304", - reg_val_data_string(ctx, REG_BINARY, db), + reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_BINARY, db), "binary failed"); return true; } @@ -80,7 +80,7 @@ static bool test_reg_val_data_string_empty(struct torture_context *ctx) { DATA_BLOB db = { NULL, 0 }; torture_assert_str_equal(ctx, "", - reg_val_data_string(ctx, REG_BINARY, db), + reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_BINARY, db), "empty failed"); return true; } @@ -93,7 +93,7 @@ static bool test_reg_val_description(struct torture_context *ctx) strlen("stationary traveller"), (void **)&data.data); torture_assert_str_equal(ctx, "camel = REG_SZ : stationary traveller", - reg_val_description(ctx, "camel", REG_SZ, data), + reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), "camel", REG_SZ, data), "reg_val_description failed"); return true; } @@ -107,7 +107,7 @@ static bool test_reg_val_description_nullname(struct torture_context *ctx) strlen("west berlin"), (void **)&data.data); torture_assert_str_equal(ctx, " = REG_SZ : west berlin", - reg_val_description(ctx, NULL, REG_SZ, data), + reg_val_description(ctx, lp_iconv_convenience(ctx->lp_ctx), NULL, REG_SZ, data), "description with null name failed"); return true; } diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index d5c506ab31..58f64cb049 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -141,7 +141,8 @@ static WERROR cmd_set(struct regshell_context *ctx, int argc, char **argv) return WERR_INVALID_PARAM; } - if (!reg_string_to_val(ctx, argv[2], argv[3], &val.data_type, + if (!reg_string_to_val(ctx, lp_iconv_convenience(cmdline_lp_ctx), + argv[2], argv[3], &val.data_type, &val.data)) { fprintf(stderr, "Unable to interpret data\n"); return WERR_INVALID_PARAM; @@ -199,7 +200,7 @@ static WERROR cmd_print(struct regshell_context *ctx, int argc, char **argv) } printf("%s\n%s\n", str_regtype(value_type), - reg_val_data_string(ctx, value_type, value_data)); + reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), value_type, value_data)); return WERR_OK; } @@ -233,7 +234,7 @@ static WERROR cmd_ls(struct regshell_context *ctx, int argc, char **argv) &data_type, &data)); i++) { printf("V \"%s\" %s %s\n", name, str_regtype(data_type), - reg_val_data_string(ctx, data_type, data)); + reg_val_data_string(ctx, lp_iconv_convenience(cmdline_lp_ctx), data_type, data)); } return WERR_OK; diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 0f47d8f8dd..424d3515e0 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -82,7 +82,7 @@ static void print_tree(int level, struct registry_key *p, int j; char *desc; for(j = 0; j < level+1; j++) putchar(' '); - desc = reg_val_description(mem_ctx, valuename, + desc = reg_val_description(mem_ctx, lp_iconv_convenience(cmdline_lp_ctx), valuename, value_type, value_data); printf("%s\n", desc); } diff --git a/source4/lib/registry/util.c b/source4/lib/registry/util.c index a251ae49a5..68efd56a86 100644 --- a/source4/lib/registry/util.c +++ b/source4/lib/registry/util.c @@ -51,7 +51,9 @@ _PUBLIC_ const char *str_regtype(int type) return "Unknown"; } -_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, +_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, + uint32_t type, const DATA_BLOB data) { char *ret = NULL; @@ -62,7 +64,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, switch (type) { case REG_EXPAND_SZ: case REG_SZ: - convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX, + convert_string_talloc(mem_ctx, iconv_convenience, CH_UTF16, CH_UNIX, data.data, data.length, (void **)&ret); return ret; @@ -85,16 +87,20 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, } /** Generate a string that describes a registry value */ -_PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, +_PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, + const char *name, uint32_t data_type, const DATA_BLOB data) { return talloc_asprintf(mem_ctx, "%s = %s : %s", name?name:"", str_regtype(data_type), - reg_val_data_string(mem_ctx, data_type, data)); + reg_val_data_string(mem_ctx, iconv_convenience, data_type, data)); } -_PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, +_PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, + const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data) { @@ -118,7 +124,7 @@ _PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, { case REG_SZ: case REG_EXPAND_SZ: - data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UNIX, CH_UTF16, + data->length = convert_string_talloc(mem_ctx, iconv_convenience, CH_UNIX, CH_UTF16, data_str, strlen(data_str), (void **)&data->data); break; -- cgit From 426e7fef1f080f22a10e89cebae58a40db8bc77f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 16:10:07 +0100 Subject: Remove extra whitespace, use public variable in IDL. (This used to be commit bf08b682586f6b9a17d4ec3934836be957ef955c) --- source4/lib/charset/charcnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/charset/charcnv.c b/source4/lib/charset/charcnv.c index 54a0676599..0465be689e 100644 --- a/source4/lib/charset/charcnv.c +++ b/source4/lib/charset/charcnv.c @@ -677,7 +677,7 @@ _PUBLIC_ codepoint_t next_codepoint(struct smb_iconv_convenience *ic, with codepoints above 64k */ olen = 2; outbuf = (char *)buf; - smb_iconv(descriptor, &str, &ilen, &outbuf, &olen); + smb_iconv(descriptor, &str, &ilen, &outbuf, &olen); if (olen == 2) { olen = 4; outbuf = (char *)buf; -- cgit From 840933cd4eaca75ebb4d63928023e7d1d24f4a8c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 21 Feb 2008 17:56:33 +0100 Subject: Try and fix getifaddrs check on irix: dont't try to include config.h The missing header file is judged "catastrophic" on irix. Michael (cherry picked from commit 5778c90819a5a5cee38be690f442c571f3a6a051) (This used to be commit 0d4522a06d4465f6eadbdf14381c9e08cf7e1dc9) --- source4/lib/replace/getifaddrs.m4 | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 index 4cf86d89cc..5d5edf1cbd 100644 --- a/source4/lib/replace/getifaddrs.m4 +++ b/source4/lib/replace/getifaddrs.m4 @@ -60,6 +60,7 @@ fi if test $iface = no; then AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[ AC_TRY_RUN([ +#define NO_CONFIG_H 1 #define HAVE_IFACE_AIX 1 #define AUTOCONF_TEST 1 #undef _XOPEN_SOURCE_EXTENDED @@ -74,6 +75,7 @@ fi if test $iface = no; then AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[ AC_TRY_RUN([ +#define NO_CONFIG_H 1 #define HAVE_IFACE_IFCONF 1 #define AUTOCONF_TEST 1 #include "$libreplacedir/getifaddrs.c"], @@ -86,6 +88,7 @@ fi if test $iface = no; then AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[ AC_TRY_RUN([ +#define NO_CONFIG_H 1 #define HAVE_IFACE_IFREQ 1 #define AUTOCONF_TEST 1 #include "$libreplacedir/getifaddrs.c"], -- cgit From c513546cda3d453748c88589b83015489fc6f14f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 21 Feb 2008 18:16:10 +0100 Subject: libreplace: fix compile errors in getifaddrs.c Michael (cherry picked from commit 22cdd4cb507022d9c670b7d5cbc8d357b0b91637) (This used to be commit 4da2d999a28c8fd3e93480194a153cf6a10de986) --- source4/lib/replace/getifaddrs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index 4037d647d7..f12062bd8e 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -81,7 +81,6 @@ int rep_getifaddrs(struct ifaddrs **ifap) char buff[8192]; int fd, i, n; struct ifreq *ifr=NULL; - int total = 0; struct in_addr ipaddr; struct in_addr nmask; char *iname; @@ -106,7 +105,7 @@ int rep_getifaddrs(struct ifaddrs **ifap) n = ifc.ifc_len / sizeof(struct ifreq); /* Loop through interfaces, looking for given IP address */ - for (i=n-1;i>=0 && total < max_interfaces;i--) { + for (i=n-1; i>=0; i--) { if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != 0) { freeifaddrs(*ifap); } @@ -166,11 +165,10 @@ int rep_getifaddrs(struct ifaddrs **ifap) char buff[8192]; int fd, i, n; struct ifreq *ifr=NULL; - int total = 0; struct in_addr ipaddr; struct in_addr nmask; char *iname; - struct ifaddrs *curif; + struct ifaddrs *curif, *lastif; *ifap = NULL; @@ -201,7 +199,7 @@ int rep_getifaddrs(struct ifaddrs **ifap) /* Loop through interfaces */ - for (i = 0; i Date: Fri, 22 Feb 2008 00:24:11 +0100 Subject: Add missing initalizations of lastif in rep_getifaddr implementations. Michael (cherry picked from commit 65710e752f72070cb911867ff9f31f91904ca5c0) (This used to be commit 5bd613a2cda5d287706f2ce72f4ee08a7fa45b72) --- source4/lib/replace/getifaddrs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index f12062bd8e..60049caa99 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -84,7 +84,8 @@ int rep_getifaddrs(struct ifaddrs **ifap) struct in_addr ipaddr; struct in_addr nmask; char *iname; - struct ifaddrs *curif, *lastif; + struct ifaddrs *curif; + struct ifaddrs *lastif = NULL; *ifap = NULL; @@ -168,7 +169,8 @@ int rep_getifaddrs(struct ifaddrs **ifap) struct in_addr ipaddr; struct in_addr nmask; char *iname; - struct ifaddrs *curif, *lastif; + struct ifaddrs *curif; + struct ifaddrs *lastif = NULL; *ifap = NULL; @@ -268,7 +270,8 @@ int rep_getifaddrs(struct ifaddrs **ifap) struct in_addr ipaddr; struct in_addr nmask; char *iname; - struct ifaddrs *curif, *lastif; + struct ifaddrs *curif; + struct ifaddrs *lastif = NULL; *ifap = NULL; -- cgit From c2f92013c3304bf49622f7e0d5658f768898a4f1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Feb 2008 00:27:00 +0100 Subject: Fix linked list of ifaddrs in implementations of rep_getifaddrs. Produce proper list instead of one-node-loop. Michael (cherry picked from commit ec9f4f5066ba7a8bf3af931fd4969590140c0b2b) (This used to be commit 744d5ba7adab65a9774a18eb42b7090f49e423f2) --- source4/lib/replace/getifaddrs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index 60049caa99..37cd950e09 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -115,7 +115,7 @@ int rep_getifaddrs(struct ifaddrs **ifap) if (lastif == NULL) { *ifap = curif; } else { - lastif->ifa_next = (*ifap); + lastif->ifa_next = curif; } curif->ifa_name = strdup(ifr[i].ifr_name); @@ -208,7 +208,7 @@ int rep_getifaddrs(struct ifaddrs **ifap) if (lastif == NULL) { *ifap = curif; } else { - lastif->ifa_next = (*ifap); + lastif->ifa_next = curif; } strioctl.ic_cmd = SIOCGIFFLAGS; @@ -306,7 +306,7 @@ int rep_getifaddrs(struct ifaddrs **ifap) if (lastif == NULL) { *ifap = curif; } else { - lastif->ifa_next = (*ifap); + lastif->ifa_next = curif; } curif->ifa_name = strdup(ifr->ifr_name); -- cgit From 88c919c14af3b5e5cb9524ce3bb778b7c7bc6c72 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Feb 2008 00:34:41 +0100 Subject: libreplace: fix creation of conftest files for getifaddrs tests. Add missing includes of replace.c and defines of SOCKET_WRAPPER_NOT_REPLACE. Michael (cherry picked from commit 26e6ebc7090b5742deb67805d85d809cafb4543d) (This used to be commit e00c6513e05afe91d4c419287283b34e931a161c) --- source4/lib/replace/getifaddrs.m4 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 index 5d5edf1cbd..dd2a95cb81 100644 --- a/source4/lib/replace/getifaddrs.m4 +++ b/source4/lib/replace/getifaddrs.m4 @@ -44,9 +44,10 @@ iface=no; iface=no; AC_CACHE_CHECK([for iface getifaddrs],libreplace_cv_HAVE_IFACE_GETIFADDRS,[ AC_TRY_RUN([ -#define NO_CONFIG_H 1 #define HAVE_IFACE_GETIFADDRS 1 +#define NO_CONFIG_H 1 #define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" #include "$libreplacedir/getifaddrs.c"], libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)]) @@ -60,10 +61,12 @@ fi if test $iface = no; then AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[ AC_TRY_RUN([ -#define NO_CONFIG_H 1 #define HAVE_IFACE_AIX 1 +#define NO_CONFIG_H 1 #define AUTOCONF_TEST 1 #undef _XOPEN_SOURCE_EXTENDED +#define SOCKET_WRAPPER_NOT_REPLACE +#include "$libreplacedir/replace.c" #include "$libreplacedir/getifaddrs.c"], libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)]) if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then @@ -75,9 +78,11 @@ fi if test $iface = no; then AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[ AC_TRY_RUN([ -#define NO_CONFIG_H 1 #define HAVE_IFACE_IFCONF 1 +#define NO_CONFIG_H 1 #define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE +#include "$libreplacedir/replace.c" #include "$libreplacedir/getifaddrs.c"], libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)]) if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then @@ -88,9 +93,11 @@ fi if test $iface = no; then AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[ AC_TRY_RUN([ -#define NO_CONFIG_H 1 #define HAVE_IFACE_IFREQ 1 +#define NO_CONFIG_H 1 #define AUTOCONF_TEST 1 +#define SOCKET_WRAPPER_NOT_REPLACE +#include "$libreplacedir/replace.c" #include "$libreplacedir/getifaddrs.c"], libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)]) if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then -- cgit From bf7d3b6ef440d61a8d65001f99c7526bb830f5d3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Feb 2008 10:42:22 +0100 Subject: libreplace: Fix comment originating from old samba source. Michael (This used to be commit 0440bcfe6359ca4842f473b1ca799cad9f1c6c96) --- source4/lib/replace/getifaddrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index 37cd950e09..a6f06e545f 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -363,7 +363,7 @@ int rep_getifaddrs(struct ifaddrs **ifap) #endif #ifdef AUTOCONF_TEST -/* this is the autoconf driver to test get_interfaces() */ +/* this is the autoconf driver to test getifaddrs() */ int main() { -- cgit From e9b0056586f6e57d4d1243c5622c568497e04d38 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Feb 2008 13:53:05 +0100 Subject: libreplace: don't use socketwrapper for getifaddrs() implementations. Michael (cherry picked from commit 85eec1d1d6b674294c50eb912fbe7d5a1dd42909) (This used to be commit a83db886e50b6ceeb71d93bf86fb5e0964b8d45f) --- source4/lib/replace/getifaddrs.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index a6f06e545f..053657475d 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -19,6 +19,8 @@ along with this program. If not, see . */ +#define SOCKET_WRAPPER_NOT_REPLACE + #include "replace.h" #include "system/network.h" -- cgit