summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-25 12:58:09 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-25 12:58:09 +0100
commit584c4a518f4d18452b6515db132e4f75fba733a1 (patch)
treebbe367f36f092f233d7aefb61d75d5d1e1e85031 /source4/lib
parent03ab8f9d79f2a06b357b2f5d392ea8b5be263c5e (diff)
parent71943b209b181e1e4a65ab477b83780add7051ae (diff)
downloadsamba-584c4a518f4d18452b6515db132e4f75fba733a1.tar.gz
samba-584c4a518f4d18452b6515db132e4f75fba733a1.tar.bz2
samba-584c4a518f4d18452b6515db132e4f75fba733a1.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
Conflicts: source/build/smb_build/header.pm source/build/smb_build/makefile.pm source/lib/ldb/include/ldb_private.h (This used to be commit 1a646af0647f021d99473a8991c35e616a423ea6)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/charset/charcnv.c2
-rw-r--r--source4/lib/events/events_select.c2
-rw-r--r--source4/lib/events/events_standard.c2
-rw-r--r--source4/lib/ldb/Makefile.in2
-rw-r--r--source4/lib/ldb/common/ldb.c73
-rw-r--r--source4/lib/ldb/common/ldb_modules.c75
-rw-r--r--source4/lib/ldb/config.mk19
-rw-r--r--source4/lib/ldb/include/ldb_private.h39
-rw-r--r--source4/lib/ldb/ldb.mk2
-rw-r--r--source4/lib/ldb/ldb_ildap/config.mk1
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c21
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c20
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map.c38
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map.h17
-rw-r--r--source4/lib/ldb/ldb_map/ldb_map_private.h7
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c8
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c8
-rw-r--r--source4/lib/ldb/modules/asq.c8
-rw-r--r--source4/lib/ldb/modules/operational.c7
-rw-r--r--source4/lib/ldb/modules/paged_results.c8
-rw-r--r--source4/lib/ldb/modules/paged_searches.c8
-rw-r--r--source4/lib/ldb/modules/rdn_name.c8
-rw-r--r--source4/lib/ldb/modules/skel.c7
-rw-r--r--source4/lib/ldb/modules/sort.c7
-rw-r--r--source4/lib/ldb/nssldb/ldb-nss.c5
-rw-r--r--source4/lib/ldb/tests/sample_module.c9
-rw-r--r--source4/lib/ldb/tools/ad2oLschema.c2
-rw-r--r--source4/lib/ldb/tools/cmdline.c2
-rw-r--r--source4/lib/ldb/tools/ldbadd.c2
-rw-r--r--source4/lib/ldb/tools/ldbdel.c2
-rw-r--r--source4/lib/ldb/tools/ldbedit.c2
-rw-r--r--source4/lib/ldb/tools/ldbmodify.c2
-rw-r--r--source4/lib/ldb/tools/ldbrename.c2
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c2
-rw-r--r--source4/lib/ldb/tools/ldbtest.c2
-rw-r--r--source4/lib/ldb/tools/oLschema2ldif.c2
-rw-r--r--source4/lib/registry/patchfile.c4
-rw-r--r--source4/lib/registry/patchfile_dotreg.c10
-rw-r--r--source4/lib/registry/registry.h7
-rw-r--r--source4/lib/registry/tests/generic.c14
-rw-r--r--source4/lib/registry/tools/regshell.c7
-rw-r--r--source4/lib/registry/tools/regtree.c2
-rw-r--r--source4/lib/registry/util.c18
-rw-r--r--source4/lib/replace/dlfcn.c2
-rw-r--r--source4/lib/replace/getifaddrs.c24
-rw-r--r--source4/lib/replace/getifaddrs.m445
-rw-r--r--source4/lib/replace/getpass.m412
-rw-r--r--source4/lib/replace/libreplace.m472
-rw-r--r--source4/lib/replace/libreplace_ld.m43
-rw-r--r--source4/lib/replace/system/config.m416
-rw-r--r--source4/lib/replace/system/network.h7
-rw-r--r--source4/lib/socket/socket_ip.c4
-rw-r--r--source4/lib/socket/socket_unix.c2
-rw-r--r--source4/lib/socket_wrapper/config.m47
-rw-r--r--source4/lib/socket_wrapper/socket_wrapper.c79
-rw-r--r--source4/lib/talloc/web/index.html13
-rw-r--r--source4/lib/tdr/tdr.c2
-rw-r--r--source4/lib/util/attr.h2
-rw-r--r--source4/lib/util/ms_fnmatch.c15
-rw-r--r--source4/lib/util/util.h3
60 files changed, 400 insertions, 393 deletions
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;
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/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..3c9ef3ff69 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;
}
@@ -135,6 +168,19 @@ int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *op
}
}
+ if (fn == NULL) {
+ 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;
+ }
+ ops = ldb_dso_load_symbol(ldb, backend, symbol_name);
+ if (ops != NULL) {
+ fn = ops->connect_fn;
+ }
+ talloc_free(symbol_name);
+ }
+
talloc_free(backend);
if (fn == NULL) {
@@ -236,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;
@@ -463,11 +508,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 */
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index a3bf71d0d8..a4e0b94188 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -125,9 +125,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)
@@ -137,51 +158,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)
{
@@ -256,8 +232,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/config.mk b/source4/lib/ldb/config.mk
index 0e7caa381f..d6980f341a 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,6 @@ OBJ_FILES = modules/skel.o
SUBSYSTEM = LIBLDB
CFLAGS = -Ilib/ldb/include
PRIVATE_DEPENDENCIES = LIBTALLOC SQLITE3 LIBTALLOC
-INIT_FUNCTION = ldb_sqlite3_init
OBJ_FILES = \
ldb_sqlite3/ldb_sqlite3.o
# End MODULE ldb_sqlite3
@@ -110,7 +109,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 \
@@ -128,10 +126,9 @@ 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 = 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/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h
index 61d5f5148a..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,19 +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_paged_searches_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_skel_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.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/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/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index a834e912d4..995b584f51 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -811,9 +811,18 @@ 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);
-}
+_PUBLIC_ const struct ldb_backend_ops ldb_ldap_backend_ops = {
+ .name = "ldap",
+ .connect_fn = ildb_connect
+};
+
+_PUBLIC_ const struct ldb_backend_ops ldb_ildap_backend_ops = {
+ .name = "ildap",
+ .connect_fn = ildb_connect
+};
+
+_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_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/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
+};
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..40e87f70d6 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 = {
+_PUBLIC_ const struct ldb_module_ops ldb_paged_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);
-}
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/tests/sample_module.c b/source4/lib/ldb/tests/sample_module.c
index 8ab1d33146..98d8e865dd 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",
+_PUBLIC_ const struct ldb_module_ops ldb_sample_module_ops = {
+ .name = "sample",
.add = sample_add,
};
-
-int init_module(void)
-{
- return ldb_register_module(&sample_ops);
-}
diff --git a/source4/lib/ldb/tools/ad2oLschema.c b/source4/lib/ldb/tools/ad2oLschema.c
index dec8a5f972..67b16dd06e 100644
--- a/source4/lib/ldb/tools/ad2oLschema.c
+++ b/source4/lib/ldb/tools/ad2oLschema.c
@@ -656,8 +656,6 @@ static struct schema_conv process_convert(struct ldb_context *ldb, enum convert_
const char *target_str;
enum convert_target target;
- ldb_global_init();
-
ctx = talloc_new(NULL);
ldb = ldb_init(ctx);
diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c
index 8ee1994615..c9c77c4e47 100644
--- a/source4/lib/ldb/tools/cmdline.c
+++ b/source4/lib/ldb/tools/cmdline.c
@@ -80,8 +80,6 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb,
{ NULL }
};
- ldb_global_init();
-
#if (_SAMBA_BUILD_ >= 4)
r = ldb_register_samba_handlers(ldb);
if (r != 0) {
diff --git a/source4/lib/ldb/tools/ldbadd.c b/source4/lib/ldb/tools/ldbadd.c
index d34193b86c..4ee66c4fc0 100644
--- a/source4/lib/ldb/tools/ldbadd.c
+++ b/source4/lib/ldb/tools/ldbadd.c
@@ -88,8 +88,6 @@ int main(int argc, const char **argv)
int i, ret=0, count=0;
struct ldb_cmdline *options;
- ldb_global_init();
-
ldb = ldb_init(NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c
index fcd0978779..184172b22b 100644
--- a/source4/lib/ldb/tools/ldbdel.c
+++ b/source4/lib/ldb/tools/ldbdel.c
@@ -77,8 +77,6 @@ int main(int argc, const char **argv)
int ret = 0, i;
struct ldb_cmdline *options;
- ldb_global_init();
-
ldb = ldb_init(NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c
index ed98a6d615..a9fd064bf8 100644
--- a/source4/lib/ldb/tools/ldbedit.c
+++ b/source4/lib/ldb/tools/ldbedit.c
@@ -279,8 +279,6 @@ int main(int argc, const char **argv)
const char *expression = "(|(objectClass=*)(distinguishedName=*))";
const char * const * attrs = NULL;
- ldb_global_init();
-
ldb = ldb_init(NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbmodify.c b/source4/lib/ldb/tools/ldbmodify.c
index ed12380095..dd6206b824 100644
--- a/source4/lib/ldb/tools/ldbmodify.c
+++ b/source4/lib/ldb/tools/ldbmodify.c
@@ -89,8 +89,6 @@ int main(int argc, const char **argv)
int i, ret=LDB_SUCCESS;
struct ldb_cmdline *options;
- ldb_global_init();
-
ldb = ldb_init(NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbrename.c b/source4/lib/ldb/tools/ldbrename.c
index c160e87ee4..b36310a500 100644
--- a/source4/lib/ldb/tools/ldbrename.c
+++ b/source4/lib/ldb/tools/ldbrename.c
@@ -56,8 +56,6 @@ int main(int argc, const char **argv)
struct ldb_cmdline *options;
struct ldb_dn *dn1, *dn2;
- ldb_global_init();
-
ldb = ldb_init(NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 24ceb30963..e25bd19965 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -276,8 +276,6 @@ int main(int argc, const char **argv)
int ret = -1;
const char *expression = "(|(objectClass=*)(distinguishedName=*))";
- ldb_global_init();
-
ldb = ldb_init(NULL);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c
index 5c21dd3830..57a7848733 100644
--- a/source4/lib/ldb/tools/ldbtest.c
+++ b/source4/lib/ldb/tools/ldbtest.c
@@ -393,8 +393,6 @@ int main(int argc, const char **argv)
TALLOC_CTX *mem_ctx = talloc_new(NULL);
struct ldb_context *ldb;
- ldb_global_init();
-
ldb = ldb_init(mem_ctx);
options = ldb_cmdline_process(ldb, argc, argv, usage);
diff --git a/source4/lib/ldb/tools/oLschema2ldif.c b/source4/lib/ldb/tools/oLschema2ldif.c
index 7b5f1b835c..1846a2c852 100644
--- a/source4/lib/ldb/tools/oLschema2ldif.c
+++ b/source4/lib/ldb/tools/oLschema2ldif.c
@@ -560,8 +560,6 @@ static void usage(void)
struct ldb_cmdline *options;
FILE *in = stdin;
FILE *out = stdout;
- ldb_global_init();
-
ctx = talloc_new(NULL);
ldb_ctx = ldb_init(ctx);
diff --git a/source4/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, "<No Name> = 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:"<No 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;
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;
diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c
index 4037d647d7..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 <http://www.gnu.org/licenses/>.
*/
+#define SOCKET_WRAPPER_NOT_REPLACE
+
#include "replace.h"
#include "system/network.h"
@@ -81,11 +83,11 @@ 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, *lastif;
+ struct ifaddrs *curif;
+ struct ifaddrs *lastif = NULL;
*ifap = NULL;
@@ -106,7 +108,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);
}
@@ -115,7 +117,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);
@@ -166,11 +168,11 @@ 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 *lastif = NULL;
*ifap = NULL;
@@ -201,14 +203,14 @@ int rep_getifaddrs(struct ifaddrs **ifap)
/* Loop through interfaces */
- for (i = 0; i<n && total < max_interfaces; i++) {
+ for (i = 0; i<n; i++) {
ifreq = ifr[i];
curif = calloc(1, sizeof(struct ifaddrs));
if (lastif == NULL) {
*ifap = curif;
} else {
- lastif->ifa_next = (*ifap);
+ lastif->ifa_next = curif;
}
strioctl.ic_cmd = SIOCGIFFLAGS;
@@ -270,8 +272,8 @@ int rep_getifaddrs(struct ifaddrs **ifap)
struct in_addr ipaddr;
struct in_addr nmask;
char *iname;
- int total = 0;
- struct ifaddrs *curif, *lastif;
+ struct ifaddrs *curif;
+ struct ifaddrs *lastif = NULL;
*ifap = NULL;
@@ -306,7 +308,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);
@@ -363,7 +365,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()
{
diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4
index 297a82d0c3..dd2a95cb81 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 <sys/socket.h>])
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 <sys/types.h>
#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,18 +42,16 @@ 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_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"],
- 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
+ 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"
@@ -61,39 +59,48 @@ 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 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"],
- 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 NO_CONFIG_H 1
#define AUTOCONF_TEST 1
+#define SOCKET_WRAPPER_NOT_REPLACE
+#include "$libreplacedir/replace.c"
#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 NO_CONFIG_H 1
#define AUTOCONF_TEST 1
+#define SOCKET_WRAPPER_NOT_REPLACE
+#include "$libreplacedir/replace.c"
#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
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
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 <stdio.h>
#include <unistd.h>
@@ -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 <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
AC_HAVE_DECL(errno, [#include <errno.h>])
-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 <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -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 <sys/types.h>
#include <stdio.h>
@@ -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 <stdarg.h>
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 <stdarg.h>
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 <stdio.h>], [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 <stdio.h>], [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 <sys/types.h>
#if STDC_HEADERS
@@ -310,30 +310,30 @@ AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
#include <stddef.h>
#endif
#include <signal.h>],[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 <unistd.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#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 <sys/types.h>],[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
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
;;
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 <sys/vfs.h>
@@ -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 <sys/capability.h>
@@ -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
;;
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
/*
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;
}
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
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 <jelmer@samba.org>
+ * Copyright (C) Jelmer Vernooij 2005,2008 <jelmer@samba.org>
* Copyright (C) Stefan Metzmacher 2006 <metze@samba.org>
*
* 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;
}
diff --git a/source4/lib/talloc/web/index.html b/source4/lib/talloc/web/index.html
index e53e8960a8..628030ad4c 100644
--- a/source4/lib/talloc/web/index.html
+++ b/source4/lib/talloc/web/index.html
@@ -24,19 +24,20 @@ bugzilla</a> bug tracking system.
<h2>Download</h2>
-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:
<pre>
- 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
</pre>
To fetch via rsync use this command:
<pre>
- 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 .
</pre>
<hr>
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;
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/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;
}
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"