From d63321a41e5e7d39a8a4e79a980cf92b1da7dfc0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 16:41:38 +0100 Subject: Cache iconv_convenience. (This used to be commit efd577cb5035f1b83bb8cd8958dcecb0ac0d055b) --- source4/lib/charset/util_unistr.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c index e0e1aed222..9b87f49800 100644 --- a/source4/lib/charset/util_unistr.c +++ b/source4/lib/charset/util_unistr.c @@ -123,6 +123,7 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2) { codepoint_t c1=0, c2=0; size_t size1, size2; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); /* handle null ptr comparisons to simplify the use in qsort */ if (s1 == s2) return 0; @@ -130,8 +131,8 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2) if (s2 == NULL) return 1; while (*s1 && *s2) { - c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1); - c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2); + c1 = next_codepoint(iconv_convenience, s1, &size1); + c2 = next_codepoint(iconv_convenience, s2, &size2); s1 += size1; s2 += size2; @@ -207,6 +208,7 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n) { codepoint_t c1=0, c2=0; size_t size1, size2; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); /* handle null ptr comparisons to simplify the use in qsort */ if (s1 == s2) return 0; @@ -216,8 +218,8 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n) while (*s1 && *s2 && n) { n--; - c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1); - c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2); + c1 = next_codepoint(iconv_convenience, s1, &size1); + c2 = next_codepoint(iconv_convenience, s2, &size2); s1 += size1; s2 += size2; @@ -480,6 +482,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) { size_t size=0; char *dest; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); /* this takes advantage of the fact that upper/lower can't change the length of a character by more than 1 byte */ @@ -490,12 +493,12 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) while (*src) { size_t c_size; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size); + codepoint_t c = next_codepoint(iconv_convenience, src, &c_size); src += c_size; c = tolower_w(c); - c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c); + c_size = push_codepoint(iconv_convenience, dest+size, c); if (c_size == -1) { talloc_free(dest); return NULL; @@ -520,6 +523,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) { size_t size=0; char *dest; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); if (!src) { return NULL; @@ -534,12 +538,12 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) while (*src) { size_t c_size; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size); + codepoint_t c = next_codepoint(iconv_convenience, src, &c_size); src += c_size; c = toupper_w(c); - c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c); + c_size = push_codepoint(iconv_convenience, dest+size, c); if (c_size == -1) { talloc_free(dest); return NULL; @@ -563,6 +567,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) _PUBLIC_ void strlower_m(char *s) { char *d; + struct smb_iconv_convenience *iconv_convenience; /* this is quite a common operation, so we want it to be fast. We optimise for the ascii case, knowing that all our @@ -576,12 +581,14 @@ _PUBLIC_ void strlower_m(char *s) if (!*s) return; + iconv_convenience = lp_iconv_convenience(global_loadparm); + d = s; while (*s) { size_t c_size, c_size2; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size); - c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, tolower_w(c)); + codepoint_t c = next_codepoint(iconv_convenience, s, &c_size); + c_size2 = push_codepoint(iconv_convenience, d, tolower_w(c)); if (c_size2 > c_size) { DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strlower_m\n", c, tolower_w(c), (int)c_size, (int)c_size2)); @@ -599,6 +606,7 @@ _PUBLIC_ void strlower_m(char *s) _PUBLIC_ void strupper_m(char *s) { char *d; + struct smb_iconv_convenience *iconv_convenience; /* this is quite a common operation, so we want it to be fast. We optimise for the ascii case, knowing that all our @@ -612,12 +620,14 @@ _PUBLIC_ void strupper_m(char *s) if (!*s) return; + iconv_convenience = lp_iconv_convenience(global_loadparm); + d = s; while (*s) { size_t c_size, c_size2; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size); - c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, toupper_w(c)); + codepoint_t c = next_codepoint(iconv_convenience, s, &c_size); + c_size2 = push_codepoint(iconv_convenience, d, toupper_w(c)); if (c_size2 > c_size) { DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strupper_m\n", c, toupper_w(c), (int)c_size, (int)c_size2)); -- cgit From c38c2765d1059b33f044a42c6555f3d10d339911 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 17:17:37 +0100 Subject: Remove yet more uses of global_loadparm. (This used to be commit e01c1e87c0fe9709df7eb5b863f7ce85564174cd) --- source4/lib/registry/hive.c | 3 ++- source4/lib/registry/hive.h | 3 ++- source4/lib/registry/regf.c | 10 ++++++---- source4/lib/registry/tests/hive.c | 4 +++- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index 5d56a30b3e..ad6a6421ab 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -22,6 +22,7 @@ #include "includes.h" #include "hive.h" #include "system/filesys.h" +#include "param/param.h" /** Open a registry file/host/etc */ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, @@ -52,7 +53,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, if (!strncmp(peek, "regf", 4)) { close(fd); - return reg_open_regf_file(parent_ctx, location, lp_ctx, root); + return reg_open_regf_file(parent_ctx, location, lp_iconv_convenience(lp_ctx), root); } else if (!strncmp(peek, "TDB file", 8)) { close(fd); return reg_open_ldb_file(parent_ctx, location, session_info, diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h index 6d9a69c7c5..87f335663d 100644 --- a/source4/lib/registry/hive.h +++ b/source4/lib/registry/hive.h @@ -188,7 +188,7 @@ WERROR hive_key_flush(struct hive_key *key); WERROR reg_open_directory(TALLOC_CTX *parent_ctx, const char *location, struct hive_key **key); WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, - const char *location, struct loadparm_context *lp_ctx, + const char *location, struct smb_iconv_convenience *iconv_convenience, struct hive_key **key); WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, @@ -200,6 +200,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, WERROR reg_create_directory(TALLOC_CTX *parent_ctx, const char *location, struct hive_key **key); WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, + struct smb_iconv_convenience *iconv_convenience, const char *location, int major_version, struct hive_key **key); diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 15b60745f0..cf3e564c0e 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -1863,7 +1863,9 @@ static WERROR regf_save_hbin(struct regf_data *regf) return WERR_OK; } -WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location, +WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, + struct smb_iconv_convenience *iconv_convenience, + const char *location, int minor_version, struct hive_key **key) { struct regf_data *regf; @@ -1874,7 +1876,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location, regf = (struct regf_data *)talloc_zero(NULL, struct regf_data); - regf->iconv_convenience = lp_iconv_convenience(global_loadparm); + regf->iconv_convenience = iconv_convenience; W_ERROR_HAVE_NO_MEMORY(regf); @@ -1950,7 +1952,7 @@ WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, const char *location, } WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location, - struct loadparm_context *lp_ctx, struct hive_key **key) + struct smb_iconv_convenience *iconv_convenience, struct hive_key **key) { struct regf_data *regf; struct regf_hdr *regf_hdr; @@ -1959,7 +1961,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location, regf = (struct regf_data *)talloc_zero(NULL, struct regf_data); - regf->iconv_convenience = lp_iconv_convenience(lp_ctx); + regf->iconv_convenience = iconv_convenience; W_ERROR_HAVE_NO_MEMORY(regf); diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 4d27e83a74..1dcb464d80 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -25,6 +25,7 @@ #include "torture/torture.h" #include "librpc/gen_ndr/winreg.h" #include "system/filesys.h" +#include "param/param.h" static bool test_del_nonexistant_key(struct torture_context *tctx, const void *test_data) @@ -349,7 +350,8 @@ static bool hive_setup_regf(struct torture_context *tctx, void **data) rmdir(dirname); - error = reg_create_regf_file(tctx, dirname, 5, &key); + error = reg_create_regf_file(tctx, lp_iconv_convenience(tctx->lp_ctx), + dirname, 5, &key); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to create new regf file\n"); return false; -- cgit From 10169a203019445e6d325a5c1559de3c73782237 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 17:54:24 +0100 Subject: Remove more global_loadparm instance.s (This used to be commit a1280252ce924df69d911e597b7f65d8038abef9) --- source4/lib/registry/ldb.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 0c8a55396e..dfd368ea80 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -36,7 +36,9 @@ struct ldb_key_data int subkey_count, value_count; }; -static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, +static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, + struct ldb_message *msg, const char **name, uint32_t *type, DATA_BLOB *data) { @@ -57,7 +59,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, { case REG_SZ: case REG_EXPAND_SZ: - data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF8, CH_UTF16, + data->length = convert_string_talloc(mem_ctx, iconv_convenience, CH_UTF8, CH_UTF16, val->data, val->length, (void **)&data->data); break; @@ -281,7 +283,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k, if (idx >= kd->value_count) return WERR_NO_MORE_ITEMS; - reg_ldb_unpack_value(mem_ctx, kd->values[idx], + reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), kd->values[idx], name, data_type, data); return WERR_OK; @@ -310,7 +312,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k, if (res->count == 0) return WERR_BADFILE; - reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data); + reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), res->msgs[0], NULL, data_type, data); return WERR_OK; } @@ -607,7 +609,9 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx, if (max_valbufsize != NULL) { DATA_BLOB data; - reg_ldb_unpack_value(mem_ctx, kd->values[i], NULL, + reg_ldb_unpack_value(mem_ctx, + lp_iconv_convenience(global_loadparm), + kd->values[i], NULL, NULL, &data); *max_valbufsize = MAX(*max_valbufsize, data.length); talloc_free(data.data); -- cgit From 299265d47b5b2faac39fbf908c738f336ea21e67 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 18:09:47 +0100 Subject: Remove yet more global_loadparm instances. (This used to be commit 5de88728ac5c567d3711d1ac6862bbdaced84b75) --- source4/lib/registry/patchfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index a4579010cd..7903bea246 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -273,6 +273,7 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1, * Load diff file */ _PUBLIC_ WERROR reg_diff_load(const char *filename, + struct smb_iconv_convenience *iconv_convenience, const struct reg_diff_callbacks *callbacks, void *callback_data) { @@ -308,7 +309,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, lp_iconv_convenience(global_loadparm), callbacks, callback_data); + return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data); } } @@ -442,5 +443,6 @@ _PUBLIC_ WERROR reg_diff_apply(struct registry_context *ctx, const char *filenam callbacks.del_all_values = reg_diff_apply_del_all_values; callbacks.done = NULL; - return reg_diff_load(filename, &callbacks, ctx); + return reg_diff_load(filename, lp_iconv_convenience(global_loadparm), + &callbacks, ctx); } -- cgit From e11c61bc5cd487dce06fc38bb0ee8c4e24b04e8c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 18:21:44 +0100 Subject: Introduce mprLpCtx() similar to mprMemCtx() for loadparm_context used by all EJS code. (This used to be commit 184988866fe8e740f58e3683eefcaa70f8b51d11) --- source4/lib/appweb/mpr/miniMpr.c | 7 +++++++ source4/lib/appweb/mpr/miniMpr.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/appweb/mpr/miniMpr.c b/source4/lib/appweb/mpr/miniMpr.c index 949d64fcf1..52b23608aa 100644 --- a/source4/lib/appweb/mpr/miniMpr.c +++ b/source4/lib/appweb/mpr/miniMpr.c @@ -30,6 +30,7 @@ */ #include "miniMpr.h" +#include "param/param.h" /************************************ Code ************************************/ #if !BLD_APPWEB @@ -49,6 +50,12 @@ void *mprMemCtx(void) return mpr_ctx; } +/* return the loadparm context being used for all ejs variables */ +struct loadparm_context *mprLpCtx(void) +{ + return global_loadparm; +} + void mprFree(void *ptr) { talloc_free(ptr); diff --git a/source4/lib/appweb/mpr/miniMpr.h b/source4/lib/appweb/mpr/miniMpr.h index 836fdab9f2..15ce30c8df 100644 --- a/source4/lib/appweb/mpr/miniMpr.h +++ b/source4/lib/appweb/mpr/miniMpr.h @@ -272,6 +272,8 @@ extern int mprMemcpy(char *dest, int destMax, const char *src, int nbytes); extern void mprSetCtx(void *ctx); extern void *mprMemCtx(void); +struct loadparm_context; +extern struct loadparm_context *mprLpCtx(void); /* This function needs to be provided by anyone using ejs */ void ejs_exception(const char *reason); -- cgit From 3101cb888d5cbad785050b8491b138d683d444fb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 25 Feb 2008 12:51:55 +0100 Subject: Remove uses of global_loadparm. (This used to be commit a16c9a2129ce92e7e1a613b2badd168e42ead436) --- source4/lib/registry/patchfile.c | 3 ++- source4/lib/registry/patchfile.h | 1 + source4/lib/registry/patchfile_dotreg.c | 3 ++- source4/lib/registry/patchfile_preg.c | 17 +++++++++-------- source4/lib/registry/tools/regdiff.c | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index 7903bea246..687fd4b91b 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -27,6 +27,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, + struct smb_iconv_convenience *iconv_convenience, const struct reg_diff_callbacks *callbacks, void *callback_data); @@ -306,7 +307,7 @@ _PUBLIC_ WERROR reg_diff_load(const char *filename, #endif if (strncmp(hdr, "PReg", 4) == 0) { /* Must be a GPO Registry.pol file */ - return reg_preg_diff_load(fd, callbacks, callback_data); + return reg_preg_diff_load(fd, iconv_convenience, callbacks, callback_data); } else { /* Must be a normal .REG file */ return reg_dotreg_diff_load(fd, iconv_convenience, callbacks, callback_data); diff --git a/source4/lib/registry/patchfile.h b/source4/lib/registry/patchfile.h index 08a977d9cd..9289390685 100644 --- a/source4/lib/registry/patchfile.h +++ b/source4/lib/registry/patchfile.h @@ -43,6 +43,7 @@ WERROR reg_generate_diff(struct registry_context *ctx1, const struct reg_diff_callbacks *callbacks, void *callback_data); WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct smb_iconv_convenience *iconv_convenience, struct reg_diff_callbacks **callbacks, void **callback_data); WERROR reg_generate_diff_key(struct registry_key *oldkey, diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index 46ea7c0008..6de642ecb8 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -101,6 +101,7 @@ static WERROR reg_dotreg_diff_del_all_values(void *callback_data, * Save registry diff */ _PUBLIC_ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct smb_iconv_convenience *iconv_convenience, struct reg_diff_callbacks **callbacks, void **callback_data) { @@ -109,7 +110,7 @@ _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); + data->iconv_convenience = iconv_convenience; if (filename) { data->fd = open(filename, O_CREAT, 0755); diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index 9cc9a5dec2..0d39e67450 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -29,14 +29,14 @@ struct preg_data { int fd; }; -static WERROR preg_read_utf16(int fd, char *c) +static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c) { uint16_t v; if (read(fd, &v, 2) < 2) { return WERR_GENERAL_FAILURE; } - push_codepoint(lp_iconv_convenience(global_loadparm), c, v); + push_codepoint(ic, c, v); return WERR_OK; } @@ -123,6 +123,7 @@ _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, * Load diff file */ _PUBLIC_ WERROR reg_preg_diff_load(int fd, + struct smb_iconv_convenience *iconv_convenience, const struct reg_diff_callbacks *callbacks, void *callback_data) { @@ -162,7 +163,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, while(1) { uint32_t value_type, length; - if (!W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr))) { + if (!W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr))) { break; } if (*buf_ptr != '[') { @@ -173,7 +174,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, /* Get the path */ buf_ptr = buf; - while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && + while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) && *buf_ptr != ';' && buf_ptr-buf < buf_size) { buf_ptr++; } @@ -181,7 +182,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, /* Get the name */ buf_ptr = buf; - while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && + while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) && *buf_ptr != ';' && buf_ptr-buf < buf_size) { buf_ptr++; } @@ -195,7 +196,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, } /* Read past delimiter */ buf_ptr = buf; - if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && + if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) && *buf_ptr == ';') && buf_ptr-buf < buf_size) { DEBUG(0, ("Error in PReg file.\n")); ret = WERR_GENERAL_FAILURE; @@ -209,7 +210,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, } /* Read past delimiter */ buf_ptr = buf; - if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && + if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) && *buf_ptr == ';') && buf_ptr-buf < buf_size) { DEBUG(0, ("Error in PReg file.\n")); ret = WERR_GENERAL_FAILURE; @@ -227,7 +228,7 @@ _PUBLIC_ WERROR reg_preg_diff_load(int fd, /* Check if delimiter is in place (whine if it isn't) */ buf_ptr = buf; - if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) && + if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) && *buf_ptr == ']') && buf_ptr-buf < buf_size) { DEBUG(0, ("Warning: Missing ']' in PReg file, expected ']', got '%c' 0x%x.\n", *buf_ptr, *buf_ptr)); diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index 406eaeea3d..c94380efd2 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -126,7 +126,7 @@ int main(int argc, const char **argv) poptFreeContext(pc); - error = reg_dotreg_diff_save(ctx, outputfile, &callbacks, + error = reg_dotreg_diff_save(ctx, outputfile, lp_iconv_convenience(cmdline_lp_ctx), &callbacks, &callback_data); if (!W_ERROR_IS_OK(error)) { fprintf(stderr, "Problem saving registry diff to '%s': %s\n", -- cgit From 3a90bed29f6ddb2566f73f02a59eef1b0f1b7554 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 27 Feb 2008 01:29:12 +0100 Subject: libreplace: fix standalone build on some systems. getifaddr tests include system/network.h, which does not find getaddrinfo.h without "-I.". Michael (This used to be commit cd95c702ed90128f659e27709c61d4c6abc969ef) --- source4/lib/replace/configure.ac | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/configure.ac b/source4/lib/replace/configure.ac index beeb77e152..72d788ddcc 100644 --- a/source4/lib/replace/configure.ac +++ b/source4/lib/replace/configure.ac @@ -3,6 +3,8 @@ AC_INIT(replace.c) AC_CONFIG_SRCDIR([replace.c]) AC_CONFIG_HEADER(config.h) +CFLAGS="$CFLAGS -I." + AC_LIBREPLACE_ALL_CHECKS if test "$ac_cv_prog_gcc" = yes; then -- cgit From b6f8132e928509e751f0dc35c93fb024105709ee Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 27 Feb 2008 01:41:30 +0100 Subject: libreplace: fix standalone build - add necessary libs. The libs needed for getifaddrs replacements have to be added to LIBS and used for the testsuite target. Michael (This used to be commit e7c1d6513b945b205abe84b18a251d06e737e659) --- source4/lib/replace/Makefile.in | 4 +++- source4/lib/replace/getifaddrs.m4 | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/Makefile.in b/source4/lib/replace/Makefile.in index 30f39ac6cb..af9522f3a6 100644 --- a/source4/lib/replace/Makefile.in +++ b/source4/lib/replace/Makefile.in @@ -10,6 +10,7 @@ VPATH = @libreplacedir@ srcdir = @srcdir@ builddir = @builddir@ INSTALL = @INSTALL@ +LIBS = @LIBS@ .PHONY: test all showflags install installcheck clean distclean realdistclean @@ -25,6 +26,7 @@ showflags: @echo ' CC = $(CC)' @echo ' CFLAGS = $(CFLAGS)' @echo ' LDFLAGS= $(LDFLAGS)' + @echo ' LIBS = $(LIBS)' install: all mkdir -p $(libdir) @@ -41,7 +43,7 @@ installcheck: install test TEST_OBJS = test/testsuite.o test/os2_delete.o test/strptime.o testsuite: libreplace.a $(TEST_OBJS) - $(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) + $(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS) .c.o: @echo Compiling $*.c diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 index dd2a95cb81..767797e8d2 100644 --- a/source4/lib/replace/getifaddrs.m4 +++ b/source4/lib/replace/getifaddrs.m4 @@ -71,6 +71,7 @@ AC_TRY_RUN([ 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]) + old_LIBS="$old_LIBS $LIBS" fi fi @@ -87,6 +88,7 @@ AC_TRY_RUN([ 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]) + old_LIBS="$old_LIBS $LIBS" fi fi @@ -102,6 +104,7 @@ AC_TRY_RUN([ 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]) + old_LIBS="$old_LIBS $LIBS" fi fi -- cgit From c9009b9876e14ce9bd9e6941a8344e1f5e47dd21 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 27 Feb 2008 10:33:32 +0100 Subject: libreplace: standalone build: use -I$srcdir instead of -I. Michael (This used to be commit ff311e613226e660998824b887cb9595ffbe0275) --- source4/lib/replace/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/configure.ac b/source4/lib/replace/configure.ac index 72d788ddcc..f5e054f476 100644 --- a/source4/lib/replace/configure.ac +++ b/source4/lib/replace/configure.ac @@ -3,7 +3,7 @@ AC_INIT(replace.c) AC_CONFIG_SRCDIR([replace.c]) AC_CONFIG_HEADER(config.h) -CFLAGS="$CFLAGS -I." +CFLAGS="$CFLAGS -I$srcdir" AC_LIBREPLACE_ALL_CHECKS -- cgit From ba94c12bc4a1ab8cfd6270ea69d1aef3d925ee29 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 28 Feb 2008 08:38:53 +1100 Subject: Fix rdn_name errors. Return the correct error when the DN is mismatched with it's RDN attribute (now matches AD). Andrew Bartlett (This used to be commit bf7166e785e5c5d52dbb0c12e5e4206d74e72f4e) --- source4/lib/ldb/modules/rdn_name.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index c4de8e8da8..65c044c0f4 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -119,7 +119,8 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) "RDN mismatch on %s: %s (%s)", ldb_dn_get_linearized(msg->dn), rdn_name, rdn_val.data); talloc_free(down_req); - return LDB_ERR_OPERATIONS_ERROR; + /* Match AD's error here */ + return LDB_ERR_INVALID_DN_SYNTAX; } } -- cgit From d70eafc5c635255feafc7121b381e7044ac11854 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 16:41:38 +0100 Subject: Cache iconv_convenience. (This used to be commit fe1d3e69990a71d7639ac8718f6ca51de4d7e6d2) --- source4/lib/charset/util_unistr.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c index e0e1aed222..9b87f49800 100644 --- a/source4/lib/charset/util_unistr.c +++ b/source4/lib/charset/util_unistr.c @@ -123,6 +123,7 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2) { codepoint_t c1=0, c2=0; size_t size1, size2; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); /* handle null ptr comparisons to simplify the use in qsort */ if (s1 == s2) return 0; @@ -130,8 +131,8 @@ _PUBLIC_ int strcasecmp_m(const char *s1, const char *s2) if (s2 == NULL) return 1; while (*s1 && *s2) { - c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1); - c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2); + c1 = next_codepoint(iconv_convenience, s1, &size1); + c2 = next_codepoint(iconv_convenience, s2, &size2); s1 += size1; s2 += size2; @@ -207,6 +208,7 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n) { codepoint_t c1=0, c2=0; size_t size1, size2; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); /* handle null ptr comparisons to simplify the use in qsort */ if (s1 == s2) return 0; @@ -216,8 +218,8 @@ _PUBLIC_ int strncasecmp_m(const char *s1, const char *s2, size_t n) while (*s1 && *s2 && n) { n--; - c1 = next_codepoint(lp_iconv_convenience(global_loadparm), s1, &size1); - c2 = next_codepoint(lp_iconv_convenience(global_loadparm), s2, &size2); + c1 = next_codepoint(iconv_convenience, s1, &size1); + c2 = next_codepoint(iconv_convenience, s2, &size2); s1 += size1; s2 += size2; @@ -480,6 +482,7 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) { size_t size=0; char *dest; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); /* this takes advantage of the fact that upper/lower can't change the length of a character by more than 1 byte */ @@ -490,12 +493,12 @@ _PUBLIC_ char *strlower_talloc(TALLOC_CTX *ctx, const char *src) while (*src) { size_t c_size; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size); + codepoint_t c = next_codepoint(iconv_convenience, src, &c_size); src += c_size; c = tolower_w(c); - c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c); + c_size = push_codepoint(iconv_convenience, dest+size, c); if (c_size == -1) { talloc_free(dest); return NULL; @@ -520,6 +523,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) { size_t size=0; char *dest; + struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm); if (!src) { return NULL; @@ -534,12 +538,12 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) while (*src) { size_t c_size; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), src, &c_size); + codepoint_t c = next_codepoint(iconv_convenience, src, &c_size); src += c_size; c = toupper_w(c); - c_size = push_codepoint(lp_iconv_convenience(global_loadparm), dest+size, c); + c_size = push_codepoint(iconv_convenience, dest+size, c); if (c_size == -1) { talloc_free(dest); return NULL; @@ -563,6 +567,7 @@ _PUBLIC_ char *strupper_talloc(TALLOC_CTX *ctx, const char *src) _PUBLIC_ void strlower_m(char *s) { char *d; + struct smb_iconv_convenience *iconv_convenience; /* this is quite a common operation, so we want it to be fast. We optimise for the ascii case, knowing that all our @@ -576,12 +581,14 @@ _PUBLIC_ void strlower_m(char *s) if (!*s) return; + iconv_convenience = lp_iconv_convenience(global_loadparm); + d = s; while (*s) { size_t c_size, c_size2; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size); - c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, tolower_w(c)); + codepoint_t c = next_codepoint(iconv_convenience, s, &c_size); + c_size2 = push_codepoint(iconv_convenience, d, tolower_w(c)); if (c_size2 > c_size) { DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strlower_m\n", c, tolower_w(c), (int)c_size, (int)c_size2)); @@ -599,6 +606,7 @@ _PUBLIC_ void strlower_m(char *s) _PUBLIC_ void strupper_m(char *s) { char *d; + struct smb_iconv_convenience *iconv_convenience; /* this is quite a common operation, so we want it to be fast. We optimise for the ascii case, knowing that all our @@ -612,12 +620,14 @@ _PUBLIC_ void strupper_m(char *s) if (!*s) return; + iconv_convenience = lp_iconv_convenience(global_loadparm); + d = s; while (*s) { size_t c_size, c_size2; - codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), s, &c_size); - c_size2 = push_codepoint(lp_iconv_convenience(global_loadparm), d, toupper_w(c)); + codepoint_t c = next_codepoint(iconv_convenience, s, &c_size); + c_size2 = push_codepoint(iconv_convenience, d, toupper_w(c)); if (c_size2 > c_size) { DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strupper_m\n", c, toupper_w(c), (int)c_size, (int)c_size2)); -- cgit From dfc84928d722191dad264a7206e20919c140e3ea Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 28 Feb 2008 21:43:06 +0100 Subject: libreplace: add extended getifaddrs test that prints out the interfaces. Michael (This used to be commit 9d2bab09aac22c00fe23f1e1265a2dbd0901e9ce) --- source4/lib/replace/Makefile.in | 2 +- source4/lib/replace/test/getifaddrs.c | 96 +++++++++++++++++++++++++++++++++++ source4/lib/replace/test/testsuite.c | 9 ++-- 3 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 source4/lib/replace/test/getifaddrs.c (limited to 'source4/lib') diff --git a/source4/lib/replace/Makefile.in b/source4/lib/replace/Makefile.in index af9522f3a6..c989835a8d 100644 --- a/source4/lib/replace/Makefile.in +++ b/source4/lib/replace/Makefile.in @@ -40,7 +40,7 @@ test: all installcheck: install test -TEST_OBJS = test/testsuite.o test/os2_delete.o test/strptime.o +TEST_OBJS = test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o testsuite: libreplace.a $(TEST_OBJS) $(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS) diff --git a/source4/lib/replace/test/getifaddrs.c b/source4/lib/replace/test/getifaddrs.c new file mode 100644 index 0000000000..66eed70268 --- /dev/null +++ b/source4/lib/replace/test/getifaddrs.c @@ -0,0 +1,96 @@ +/* + * Unix SMB/CIFS implementation. + * + * libreplace getifaddrs test + * + * Copyright (C) Michael Adam 2008 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AUTOCONF_TEST +#include "replace.h" +#include "system/network.h" +#endif + +#ifdef HAVE_INET_NTOP +#define rep_inet_ntop inet_ntop +#endif + +static const char *format_sockaddr(struct sockaddr *addr, + char *addrstring, + socklen_t addrlen) +{ + const char *result = NULL; + + if (addr->sa_family == AF_INET) { + result = rep_inet_ntop(AF_INET, + &((struct sockaddr_in *)addr)->sin_addr, + addrstring, + addrlen); + } else if (addr->sa_family == AF_INET6) { + result = rep_inet_ntop(AF_INET6, + &((struct sockaddr_in6 *)addr)->sin6_addr, + addrstring, + addrlen); + } + return result; +} + +int getifaddrs_test(void) +{ + struct ifaddrs *ifs = NULL; + int ret; + + ret = getifaddrs(&ifs); + if (ret != 0) { + fprintf(stderr, "getifaddrs() failed: %s", strerror(errno)); + return 1; + } + + while (ifs) { + printf("%-10s ", ifs->ifa_name); + if (ifs->ifa_addr != NULL) { + char addrstring[INET6_ADDRSTRLEN]; + const char *result; + + result = format_sockaddr(ifs->ifa_addr, + addrstring, + sizeof(addrstring)); + if (result != NULL) { + printf("IP=%s ", addrstring); + } + + if (ifs->ifa_netmask != NULL) { + result = format_sockaddr(ifs->ifa_netmask, + addrstring, + sizeof(addrstring)); + if (result != NULL) { + printf("NETMASK=%s", addrstring); + } + } else { + printf("AF=%d ", ifs->ifa_addr->sa_family); + } + } else { + printf(""); + } + + printf("\n"); + ifs = ifs->ifa_next; + } + + freeifaddrs(ifs); + + return 0; +} diff --git a/source4/lib/replace/test/testsuite.c b/source4/lib/replace/test/testsuite.c index c9f3301005..b538360365 100644 --- a/source4/lib/replace/test/testsuite.c +++ b/source4/lib/replace/test/testsuite.c @@ -856,21 +856,18 @@ static int test_strptime(void) return libreplace_test_strptime(); } +extern int getifaddrs_test(void); + static int test_getifaddrs(void) { - struct ifaddrs *ifa; - int ret; printf("test: getifaddrs\n"); - ret = getifaddrs(&ifa); - if (ret != 0) { + if (getifaddrs_test() != 0) { printf("failure: getifaddrs\n"); return false; } - freeifaddrs(ifa); - printf("success: getifaddrs\n"); return true; } -- cgit From c9fb4f05f42209ed383e4e84954b549687fe6d6d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 28 Feb 2008 21:44:31 +0100 Subject: libreplace: use the new getifaddrs test also for autoconf. Michael (This used to be commit a2a506ff0eae2a64ebe2ddbb81a6c2a5fa7fe3da) --- source4/lib/replace/getifaddrs.c | 29 ----------------------------- source4/lib/replace/getifaddrs.m4 | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 33 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index 053657475d..551ff863df 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -363,32 +363,3 @@ int rep_getifaddrs(struct ifaddrs **ifap) return -1; } #endif - -#ifdef AUTOCONF_TEST -/* this is the autoconf driver to test getifaddrs() */ - - int main() -{ - struct ifaddrs *ifs = NULL; - int ret; - - ret = getifaddrs(&ifs); - if (ret != 0) { - perror("getifaddrs() failed"); - return 1; - } - - while (ifs) { - printf("%-10s ", ifs->ifa_name); - if (ifs->ifa_addr != NULL && - ifs->ifa_addr->sa_family == AF_INET) { - printf("IP=%s ", inet_ntoa(((struct sockaddr_in *)ifs->ifa_addr)->sin_addr)); - if (ifs->ifa_netmask != NULL) - printf("NETMASK=%s", inet_ntoa(((struct sockaddr_in *)ifs->ifa_netmask)->sin_addr)); - } - printf("\n"); - ifs = ifs->ifa_next; - } - return 0; -} -#endif diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 index 767797e8d2..1fa168b59e 100644 --- a/source4/lib/replace/getifaddrs.m4 +++ b/source4/lib/replace/getifaddrs.m4 @@ -49,7 +49,10 @@ AC_TRY_RUN([ #define AUTOCONF_TEST 1 #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/getifaddrs.c"], 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]) @@ -67,7 +70,10 @@ AC_TRY_RUN([ #undef _XOPEN_SOURCE_EXTENDED #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/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 iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available]) @@ -84,7 +90,10 @@ AC_TRY_RUN([ #define AUTOCONF_TEST 1 #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/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 iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available]) @@ -100,7 +109,10 @@ AC_TRY_RUN([ #define AUTOCONF_TEST 1 #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" -#include "$libreplacedir/getifaddrs.c"], +#include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/getifaddrs.c" +#define getifaddrs_test main +#include "$libreplacedir/test/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 iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available]) -- cgit From 53654f5caf701a32b615bed784d78765f351cb73 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Feb 2008 00:06:55 +0100 Subject: libreplace: try and fix rep_getifaddrs() for Tru64. Don't fail when there is no address assigned to the interface. Put NULL into the ifaddrs structure instead. Michael (This used to be commit ee170c85e0e76411bd752de5fe51db6940dab929) --- source4/lib/replace/getifaddrs.c | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index 551ff863df..f66bf800eb 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -109,38 +109,33 @@ int rep_getifaddrs(struct ifaddrs **ifap) /* Loop through interfaces, looking for given IP address */ for (i=n-1; i>=0; i--) { - if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != 0) { + if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) == -1) { freeifaddrs(*ifap); + return -1; } curif = calloc(1, sizeof(struct ifaddrs)); - if (lastif == NULL) { - *ifap = curif; - } else { - lastif->ifa_next = curif; - } - curif->ifa_name = strdup(ifr[i].ifr_name); - curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr); + curif->ifa_flags = ifr[i].ifr_flags; curif->ifa_dstaddr = NULL; curif->ifa_data = NULL; curif->ifa_next = NULL; - curif->ifa_netmask = NULL; - - if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) != 0) { - freeifaddrs(*ifap); - return -1; - } - curif->ifa_flags = ifr[i].ifr_flags; - - if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != 0) { - freeifaddrs(*ifap); - return -1; - } + curif->ifa_addr = NULL + if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != -1) { + curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr); + } - curif->ifa_netmask = sockaddr_dup(&ifr[i].ifr_addr); + curif->ifa_netmask = NULL; + if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != -1) { + curif->ifa_netmask = sockaddr_dup(&ifr[i].ifr_addr); + } + if (lastif == NULL) { + *ifap = curif; + } else { + lastif->ifa_next = curif; + } lastif = curif; } -- cgit From 836ec12b55ebb30b986b127e16341383e24e9331 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 29 Feb 2008 01:06:05 +0100 Subject: Fix ldapi support. (This used to be commit 9499f8eea534cf93f96af17941e9195aadc0a756) --- source4/lib/ldb/ldb_ildap/ldb_ildap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 995b584f51..79958a86eb 100644 --- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c +++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c @@ -816,8 +816,8 @@ _PUBLIC_ const struct ldb_backend_ops ldb_ldap_backend_ops = { .connect_fn = ildb_connect }; -_PUBLIC_ const struct ldb_backend_ops ldb_ildap_backend_ops = { - .name = "ildap", +_PUBLIC_ const struct ldb_backend_ops ldb_ldapi_backend_ops = { + .name = "ldapi", .connect_fn = ildb_connect }; -- cgit From 42f389823d972e855936c022b95d224b0232d737 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Feb 2008 01:25:54 +0100 Subject: libreplace: add missing semicolon to getifaddrs. Michael (This used to be commit 29818a07de826fd687003ff25865d77939ecaa9a) --- 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 f66bf800eb..adc2517e5c 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -121,7 +121,7 @@ int rep_getifaddrs(struct ifaddrs **ifap) curif->ifa_data = NULL; curif->ifa_next = NULL; - curif->ifa_addr = NULL + curif->ifa_addr = NULL; if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != -1) { curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr); } -- cgit From a9706ba3c1e08243a761cb9c32b605e9f41535de Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Feb 2008 01:49:30 +0100 Subject: libreplace: add missing newline in output of getifaddrs test. Michael (This used to be commit f8243cfc47c7414bab7f249d0e5d1c85e8ca7d64) --- source4/lib/replace/test/getifaddrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/test/getifaddrs.c b/source4/lib/replace/test/getifaddrs.c index 66eed70268..4455462193 100644 --- a/source4/lib/replace/test/getifaddrs.c +++ b/source4/lib/replace/test/getifaddrs.c @@ -55,7 +55,7 @@ int getifaddrs_test(void) ret = getifaddrs(&ifs); if (ret != 0) { - fprintf(stderr, "getifaddrs() failed: %s", strerror(errno)); + fprintf(stderr, "getifaddrs() failed: %s\n", strerror(errno)); return 1; } -- cgit From daab914cafba742ff9fcb3aab55cc812cf415058 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Feb 2008 02:22:02 +0100 Subject: libreplace: fix silly crashbug in getifaddrs_test(). Michael (This used to be commit 523626908d25f974fd1ae6d7306b1d4bc8414162) --- source4/lib/replace/test/getifaddrs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/test/getifaddrs.c b/source4/lib/replace/test/getifaddrs.c index 4455462193..c78c9b545e 100644 --- a/source4/lib/replace/test/getifaddrs.c +++ b/source4/lib/replace/test/getifaddrs.c @@ -51,9 +51,11 @@ static const char *format_sockaddr(struct sockaddr *addr, int getifaddrs_test(void) { struct ifaddrs *ifs = NULL; + struct ifaddrs *ifs_head = NULL; int ret; ret = getifaddrs(&ifs); + ifs_head = ifs; if (ret != 0) { fprintf(stderr, "getifaddrs() failed: %s\n", strerror(errno)); return 1; @@ -90,7 +92,7 @@ int getifaddrs_test(void) ifs = ifs->ifa_next; } - freeifaddrs(ifs); + freeifaddrs(ifs_head); return 0; } -- cgit From f21aac60d9937d11f3019251f1960b51b68c5e54 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Feb 2008 02:23:29 +0100 Subject: libreplace: fix rep_freeifaddrs to not segfault on NULL input. Michael (This used to be commit 0cbb87453beb52c6b0bc3a48791f49678f4030c5) --- source4/lib/replace/getifaddrs.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.c b/source4/lib/replace/getifaddrs.c index adc2517e5c..f6f0ec080c 100644 --- a/source4/lib/replace/getifaddrs.c +++ b/source4/lib/replace/getifaddrs.c @@ -44,13 +44,14 @@ void rep_freeifaddrs(struct ifaddrs *ifp) { - free(ifp->ifa_name); - free(ifp->ifa_addr); - free(ifp->ifa_netmask); - free(ifp->ifa_dstaddr); - if (ifp->ifa_next != NULL) + if (ifp != NULL) { + free(ifp->ifa_name); + free(ifp->ifa_addr); + free(ifp->ifa_netmask); + free(ifp->ifa_dstaddr); freeifaddrs(ifp->ifa_next); - free(ifp); + free(ifp); + } } static struct sockaddr *sockaddr_dup(struct sockaddr *sa) -- cgit From abb9356b4f78bcd64de6c53f6ce6b1fda05b42e2 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Feb 2008 02:43:24 +0100 Subject: libreplace: ifdef out ip6 code if unsupported. Michael (This used to be commit 54cc0df4dbf6d63a9b94e1ac6af4ec7f7803bc30) --- source4/lib/replace/test/getifaddrs.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/test/getifaddrs.c b/source4/lib/replace/test/getifaddrs.c index c78c9b545e..8b00ac2f40 100644 --- a/source4/lib/replace/test/getifaddrs.c +++ b/source4/lib/replace/test/getifaddrs.c @@ -39,11 +39,13 @@ static const char *format_sockaddr(struct sockaddr *addr, &((struct sockaddr_in *)addr)->sin_addr, addrstring, addrlen); +#ifdef HAVE_STRUCT_SOCKADDR_IN6 } else if (addr->sa_family == AF_INET6) { result = rep_inet_ntop(AF_INET6, &((struct sockaddr_in6 *)addr)->sin6_addr, addrstring, addrlen); +#endif } return result; } -- cgit From de4a2214efb3fcc1aa04664371983dbc768eaf79 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 29 Feb 2008 02:46:14 +0100 Subject: libreplace: add snprintf.c to test code for getifaddrs - needed on some systems. Michael (This used to be commit 0aff54a12e20d5e91fcdec7aaec103fb9a371a23) --- source4/lib/replace/getifaddrs.m4 | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/replace/getifaddrs.m4 b/source4/lib/replace/getifaddrs.m4 index 1fa168b59e..6cca155de3 100644 --- a/source4/lib/replace/getifaddrs.m4 +++ b/source4/lib/replace/getifaddrs.m4 @@ -50,6 +50,7 @@ AC_TRY_RUN([ #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" #include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" #include "$libreplacedir/getifaddrs.c" #define getifaddrs_test main #include "$libreplacedir/test/getifaddrs.c"], @@ -71,6 +72,7 @@ AC_TRY_RUN([ #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" #include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" #include "$libreplacedir/getifaddrs.c" #define getifaddrs_test main #include "$libreplacedir/test/getifaddrs.c"], @@ -91,6 +93,7 @@ AC_TRY_RUN([ #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" #include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" #include "$libreplacedir/getifaddrs.c" #define getifaddrs_test main #include "$libreplacedir/test/getifaddrs.c"], @@ -110,6 +113,7 @@ AC_TRY_RUN([ #define SOCKET_WRAPPER_NOT_REPLACE #include "$libreplacedir/replace.c" #include "$libreplacedir/inet_ntop.c" +#include "$libreplacedir/snprintf.c" #include "$libreplacedir/getifaddrs.c" #define getifaddrs_test main #include "$libreplacedir/test/getifaddrs.c"], -- cgit From d8d9a6ef040b6c3e7946e6ae2cba2b28234c8baf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 26 Feb 2008 15:11:47 +0100 Subject: Move manpage management out of the perl build system. (This used to be commit 1dd6bea507f1f5e26cccf89148280721260a4673) --- source4/lib/ldb/config.mk | 8 +++++--- source4/lib/ldb/tools/config.mk | 18 ++++++++++++------ source4/lib/registry/config.mk | 12 ++++++++---- source4/lib/talloc/config.mk | 4 +++- 4 files changed, 28 insertions(+), 14 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index d6980f341a..e7f138b2a8 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -147,12 +147,13 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ SOCKET_WRAPPER -MANPAGE = man/ldb.3 PUBLIC_HEADERS = include/ldb.h include/ldb_errors.h # # End SUBSYSTEM ldb ################################################ +MANPAGES += $(ldbdir)/man/ldb.3 + ################################################ # Start BINARY ldbtest [BINARY::ldbtest] @@ -167,7 +168,6 @@ PRIVATE_DEPENDENCIES = \ # Start BINARY oLschema2ldif [BINARY::oLschema2ldif] INSTALLDIR = BINDIR -MANPAGE = man/oLschema2ldif.1 OBJ_FILES= \ tools/convert.o \ tools/oLschema2ldif.o @@ -176,11 +176,12 @@ PRIVATE_DEPENDENCIES = \ # End BINARY oLschema2ldif ################################################ +MANPAGES += $(ldbdir)/man/oLschema2ldif.1 + ################################################ # Start BINARY ad2oLschema [BINARY::ad2oLschema] INSTALLDIR = BINDIR -MANPAGE = man/ad2oLschema.1 OBJ_FILES= \ tools/convert.o \ tools/ad2oLschema.o @@ -189,6 +190,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ad2oLschema ################################################ +MANPAGES += $(ldbdir)/man/ad2oLschema.1 mkinclude tools/config.mk mkinclude ldb_ildap/config.mk diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk index bf6c5f963c..c1c368f336 100644 --- a/source4/lib/ldb/tools/config.mk +++ b/source4/lib/ldb/tools/config.mk @@ -17,10 +17,11 @@ OBJ_FILES = \ ldbadd.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE LIBCLI_RESOLVE -MANPAGE = ../man/ldbadd.1 # End BINARY ldbadd ################################################ +MANPAGES += $(ldbdir)/../man/ldbadd.1 + ################################################ # Start BINARY ldbdel [BINARY::ldbdel] @@ -29,10 +30,11 @@ OBJ_FILES= \ ldbdel.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbdel.1 # End BINARY ldbdel ################################################ +MANPAGES += $(ldbdir)/../man/ldbdel.1 + ################################################ # Start BINARY ldbmodify [BINARY::ldbmodify] @@ -41,10 +43,11 @@ OBJ_FILES= \ ldbmodify.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbmodify.1 # End BINARY ldbmodify ################################################ +MANPAGES += $(ldbdir)/../man/ldbmodify.1 + ################################################ # Start BINARY ldbsearch [BINARY::ldbsearch] @@ -53,10 +56,11 @@ OBJ_FILES= \ ldbsearch.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbsearch.1 # End BINARY ldbsearch ################################################ +MANPAGES += $(ldbdir)/../man/ldbsearch.1 + ################################################ # Start BINARY ldbedit [BINARY::ldbedit] @@ -65,10 +69,11 @@ OBJ_FILES= \ ldbedit.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbedit.1 # End BINARY ldbedit ################################################ +MANPAGES += $(ldbdir)/../man/ldbedit.1 + ################################################ # Start BINARY ldbrename [BINARY::ldbrename] @@ -77,8 +82,9 @@ OBJ_FILES= \ ldbrename.o PRIVATE_DEPENDENCIES = \ LIBLDB_CMDLINE -MANPAGE = ../man/ldbrename.1 # End BINARY ldbrename ################################################ +MANPAGES += $(ldbdir)/../man/ldbrename.1 + diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 7a9c8fcff1..af5b1bc301 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -52,10 +52,11 @@ INSTALLDIR = BINDIR OBJ_FILES = tools/regdiff.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS -MANPAGE = man/regdiff.1 # End BINARY regdiff ################################################ +MANPAGES += lib/registry/man/regdiff.1 + ################################################ # Start BINARY regpatch [BINARY::regpatch] @@ -64,10 +65,11 @@ OBJ_FILES = tools/regpatch.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS \ registry_common -MANPAGE = man/regpatch.1 # End BINARY regpatch ################################################ +MANPAGES += lib/registry/man/regpatch.1 + ################################################ # Start BINARY regshell [BINARY::regshell] @@ -76,10 +78,11 @@ OBJ_FILES = tools/regshell.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ SMBREADLINE registry_common -MANPAGE = man/regshell.1 # End BINARY regshell ################################################ +MANPAGES += lib/registry/man/regshell.1 + ################################################ # Start BINARY regtree [BINARY::regtree] @@ -88,10 +91,11 @@ OBJ_FILES = tools/regtree.o PRIVATE_DEPENDENCIES = \ LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ registry_common -MANPAGE = man/regtree.1 # End BINARY regtree ################################################ +MANPAGES += lib/registry/man/regtree.1 + [SUBSYSTEM::torture_registry] PRIVATE_DEPENDENCIES = registry PRIVATE_PROTO_HEADER = tests/proto.h diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk index af1b590c98..abbad2e613 100644 --- a/source4/lib/talloc/config.mk +++ b/source4/lib/talloc/config.mk @@ -1,6 +1,8 @@ [LIBRARY::LIBTALLOC] OUTPUT_TYPE = STATIC_LIBRARY OBJ_FILES = talloc.o -MANPAGE = talloc.3 CFLAGS = -Ilib/talloc PUBLIC_HEADERS = talloc.h + + +MANPAGES += $(tallocdir)/talloc.3 -- cgit From 6b3ecd52d510c3f67bb405381ea68ff2346d001c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 26 Feb 2008 15:19:45 +0100 Subject: Fix manpage paths. (This used to be commit 36da52abf5be79e37bd495ec4265e01b27aa9da5) --- source4/lib/ldb/tools/config.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/tools/config.mk b/source4/lib/ldb/tools/config.mk index c1c368f336..02ad84ae25 100644 --- a/source4/lib/ldb/tools/config.mk +++ b/source4/lib/ldb/tools/config.mk @@ -20,7 +20,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbadd ################################################ -MANPAGES += $(ldbdir)/../man/ldbadd.1 +MANPAGES += $(ldbdir)/man/ldbadd.1 ################################################ # Start BINARY ldbdel @@ -33,7 +33,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbdel ################################################ -MANPAGES += $(ldbdir)/../man/ldbdel.1 +MANPAGES += $(ldbdir)/man/ldbdel.1 ################################################ # Start BINARY ldbmodify @@ -46,7 +46,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbmodify ################################################ -MANPAGES += $(ldbdir)/../man/ldbmodify.1 +MANPAGES += $(ldbdir)/man/ldbmodify.1 ################################################ # Start BINARY ldbsearch @@ -59,7 +59,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbsearch ################################################ -MANPAGES += $(ldbdir)/../man/ldbsearch.1 +MANPAGES += $(ldbdir)/man/ldbsearch.1 ################################################ # Start BINARY ldbedit @@ -72,7 +72,7 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbedit ################################################ -MANPAGES += $(ldbdir)/../man/ldbedit.1 +MANPAGES += $(ldbdir)/man/ldbedit.1 ################################################ # Start BINARY ldbrename @@ -85,6 +85,6 @@ PRIVATE_DEPENDENCIES = \ # End BINARY ldbrename ################################################ -MANPAGES += $(ldbdir)/../man/ldbrename.1 +MANPAGES += $(ldbdir)/man/ldbrename.1 -- cgit From 1ada7108408f567f61cfbf2b625730ba898452db Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 29 Feb 2008 14:23:38 +0100 Subject: Move public header accumulation out of the perl code. Never install generated prototype files. It's easier to break the API when using them and they're not easily readable for 3rd party users. Conflicts: source/auth/config.mk source/auth/credentials/config.mk source/auth/gensec/config.mk source/build/smb_build/config_mk.pm source/build/smb_build/main.pl source/build/smb_build/makefile.pm source/dsdb/config.mk source/lib/charset/config.mk source/lib/tdr/config.mk source/lib/util/config.mk source/libcli/config.mk source/libcli/ldap/config.mk source/librpc/config.mk source/param/config.mk source/rpc_server/config.mk source/torture/config.mk (This used to be commit 6c659689ed4081f1d7a6253c538c7f01784197ba) --- source4/lib/basic.mk | 12 +++++++++--- source4/lib/charset/config.mk | 6 ++++-- source4/lib/cmdline/config.mk | 3 ++- source4/lib/events/config.mk | 3 ++- source4/lib/ldb/config.mk | 3 ++- source4/lib/nss_wrapper/config.mk | 3 ++- source4/lib/registry/config.mk | 3 ++- source4/lib/socket_wrapper/config.mk | 3 ++- source4/lib/talloc/config.mk | 2 +- source4/lib/tdb/config.mk | 3 ++- source4/lib/tdr/config.mk | 5 +++-- source4/lib/util/config.mk | 24 +++++++++++++----------- 12 files changed, 44 insertions(+), 26 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index a118636c52..d059bdf49b 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -22,17 +22,23 @@ mkinclude crypto/config.mk OBJ_FILES = compression/mszip.o [SUBSYSTEM::GENCACHE] -PUBLIC_HEADERS = gencache/gencache.h OBJ_FILES = gencache/gencache.o PRIVATE_DEPENDENCIES = TDB_WRAP + +PUBLIC_HEADERS += lib/gencache/gencache.h + [SUBSYSTEM::LDB_WRAP] -PUBLIC_HEADERS = ldb_wrap.h OBJ_FILES = ldb_wrap.o PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB + +PUBLIC_HEADERS += lib/ldb_wrap.h + [SUBSYSTEM::TDB_WRAP] -PUBLIC_HEADERS = tdb_wrap.h OBJ_FILES = tdb_wrap.o PUBLIC_DEPENDENCIES = LIBTDB + + +PUBLIC_HEADERS += lib/tdb_wrap.h diff --git a/source4/lib/charset/config.mk b/source4/lib/charset/config.mk index 4f0c80c79d..2766784c52 100644 --- a/source4/lib/charset/config.mk +++ b/source4/lib/charset/config.mk @@ -5,9 +5,11 @@ OBJ_FILES = \ iconv.o \ charcnv.o \ util_unistr.o -PUBLIC_HEADERS = charset.h -PUBLIC_PROTO_HEADER = charset_proto.h +PRIVATE_PROTO_HEADER = charset_proto.h PUBLIC_DEPENDENCIES = ICONV PRIVATE_DEPENDENCIES = DYNCONFIG # End SUBSYSTEM CHARSET ################################################ + + +PUBLIC_HEADERS += lib/charset/charset.h diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index a1f876d56a..87014d4d53 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -4,10 +4,11 @@ OBJ_FILES = credentials.o PUBLIC_DEPENDENCIES = CREDENTIALS LIBPOPT [SUBSYSTEM::POPT_SAMBA] -PUBLIC_HEADERS = popt_common.h OBJ_FILES = popt_common.o PUBLIC_DEPENDENCIES = LIBPOPT +PUBLIC_HEADERS += lib/cmdline/popt_common.h + [SUBSYSTEM::POPT_CREDENTIALS] PRIVATE_PROTO_HEADER = popt_credentials.h OBJ_FILES = popt_credentials.o diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index 910cf3738f..225a23c634 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -32,11 +32,12 @@ INIT_FUNCTION = s4_events_standard_init # Start SUBSYSTEM LIBEVENTS [SUBSYSTEM::LIBEVENTS] OBJ_FILES = events.o events_timed.o events_signal.o -PUBLIC_HEADERS = events.h events_internal.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL # End SUBSYSTEM LIBEVENTS ############################## +PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) + [PYTHON::swig_events] SWIG_FILE = events.i PRIVATE_DEPENDENCIES = LIBEVENTS diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index e7f138b2a8..81fd1e9b95 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -147,11 +147,12 @@ PUBLIC_DEPENDENCIES = \ LIBTALLOC PRIVATE_DEPENDENCIES = \ SOCKET_WRAPPER -PUBLIC_HEADERS = include/ldb.h include/ldb_errors.h # # End SUBSYSTEM ldb ################################################ +PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h + MANPAGES += $(ldbdir)/man/ldb.3 ################################################ diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk index b46f7c3ee7..81b0ef36fd 100644 --- a/source4/lib/nss_wrapper/config.mk +++ b/source4/lib/nss_wrapper/config.mk @@ -1,7 +1,8 @@ ############################## # Start SUBSYSTEM NSS_WRAPPER [SUBSYSTEM::NSS_WRAPPER] -PUBLIC_HEADERS = nss_wrapper.h OBJ_FILES = nss_wrapper.o # End SUBSYSTEM NSS_WRAPPER ############################## + +PUBLIC_HEADERS += lib/nss_wrapper/nss_wrapper.h diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index af5b1bc301..b2d7ce202e 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -36,10 +36,11 @@ OBJ_FILES = \ PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL CHARSET TDR_REGF LIBLDB \ RPC_NDR_WINREG LDB_WRAP -PUBLIC_HEADERS = registry.h hive.h patchfile.h # End MODULE registry_ldb ################################################ +PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h patchfile.h) + [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry OBJ_FILES = tools/common.o diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk index 4c5cf94348..cc52a99801 100644 --- a/source4/lib/socket_wrapper/config.mk +++ b/source4/lib/socket_wrapper/config.mk @@ -1,8 +1,9 @@ ############################## # Start SUBSYSTEM SOCKET_WRAPPER [SUBSYSTEM::SOCKET_WRAPPER] -PUBLIC_HEADERS = socket_wrapper.h OBJ_FILES = socket_wrapper.o PRIVATE_DEPENDENCIES = EXT_SOCKET # End SUBSYSTEM SOCKET_WRAPPER ############################## + +PUBLIC_HEADERS += lib/socket_wrapper/socket_wrapper.h diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk index abbad2e613..33241ffac7 100644 --- a/source4/lib/talloc/config.mk +++ b/source4/lib/talloc/config.mk @@ -2,7 +2,7 @@ OUTPUT_TYPE = STATIC_LIBRARY OBJ_FILES = talloc.o CFLAGS = -Ilib/talloc -PUBLIC_HEADERS = talloc.h MANPAGES += $(tallocdir)/talloc.3 +PUBLIC_HEADERS += $(tallocdir)/talloc.h diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk index 89d6af9043..c69804fa13 100644 --- a/source4/lib/tdb/config.mk +++ b/source4/lib/tdb/config.mk @@ -7,11 +7,12 @@ OBJ_FILES = \ common/open.o common/traverse.o common/freelist.o \ common/error.o common/transaction.o CFLAGS = -Ilib/tdb/include -PUBLIC_HEADERS = include/tdb.h # # End SUBSYSTEM ldb ################################################ +PUBLIC_HEADERS += $(tdbdir)/include/tdb.h + ################################################ # Start BINARY tdbtool [BINARY::tdbtool] diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index b8473e5ba8..eb3cde9bdf 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -1,6 +1,7 @@ [SUBSYSTEM::TDR] CFLAGS = -Ilib/tdr -PUBLIC_HEADERS = tdr.h -PUBLIC_PROTO_HEADER = tdr_proto.h +PRIVATE_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL OBJ_FILES = tdr.o + +PUBLIC_HEADERS += lib/tdr/tdr.h diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index f3e6cd7acf..e0573400a5 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -1,15 +1,6 @@ [SUBSYSTEM::LIBSAMBA-UTIL] #VERSION = 0.0.1 #SO_VERSION = 0 -PUBLIC_HEADERS = util.h \ - attr.h \ - byteorder.h \ - data_blob.h \ - debug.h \ - mutex.h \ - safe_string.h \ - time.h \ - xfile.h OBJ_FILES = xfile.o \ debug.o \ fault.o \ @@ -33,11 +24,22 @@ PUBLIC_DEPENDENCIES = \ SOCKET_WRAPPER EXT_NSL \ CHARSET EXECINFO +PUBLIC_HEADERS += $(addprefix lib/util/, util.h \ + attr.h \ + byteorder.h \ + data_blob.h \ + debug.h \ + mutex.h \ + safe_string.h \ + time.h \ + xfile.h) + [SUBSYSTEM::ASN1_UTIL] -PUBLIC_PROTO_HEADER = asn1_proto.h -PUBLIC_HEADERS = asn1.h +PRIVATE_PROTO_HEADER = asn1_proto.h OBJ_FILES = asn1.o +PUBLIC_HEADERS += lib/util/asn1.h + [SUBSYSTEM::UNIX_PRIVS] PRIVATE_PROTO_HEADER = unix_privs.h OBJ_FILES = unix_privs.o -- cgit From 489f66cd422453c00afd14121fb61a41a6785249 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 29 Feb 2008 14:36:51 +0100 Subject: Change remaining prototype headers to be private. (This used to be commit 2f7ff409e89c9682e681ddcf54439db9e3b6ccb4) --- source4/lib/util/config.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index e0573400a5..16a0357df8 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -47,7 +47,7 @@ OBJ_FILES = unix_privs.o ################################################ # Start SUBSYSTEM WRAP_XATTR [SUBSYSTEM::WRAP_XATTR] -PUBLIC_PROTO_HEADER = wrap_xattr.h +PRIVATE_PROTO_HEADER = wrap_xattr.h OBJ_FILES = \ wrap_xattr.o PUBLIC_DEPENDENCIES = XATTR @@ -56,13 +56,13 @@ PUBLIC_DEPENDENCIES = XATTR ################################################ [SUBSYSTEM::UTIL_TDB] -PUBLIC_PROTO_HEADER = util_tdb.h +PRIVATE_PROTO_HEADER = util_tdb.h OBJ_FILES = \ util_tdb.o PUBLIC_DEPENDENCIES = LIBTDB [SUBSYSTEM::UTIL_LDB] -PUBLIC_PROTO_HEADER = util_ldb.h +PRIVATE_PROTO_HEADER = util_ldb.h OBJ_FILES = \ util_ldb.o PUBLIC_DEPENDENCIES = LIBLDB -- cgit From 748f1c09629b251176a36f24c871b045192206ed Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Mar 2008 13:01:02 +0100 Subject: Fix error handling in ldb.add(). (This used to be commit a7f89b5bb28601597a4a0f75ec2b97bac02370d9) --- source4/lib/ldb/ldb.i | 84 +++++++++++------------- source4/lib/ldb/ldb_wrap.c | 158 +++++++++++++-------------------------------- 2 files changed, 81 insertions(+), 161 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 336100c4f0..2c04662f25 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -547,6 +547,43 @@ PyObject *PyExc_LdbError; talloc_free($1); }; +%typemap(in,numinputs=1) ldb_msg *add_msg { + ldb_error ret; + int dict_pos, msg_pos; + PyObject *key, *value; + ldb_msg_element *msgel; + + if (PyDict_Check($input)) { + $1 = ldb_msg_new(NULL); + $1->elements = talloc_zero_array($1, struct ldb_message_element, PyDict_Size($input)); + msg_pos = dict_pos = 0; + while (PyDict_Next($input, &dict_pos, &key, &value)) { + if (!strcmp(PyString_AsString(key), "dn")) { + if (ldb_dn_from_pyobject($1, value, $self, &$1->dn) != 0) { + SWIG_exception(SWIG_TypeError, "unable to import dn object"); + } + } else { + msgel = ldb_msg_element_from_pyobject($1->elements, value, 0, PyString_AsString(key)); + if (msgel == NULL) { + SWIG_exception(SWIG_TypeError, "unable to import element"); + } + memcpy(&$1->elements[msg_pos], msgel, sizeof(*msgel)); + msg_pos++; + } + } + + if ($1->dn == NULL) { + SWIG_exception(SWIG_TypeError, "no dn set"); + } + + $1->num_elements = msg_pos; + } else { + if (SWIG_ConvertPtr($input, (void **)&$1, SWIGTYPE_p_ldb_message, 0) != 0) { + SWIG_exception(SWIG_TypeError, "unable to convert ldb message"); + } + } +} + /* Top-level ldb operations */ typedef struct ldb_context { %extend { @@ -604,53 +641,6 @@ typedef struct ldb_context { struct ldb_control **parse_control_strings(TALLOC_CTX *mem_ctx, const char * const*control_strings); ldb_error add(ldb_msg *add_msg); - ldb_error add(PyObject *py_msg) - { - ldb_error ret; - int dict_pos, msg_pos; - PyObject *key, *value; - ldb_msg_element *msgel; - ldb_msg *msg = NULL; - - if (PyDict_Check(py_msg)) { - msg = ldb_msg_new(NULL); - msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_msg)); - msg_pos = dict_pos = 0; - while (PyDict_Next(py_msg, &dict_pos, &key, &value)) { - if (!strcmp(PyString_AsString(key), "dn")) { - if (ldb_dn_from_pyobject(msg, value, $self, &msg->dn) != 0) { - return LDB_ERR_OTHER; - } - } else { - msgel = ldb_msg_element_from_pyobject(msg->elements, value, 0, PyString_AsString(key)); - if (msgel == NULL) { - SWIG_exception(SWIG_TypeError, "unable to import element"); - return LDB_ERR_OTHER; - } - memcpy(&msg->elements[msg_pos], msgel, sizeof(*msgel)); - msg_pos++; - } - } - - if (msg->dn == NULL) { - SWIG_exception(SWIG_TypeError, "no dn set"); - return LDB_ERR_OTHER; - } - - msg->num_elements = msg_pos; - } else { - if (SWIG_ConvertPtr(py_msg, (void **)&msg, SWIGTYPE_p_ldb_message, 0) != 0) - return LDB_ERR_OTHER; - } - - ret = ldb_add($self, msg); - - talloc_free(msg); - return ret; - - fail: - return LDB_ERR_OTHER; - } ldb_error modify(ldb_msg *message); ldb_dn *get_config_basedn(); ldb_dn *get_root_basedn(); diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index 51022e5930..937cb7e47c 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -3113,52 +3113,6 @@ SWIGINTERN ldb_error ldb_search_ex(ldb *self,TALLOC_CTX *mem_ctx,ldb_dn *base,en *OUT = res; return ret; } -SWIGINTERN ldb_error ldb_add__SWIG_1(ldb *self,PyObject *py_msg){ - ldb_error ret; - int dict_pos, msg_pos; - PyObject *key, *value; - ldb_msg_element *msgel; - ldb_msg *msg = NULL; - - if (PyDict_Check(py_msg)) { - msg = ldb_msg_new(NULL); - msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_msg)); - msg_pos = dict_pos = 0; - while (PyDict_Next(py_msg, &dict_pos, &key, &value)) { - if (!strcmp(PyString_AsString(key), "dn")) { - if (ldb_dn_from_pyobject(msg, value, self, &msg->dn) != 0) { - return 80; - } - } else { - msgel = ldb_msg_element_from_pyobject(msg->elements, value, 0, PyString_AsString(key)); - if (msgel == NULL) { - SWIG_exception(SWIG_TypeError, "unable to import element"); - return 80; - } - memcpy(&msg->elements[msg_pos], msgel, sizeof(*msgel)); - msg_pos++; - } - } - - if (msg->dn == NULL) { - SWIG_exception(SWIG_TypeError, "no dn set"); - return 80; - } - - msg->num_elements = msg_pos; - } else { - if (SWIG_ConvertPtr(py_msg, (void **)&msg, SWIGTYPE_p_ldb_message, 0) != 0) - return 80; - } - - ret = ldb_add(self, msg); - - talloc_free(msg); - return ret; - - fail: - return 80; - } SWIGINTERN PyObject *ldb_schema_format_value(ldb *self,char const *element_name,PyObject *val){ const struct ldb_schema_attribute *a; struct ldb_val old_val; @@ -4733,27 +4687,61 @@ fail: } -SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_0(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { +SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; ldb_msg *arg2 = (ldb_msg *) 0 ; ldb_error result; void *argp1 = 0 ; int res1 = 0 ; - void *argp2 = 0 ; - int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + char * kwnames[] = { + (char *) "self",(char *) "add_msg", NULL + }; - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Ldb_add",kwnames,&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_add" "', argument " "1"" of type '" "ldb *""'"); } arg1 = (ldb *)(argp1); - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_ldb_message, 0 | 0 ); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Ldb_add" "', argument " "2"" of type '" "ldb_msg *""'"); + { + ldb_error ret; + int dict_pos, msg_pos; + PyObject *key, *value; + ldb_msg_element *msgel; + + if (PyDict_Check(obj1)) { + arg2 = ldb_msg_new(NULL); + arg2->elements = talloc_zero_array(arg2, struct ldb_message_element, PyDict_Size(obj1)); + msg_pos = dict_pos = 0; + while (PyDict_Next(obj1, &dict_pos, &key, &value)) { + if (!strcmp(PyString_AsString(key), "dn")) { + if (ldb_dn_from_pyobject(arg2, value, obj0, &arg2->dn) != 0) { + SWIG_exception(SWIG_TypeError, "unable to import dn object"); + } + } else { + msgel = ldb_msg_element_from_pyobject(arg2->elements, value, 0, PyString_AsString(key)); + if (msgel == NULL) { + SWIG_exception(SWIG_TypeError, "unable to import element"); + } + memcpy(&arg2->elements[msg_pos], msgel, sizeof(*msgel)); + msg_pos++; + } + } + + if (arg2->dn == NULL) { + SWIG_exception(SWIG_TypeError, "no dn set"); + } + + arg2->num_elements = msg_pos; + } else { + if (SWIG_ConvertPtr(obj1, (void **)&arg2, SWIGTYPE_p_ldb_message, 0) != 0) { + SWIG_exception(SWIG_TypeError, "unable to convert ldb message"); + } + } } - arg2 = (ldb_msg *)(argp2); if (arg1 == NULL) SWIG_exception(SWIG_ValueError, "ldb context must be non-NULL"); @@ -4772,64 +4760,6 @@ fail: } -SWIGINTERN PyObject *_wrap_Ldb_add__SWIG_1(PyObject *SWIGUNUSEDPARM(self), int nobjs, PyObject **swig_obj) { - PyObject *resultobj = 0; - ldb *arg1 = (ldb *) 0 ; - PyObject *arg2 = (PyObject *) 0 ; - ldb_error result; - void *argp1 = 0 ; - int res1 = 0 ; - - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ldb_context, 0 | 0 ); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Ldb_add" "', argument " "1"" of type '" "ldb *""'"); - } - arg1 = (ldb *)(argp1); - arg2 = swig_obj[1]; - if (arg1 == NULL) - SWIG_exception(SWIG_ValueError, - "ldb context must be non-NULL"); - result = ldb_add__SWIG_1(arg1,arg2); - if (result != 0) { - PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", result, ldb_strerror(result))); - SWIG_fail; - } - resultobj = Py_None; - return resultobj; -fail: - return NULL; -} - - -SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *self, PyObject *args) { - int argc; - PyObject *argv[3]; - - if (!(argc = SWIG_Python_UnpackTuple(args,"Ldb_add",0,2,argv))) SWIG_fail; - --argc; - if (argc == 2) { - int _v = 0; - { - void *vptr = 0; - int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_ldb_message, 0); - _v = SWIG_CheckState(res); - } - if (!_v) goto check_1; - return _wrap_Ldb_add__SWIG_0(self, argc, argv); - } -check_1: - - if (argc == 2) { - return _wrap_Ldb_add__SWIG_1(self, argc, argv); - } - -fail: - SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Ldb_add'.\n Possible C/C++ prototypes are:\n"" add(ldb *,ldb_msg *)\n"" add(ldb *,PyObject *)\n"); - return NULL; -} - - SWIGINTERN PyObject *_wrap_Ldb_modify(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; ldb *arg1 = (ldb *) 0 ; @@ -5729,7 +5659,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Ldb_delete", (PyCFunction) _wrap_Ldb_delete, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_rename", (PyCFunction) _wrap_Ldb_rename, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_parse_control_strings", (PyCFunction) _wrap_Ldb_parse_control_strings, METH_VARARGS | METH_KEYWORDS, NULL}, - { (char *)"Ldb_add", _wrap_Ldb_add, METH_VARARGS, NULL}, + { (char *)"Ldb_add", (PyCFunction) _wrap_Ldb_add, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_modify", (PyCFunction) _wrap_Ldb_modify, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Ldb_get_config_basedn", (PyCFunction)_wrap_Ldb_get_config_basedn, METH_O, NULL}, { (char *)"Ldb_get_root_basedn", (PyCFunction)_wrap_Ldb_get_root_basedn, METH_O, NULL}, -- cgit From 830051b494ea52475e9349e6908ff8576a990051 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Mar 2008 21:18:12 +0100 Subject: Remove unused variable, fix (80, 'Other error') exceptions from ldb python bindings (This used to be commit 2303063cbd2e65580618124ef8ecf42867d2b952) --- source4/lib/ldb/ldb.i | 4 ++-- source4/lib/ldb/ldb_wrap.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index 2c04662f25..da4c52f778 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -548,7 +548,6 @@ PyObject *PyExc_LdbError; }; %typemap(in,numinputs=1) ldb_msg *add_msg { - ldb_error ret; int dict_pos, msg_pos; PyObject *key, *value; ldb_msg_element *msgel; @@ -559,7 +558,8 @@ PyObject *PyExc_LdbError; msg_pos = dict_pos = 0; while (PyDict_Next($input, &dict_pos, &key, &value)) { if (!strcmp(PyString_AsString(key), "dn")) { - if (ldb_dn_from_pyobject($1, value, $self, &$1->dn) != 0) { + /* using argp0 (magic SWIG value) here is a hack */ + if (ldb_dn_from_pyobject($1, value, argp1, &$1->dn) != 0) { SWIG_exception(SWIG_TypeError, "unable to import dn object"); } } else { diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c index 937cb7e47c..7886778b3a 100644 --- a/source4/lib/ldb/ldb_wrap.c +++ b/source4/lib/ldb/ldb_wrap.c @@ -4707,7 +4707,6 @@ SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *arg } arg1 = (ldb *)(argp1); { - ldb_error ret; int dict_pos, msg_pos; PyObject *key, *value; ldb_msg_element *msgel; @@ -4718,7 +4717,8 @@ SWIGINTERN PyObject *_wrap_Ldb_add(PyObject *SWIGUNUSEDPARM(self), PyObject *arg msg_pos = dict_pos = 0; while (PyDict_Next(obj1, &dict_pos, &key, &value)) { if (!strcmp(PyString_AsString(key), "dn")) { - if (ldb_dn_from_pyobject(arg2, value, obj0, &arg2->dn) != 0) { + /* using argp0 (magic SWIG value) here is a hack */ + if (ldb_dn_from_pyobject(arg2, value, argp1, &arg2->dn) != 0) { SWIG_exception(SWIG_TypeError, "unable to import dn object"); } } else { -- cgit From 85d53f7b603f7c15b007f8c3fdde1989f07a6eb2 Mon Sep 17 00:00:00 2001 From: Brad Hards Date: Sun, 2 Mar 2008 10:46:47 +0100 Subject: Some cleanups for the ldb doxygen docs. (This used to be commit 5972308add8b1078e190beab204c1ba4b3a25747) --- source4/lib/ldb/include/ldb.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 2e54920c17..2e13a774b9 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -290,7 +290,7 @@ char *ldb_filter_from_tree(TALLOC_CTX *mem_ctx, struct ldb_parse_tree *tree); 2254 (Section 4). This function also escapes any non-printable characters. - \param ctx the memory context to allocate the return string in. + \param mem_ctx the memory context to allocate the return string in. \param val the (potentially) binary data to be encoded \return the encoded data as a null terminated string @@ -886,7 +886,7 @@ int ldb_search_default_callback(struct ldb_context *ldb, void *context, struct l \param attrs the search attributes for the query (pass NULL if none required) \param controls an array of controls \param context the callback function context - \param the callback function to handle the async replies + \param callback the callback function to handle the async replies \return result code (LDB_SUCCESS on success, or a failure code) */ @@ -911,7 +911,7 @@ int ldb_build_search_req(struct ldb_request **ret_req, \param message contains the entry to be added \param controls an array of controls \param context the callback function context - \param the callback function to handle the async replies + \param callback the callback function to handle the async replies \return result code (LDB_SUCCESS on success, or a failure code) */ @@ -933,7 +933,7 @@ int ldb_build_add_req(struct ldb_request **ret_req, \param message contains the entry to be modified \param controls an array of controls \param context the callback function context - \param the callback function to handle the async replies + \param callback the callback function to handle the async replies \return result code (LDB_SUCCESS on success, or a failure code) */ @@ -955,7 +955,7 @@ int ldb_build_mod_req(struct ldb_request **ret_req, \param dn the DN to be deleted \param controls an array of controls \param context the callback function context - \param the callback function to handle the async replies + \param callback the callback function to handle the async replies \return result code (LDB_SUCCESS on success, or a failure code) */ @@ -978,7 +978,7 @@ int ldb_build_del_req(struct ldb_request **ret_req, \param newdn the new DN \param controls an array of controls \param context the callback function context - \param the callback function to handle the async replies + \param callback the callback function to handle the async replies \return result code (LDB_SUCCESS on success, or a failure code) */ @@ -997,7 +997,7 @@ int ldb_build_rename_req(struct ldb_request **ret_req, \param req the request struct where to add the control \param oid the object identifier of the control as string - \param ciritical whether the control should be critical or not + \param critical whether the control should be critical or not \param data a talloc pointer to the control specific data \return result code (LDB_SUCCESS on success, or a failure code) @@ -1137,7 +1137,7 @@ int ldb_extended_default_callback(struct ldb_context *ldb, void *context, struct it needs to be NULL or a valid talloc pointer! talloc_get_type() will be used on it \param controls an array of controls \param context the callback function context - \param the callback function to handle the async replies + \param callback the callback function to handle the async replies \return result code (LDB_SUCCESS on success, or a failure code) */ @@ -1226,6 +1226,7 @@ int ldb_valid_attr_name(const char *s); /* ldif manipulation functions */ + /** Write an LDIF message @@ -1418,8 +1419,8 @@ bool ldb_dn_is_null(struct ldb_dn *dn); This function compares to attribute names. Note that this is a case-insensitive comparison. - \param attr1 the first attribute name to compare - \param attr2 the second attribute name to compare + \param a the first attribute name to compare + \param b the second attribute name to compare \return 0 if the attribute names are the same, or only differ in case; non-zero if there are any differences @@ -1562,6 +1563,7 @@ int ldb_msg_check_string_attribute(const struct ldb_message *msg, This function performs basic sanity / integrity checks on an ldb_message. + \param ldb context in which to perform the checks \param msg the message to check \return LDB_SUCCESS if the message is OK, or a non-zero error code -- cgit