From 1120a596c3876b9094ce5d843ab0c2af233cb120 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Wed, 26 Dec 2012 21:36:50 -0800 Subject: [PATCH 01/28] pyldb: decrement ref counters on py_results and quiet warnings Signed-off-by: Matthieu Patou Reviewed-by: Jelmer Vernooij Autobuild-User(master): Matthieu Patou Autobuild-Date(master): Tue Aug 6 00:32:46 CEST 2013 on sn-devel-104 (cherry picked from commit 0602009b999142187d74b74be13de8c7f64c7b24) --- lib/ldb/pyldb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 8c9d6b9..ec6c7d0 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -3088,6 +3088,8 @@ static int py_module_request(struct ldb_module *mod, struct ldb_request *req) py_result = PyObject_CallMethod(py_ldb, discard_const_p(char, "request"), discard_const_p(char, "")); + Py_XDECREF(py_result); + return LDB_ERR_OPERATIONS_ERROR; } @@ -3099,6 +3101,8 @@ static int py_module_extended(struct ldb_module *mod, struct ldb_request *req) py_result = PyObject_CallMethod(py_ldb, discard_const_p(char, "extended"), discard_const_p(char, "")); + Py_XDECREF(py_result); + return LDB_ERR_OPERATIONS_ERROR; } -- 1.9.1 From d048a02ecff57416a0ebc61d81a82f2fe0309620 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 16 Aug 2013 12:56:04 +0000 Subject: [PATCH 02/28] ldb: Fix a const warning Signed-off-by: Volker Lendecke Reviewed-by: Simo Sorce Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Sun Aug 18 10:26:27 CEST 2013 on sn-devel-104 (cherry picked from commit 06273504586733ac548ddadad6c7bc757d2d5e25) --- lib/ldb/ldb_map/ldb_map.c | 4 ++-- lib/ldb/ldb_map/ldb_map_private.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ldb/ldb_map/ldb_map.c b/lib/ldb/ldb_map/ldb_map.c index d35e5c6..d95f050 100644 --- a/lib/ldb/ldb_map/ldb_map.c +++ b/lib/ldb/ldb_map/ldb_map.c @@ -869,9 +869,9 @@ static int map_objectclass_convert_operator(struct ldb_module *module, void *mem * ============================== */ /* Build a request to search a record by its DN. */ -struct ldb_request *map_search_base_req(struct map_context *ac, struct ldb_dn *dn, const char * const *attrs, const struct ldb_parse_tree *tree, void *context, ldb_map_callback_t callback) +struct ldb_request *map_search_base_req(struct map_context *ac, struct ldb_dn *dn, const char * const *attrs, struct ldb_parse_tree *tree, void *context, ldb_map_callback_t callback) { - const struct ldb_parse_tree *search_tree; + struct ldb_parse_tree *search_tree; struct ldb_context *ldb; struct ldb_request *req; int ret; diff --git a/lib/ldb/ldb_map/ldb_map_private.h b/lib/ldb/ldb_map/ldb_map_private.h index 7faaa99..6e4a9dd 100644 --- a/lib/ldb/ldb_map/ldb_map_private.h +++ b/lib/ldb/ldb_map/ldb_map_private.h @@ -75,7 +75,7 @@ struct ldb_dn *ldb_dn_map_rebase_remote(struct ldb_module *module, void *mem_ctx struct ldb_request *map_search_base_req(struct map_context *ac, struct ldb_dn *dn, const char * const *attrs, - const struct ldb_parse_tree *tree, + struct ldb_parse_tree *tree, void *context, ldb_map_callback_t callback); struct ldb_request *map_build_fixup_req(struct map_context *ac, -- 1.9.1 From 34572fa19a5bf29c376b1cd33297e9b7be3023c2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 18 Aug 2013 19:49:24 +0000 Subject: [PATCH 03/28] ldb: Fix CID 1034793 Dereference null return value Add a proper NULL check Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett (cherry picked from commit 15bd82550dab7a4709e92d639ee563dbc4780366) --- lib/ldb/tools/ldbtest.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ldb/tools/ldbtest.c b/lib/ldb/tools/ldbtest.c index 4e181af..384624c 100644 --- a/lib/ldb/tools/ldbtest.c +++ b/lib/ldb/tools/ldbtest.c @@ -324,6 +324,10 @@ static void start_test_index(struct ldb_context **ldb) ldb_delete(*ldb, indexlist); msg = ldb_msg_new(NULL); + if (msg == NULL) { + printf("ldb_msg_new failed\n"); + exit(LDB_ERR_OPERATIONS_ERROR); + } msg->dn = indexlist; ldb_msg_add_string(msg, "@IDXATTR", strdup("uid")); -- 1.9.1 From db6b96718daf38ab6806c018c41871e233c12ab8 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 18 Aug 2013 19:51:49 +0000 Subject: [PATCH 04/28] pyldb: Fix CID 1034792 Dereference null return value Add a NULL check Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett (cherry picked from commit cbb5c1ce39640ffd01aeed6d87a57940e344792c) --- lib/ldb/pyldb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index ec6c7d0..4583132 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -1075,6 +1075,10 @@ static struct ldb_message *PyDict_AsMessage(TALLOC_CTX *mem_ctx, PyObject *dn_value = PyDict_GetItemString(py_obj, "dn"); msg = ldb_msg_new(mem_ctx); + if (msg == NULL) { + PyErr_NoMemory(); + return NULL; + } msg->elements = talloc_zero_array(msg, struct ldb_message_element, PyDict_Size(py_obj)); if (dn_value) { -- 1.9.1 From 547ad0a70e981f33f0af5ad9787ff9cde9262912 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 18 Aug 2013 19:54:31 +0000 Subject: [PATCH 05/28] ldb_map: Fix CID 1034791 Dereference null return value Add NULL checks Signed-off-by: Volker Lendecke Reviewed-by: Andrew Bartlett (cherry picked from commit cb598ddab6935820975042a8a307c75dba9d7e31) --- lib/ldb/ldb_map/ldb_map.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ldb/ldb_map/ldb_map.c b/lib/ldb/ldb_map/ldb_map.c index d95f050..ce2d660 100644 --- a/lib/ldb/ldb_map/ldb_map.c +++ b/lib/ldb/ldb_map/ldb_map.c @@ -223,12 +223,18 @@ int ldb_next_remote_request(struct ldb_module *module, struct ldb_request *reque case LDB_ADD: msg = ldb_msg_copy_shallow(request, request->op.add.message); + if (msg == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } msg->dn = ldb_dn_rebase_remote(msg, data, msg->dn); request->op.add.message = msg; break; case LDB_MODIFY: msg = ldb_msg_copy_shallow(request, request->op.mod.message); + if (msg == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } msg->dn = ldb_dn_rebase_remote(msg, data, msg->dn); request->op.mod.message = msg; break; -- 1.9.1 From 34ddfae3708aedb5cc831215eb9418da2bbb35a2 Mon Sep 17 00:00:00 2001 From: Jeroen Dekkers Date: Mon, 9 Sep 2013 00:42:39 +0200 Subject: [PATCH 06/28] ldb: Do not build libldb-cmdline when using system ldb. Cleanup leftover include and linking of libldb-cmdline in oLschema2ldif. Do not build libldb-cmdline anymore when using the system ldb, oLschema2ldif was the only reason for building libldb-cmdline. Signed-off-by: Jeroen Dekkers Reviewed-by: Andreas Schneider Reviewed-by: Stefan Metzmacher Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Tue Sep 10 12:52:26 CEST 2013 on sn-devel-104 (cherry picked from commit 0af09f0179c024099e0776d3794f4b3d7fb3f6f6) --- lib/ldb/wscript | 8 ++++---- source4/utils/oLschema2ldif.c | 1 - source4/utils/wscript_build | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/ldb/wscript b/lib/ldb/wscript index f5647b1..071038c 100755 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript @@ -257,10 +257,10 @@ def build(bld): bld.SAMBA_BINARY('ldbdump', 'tools/ldbdump.c', deps='ldb-cmdline ldb', install=False) - bld.SAMBA_LIBRARY('ldb-cmdline', - source='tools/ldbutil.c tools/cmdline.c', - deps='ldb dl popt', - private_library=True) + bld.SAMBA_LIBRARY('ldb-cmdline', + source='tools/ldbutil.c tools/cmdline.c', + deps='ldb dl popt', + private_library=True) def test(ctx): diff --git a/source4/utils/oLschema2ldif.c b/source4/utils/oLschema2ldif.c index be86daa..bcdf570 100644 --- a/source4/utils/oLschema2ldif.c +++ b/source4/utils/oLschema2ldif.c @@ -33,7 +33,6 @@ #include "includes.h" #include "ldb.h" -#include "tools/cmdline.h" #include "dsdb/samdb/samdb.h" #include "../lib/crypto/sha256.h" #include "../librpc/gen_ndr/ndr_misc.h" diff --git a/source4/utils/wscript_build b/source4/utils/wscript_build index a5217b3..046e237 100644 --- a/source4/utils/wscript_build +++ b/source4/utils/wscript_build @@ -14,6 +14,6 @@ bld.SAMBA_BINARY('ntlm_auth4', bld.SAMBA_BINARY('oLschema2ldif', source='oLschema2ldif.c', manpages='man/oLschema2ldif.1', - deps='ldb-cmdline samdb POPT_SAMBA' + deps='samdb POPT_SAMBA' ) -- 1.9.1 From e3bfdf5bde30b183ee95147ac12150e21227d276 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 6 Sep 2013 15:37:30 +1200 Subject: [PATCH 07/28] ldb: Show the type of failing operation in default error message Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher (cherry picked from commit 347b2c65a4b8c219cfdae3306fdc3d793980cbed) --- lib/ldb/common/ldb_modules.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c index 4403656..a39b12d 100644 --- a/lib/ldb/common/ldb_modules.c +++ b/lib/ldb/common/ldb_modules.c @@ -554,8 +554,33 @@ int ldb_next_request(struct ldb_module *module, struct ldb_request *request) return ret; } if (!ldb_errstring(module->ldb)) { + const char *op; + switch (request->operation) { + case LDB_SEARCH: + op = "LDB_SEARCH"; + break; + case LDB_ADD: + op = "LDB_ADD"; + break; + case LDB_MODIFY: + op = "LDB_MODIFY"; + break; + case LDB_DELETE: + op = "LDB_DELETE"; + break; + case LDB_RENAME: + op = "LDB_RENAME"; + break; + case LDB_EXTENDED: + op = "LDB_EXTENDED"; + break; + default: + op = "request"; + break; + } + /* Set a default error string, to place the blame somewhere */ - ldb_asprintf_errstring(module->ldb, "error in module %s: %s (%d)", module->ops->name, ldb_strerror(ret), ret); + ldb_asprintf_errstring(module->ldb, "error in module %s: %s during %s (%d)", module->ops->name, ldb_strerror(ret), op, ret); } if (!(request->handle->flags & LDB_HANDLE_FLAG_DONE_CALLED)) { -- 1.9.1 From fa8103ee1afaf2e6189b2a707405593cdbbeb989 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 16 Sep 2013 19:02:26 -0700 Subject: [PATCH 08/28] Cleanup map return codes -1 was never a valid LDB return code, just use OPERATIONS_ERROR Signed-off-by: Howard Chu Reviewed-by: Andrew Bartlett Autobuild-User(master): Nadezhda Ivanova Autobuild-Date(master): Tue Sep 17 07:51:45 CEST 2013 on sn-devel-104 (cherry picked from commit 6ed5b1c159867466e54a54a10adcc6c49a0a7837) --- lib/ldb/ldb_map/ldb_map_outbound.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/ldb/ldb_map/ldb_map_outbound.c b/lib/ldb/ldb_map/ldb_map_outbound.c index 2c517a6..c6c86e3 100644 --- a/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/lib/ldb/ldb_map/ldb_map_outbound.c @@ -195,7 +195,7 @@ static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_ele /* no local result, add as new element */ if (old == NULL) { if (ldb_msg_add_empty(msg, el->name, 0, &old) != 0) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } talloc_free(discard_const_p(char, old->name)); } @@ -205,10 +205,10 @@ static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_ele /* and make sure we reference the contents */ if (!talloc_reference(msg->elements, el->name)) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } if (!talloc_reference(msg->elements, el->values)) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } return 0; @@ -480,7 +480,7 @@ static int map_reply_remote(struct map_context *ac, struct ldb_reply *ares) msg = ldb_msg_new(ares); if (msg == NULL) { map_oom(ac->module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } /* Merge remote message into new message */ @@ -494,7 +494,7 @@ static int map_reply_remote(struct map_context *ac, struct ldb_reply *ares) dn = ldb_dn_map_rebase_remote(ac->module, msg, ares->message->dn); if (dn == NULL) { talloc_free(msg); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } msg->dn = dn; @@ -581,7 +581,7 @@ static int map_subtree_select_local_not(struct ldb_module *module, void *mem_ctx *new = talloc_memdup(mem_ctx, tree, sizeof(struct ldb_parse_tree)); if (*new == NULL) { map_oom(module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } /* Generate new subtree */ @@ -613,7 +613,7 @@ static int map_subtree_select_local_list(struct ldb_module *module, void *mem_ct *new = talloc_memdup(mem_ctx, tree, sizeof(struct ldb_parse_tree)); if (*new == NULL) { map_oom(module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } /* Prepare list of subtrees */ @@ -622,7 +622,7 @@ static int map_subtree_select_local_list(struct ldb_module *module, void *mem_ct if ((*new)->u.list.elements == NULL) { map_oom(module); talloc_free(*new); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } /* Generate new list of subtrees */ @@ -662,7 +662,7 @@ static int map_subtree_select_local_simple(struct ldb_module *module, void *mem_ *new = talloc_memdup(mem_ctx, tree, sizeof(struct ldb_parse_tree)); if (*new == NULL) { map_oom(module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } return 0; @@ -705,7 +705,7 @@ static int map_subtree_collect_remote_not(struct ldb_module *module, void *mem_c *new = talloc_memdup(mem_ctx, tree, sizeof(struct ldb_parse_tree)); if (*new == NULL) { map_oom(module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } /* Generate new subtree */ @@ -737,7 +737,7 @@ static int map_subtree_collect_remote_list(struct ldb_module *module, void *mem_ *new = talloc_memdup(mem_ctx, tree, sizeof(struct ldb_parse_tree)); if (*new == NULL) { map_oom(module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } /* Prepare list of subtrees */ @@ -746,7 +746,7 @@ static int map_subtree_collect_remote_list(struct ldb_module *module, void *mem_ if ((*new)->u.list.elements == NULL) { map_oom(module); talloc_free(*new); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } /* Generate new list of subtrees */ @@ -788,7 +788,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, *new = talloc(mem_ctx, struct ldb_parse_tree); if (*new == NULL) { map_oom(module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } **new = *tree; @@ -825,7 +825,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, break; default: /* unknown kind of simple subtree */ talloc_free(*new); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } if (attr == NULL) { @@ -880,7 +880,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, break; default: /* unknown kind of simple subtree */ talloc_free(*new); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } return 0; @@ -1031,7 +1031,7 @@ done: oom: map_oom(module); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } @@ -1264,8 +1264,7 @@ static int map_remote_search_callback(struct ldb_request *req, if (ret != LDB_SUCCESS) { talloc_free(ares); - return ldb_module_done(ac->req, NULL, NULL, - LDB_ERR_OPERATIONS_ERROR); + return ldb_module_done(ac->req, NULL, NULL, ret); } break; -- 1.9.1 From b0449f830ced19337aa2bd2bdf33af60ac4f7f37 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 17 Sep 2013 22:14:20 -0700 Subject: [PATCH 09/28] Fix SEGV from improperly formed SUBSTRING/PRESENCE filter Signed-off-by: Howard Chu Reviewed-by: Simo Sorce Reviewed-by: Volker Lendecke Reviewed-by: Michael Adam Autobuild-User(master): Michael Adam Autobuild-Date(master): Thu Sep 19 01:42:43 CEST 2013 on sn-devel-104 (cherry picked from commit d9bf88dc749cdbc34f70345b156b0117ecf2932b) --- lib/ldb/ldb_map/ldb_map_outbound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ldb/ldb_map/ldb_map_outbound.c b/lib/ldb/ldb_map/ldb_map_outbound.c index c6c86e3..5be5e76 100644 --- a/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/lib/ldb/ldb_map/ldb_map_outbound.c @@ -848,7 +848,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, int i; /* Map value */ (*new)->u.substring.chunks = NULL; - for (i=0; tree->u.substring.chunks[i]; i++) { + for (i=0; tree->u.substring.chunks && tree->u.substring.chunks[i]; i++) { (*new)->u.substring.chunks = talloc_realloc(*new, (*new)->u.substring.chunks, struct ldb_val *, i+2); if (!(*new)->u.substring.chunks) { talloc_free(*new); -- 1.9.1 From 2c91c57bc5fcd150a6de18d9b64b33bf5abdad08 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 18 Sep 2013 16:50:34 -0700 Subject: [PATCH 10/28] Add LDB_MAP_RENDROP option Like LDB_MAP_RENAME, but drop the attribute if it occurs in an Add request. Used for distinguishedName attribute, is read-only and generated but for some bizarre reason AD allows it in an Add request. Signed-off-by: Howard Chu Reviewed-by: Andrew Bartlett Reviewed-by: Nadezhda Ivanova (cherry picked from commit 93f3aba5e083976a791b982b2064b619800ce110) --- lib/ldb/ldb_map/ldb_map.c | 4 ++++ lib/ldb/ldb_map/ldb_map.h | 3 ++- lib/ldb/ldb_map/ldb_map_inbound.c | 17 ++++++++++++----- lib/ldb/ldb_map/ldb_map_outbound.c | 7 +++++-- source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 2 +- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/ldb/ldb_map/ldb_map.c b/lib/ldb/ldb_map/ldb_map.c index ce2d660..52b483b 100644 --- a/lib/ldb/ldb_map/ldb_map.c +++ b/lib/ldb/ldb_map/ldb_map.c @@ -332,6 +332,7 @@ const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_contex break; case LDB_MAP_RENAME: + case LDB_MAP_RENDROP: case LDB_MAP_CONVERT: if (ldb_attr_cmp(map->u.rename.remote_name, name) == 0) { return map; @@ -383,6 +384,7 @@ const char *map_attr_map_local(void *mem_ctx, const struct ldb_map_attribute *ma return talloc_strdup(mem_ctx, attr); case LDB_MAP_RENAME: + case LDB_MAP_RENDROP: case LDB_MAP_CONVERT: return talloc_strdup(mem_ctx, map->u.rename.remote_name); @@ -524,6 +526,7 @@ struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, struct /* fall through */ case LDB_MAP_KEEP: case LDB_MAP_RENAME: + case LDB_MAP_RENDROP: name = map_attr_map_local(newdn, map, ldb_dn_get_component_name(dn, i)); if (name == NULL) goto failed; @@ -599,6 +602,7 @@ struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, struc /* fall through */ case LDB_MAP_KEEP: case LDB_MAP_RENAME: + case LDB_MAP_RENDROP: name = map_attr_map_remote(newdn, map, ldb_dn_get_component_name(dn, i)); if (name == NULL) goto failed; diff --git a/lib/ldb/ldb_map/ldb_map.h b/lib/ldb/ldb_map/ldb_map.h index 5db3e02..46ef3cc 100644 --- a/lib/ldb/ldb_map/ldb_map.h +++ b/lib/ldb/ldb_map/ldb_map.h @@ -63,9 +63,10 @@ struct ldb_map_attribute { LDB_MAP_KEEP, /* Keep as is. Same name locally and remotely. */ LDB_MAP_RENAME, /* Simply rename the attribute. Name changes, data is the same */ LDB_MAP_CONVERT, /* Rename + convert data */ - LDB_MAP_GENERATE /* Use generate function for generating new name/data. + LDB_MAP_GENERATE, /* Use generate function for generating new name/data. Used for generating attributes based on multiple remote attributes. */ + LDB_MAP_RENDROP /* Rename the attribute. Strip from Add requests. */ } type; /* if set, will be called for search expressions that contain this attribute */ diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c b/lib/ldb/ldb_map/ldb_map_inbound.c index 38dd5ac..06d52aa 100644 --- a/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/lib/ldb/ldb_map/ldb_map_inbound.c @@ -65,7 +65,7 @@ static struct ldb_message_element *ldb_msg_el_map_local(struct ldb_module *modul /* Add a message element either to a local or to a remote message, * depending on whether it goes into the local or remote partition. */ -static int ldb_msg_el_partition(struct ldb_module *module, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg, const char *attr_name, /* const char * const names[], */ const struct ldb_message_element *old) +static int ldb_msg_el_partition(struct ldb_module *module, enum ldb_request_type optype, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg, const char *attr_name, /* const char * const names[], */ const struct ldb_message_element *old) { const struct ldb_map_context *data = map_get_context(module); const struct ldb_map_attribute *map = map_attr_find_local(data, attr_name); @@ -81,6 +81,13 @@ static int ldb_msg_el_partition(struct ldb_module *module, struct ldb_message *l } switch (map->type) { + case LDB_MAP_RENDROP: + if (optype != LDB_ADD) { + /* do the same as LDB_MAP_RENAME */ + el = ldb_msg_el_map_local(module, remote, map, old); + break; + } + /* fall through */ case LDB_MAP_IGNORE: goto local; @@ -157,7 +164,7 @@ static bool ldb_msg_check_remote(struct ldb_module *module, const struct ldb_mes /* Split message elements that stay in the local partition from those * that are mapped into the remote partition. */ -static int ldb_msg_partition(struct ldb_module *module, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg) +static int ldb_msg_partition(struct ldb_module *module, enum ldb_request_type optype, struct ldb_message *local, struct ldb_message *remote, const struct ldb_message *msg) { /* const char * const names[]; */ struct ldb_context *ldb; @@ -175,7 +182,7 @@ static int ldb_msg_partition(struct ldb_module *module, struct ldb_message *loca continue; } - ret = ldb_msg_el_partition(module, local, remote, msg, msg->elements[i].name, &msg->elements[i]); + ret = ldb_msg_el_partition(module, optype, local, remote, msg, msg->elements[i].name, &msg->elements[i]); if (ret) { return ret; } @@ -408,7 +415,7 @@ int ldb_map_add(struct ldb_module *module, struct ldb_request *req) remote_msg->dn = ldb_dn_map_local(ac->module, remote_msg, msg->dn); /* Split local from remote message */ - ldb_msg_partition(module, ac->local_msg, remote_msg, msg); + ldb_msg_partition(module, req->operation, ac->local_msg, remote_msg, msg); /* Prepare the remote operation */ ret = ldb_build_add_req(&ac->remote_req, ldb, @@ -518,7 +525,7 @@ int ldb_map_modify(struct ldb_module *module, struct ldb_request *req) remote_msg->dn = ldb_dn_map_local(ac->module, remote_msg, msg->dn); /* Split local from remote message */ - ldb_msg_partition(module, ac->local_msg, remote_msg, msg); + ldb_msg_partition(module, req->operation, ac->local_msg, remote_msg, msg); /* Prepare the remote operation */ ret = ldb_build_mod_req(&ac->remote_req, ldb, diff --git a/lib/ldb/ldb_map/ldb_map_outbound.c b/lib/ldb/ldb_map/ldb_map_outbound.c index 5be5e76..b6357bd 100644 --- a/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/lib/ldb/ldb_map/ldb_map_outbound.c @@ -134,6 +134,7 @@ static const char **map_attrs_collect_remote(struct ldb_module *module, void *me goto named; case LDB_MAP_RENAME: + case LDB_MAP_RENDROP: case LDB_MAP_CONVERT: name = map->u.rename.remote_name; goto named; @@ -241,7 +242,7 @@ static struct ldb_message_element *ldb_msg_el_map_remote(struct ldb_module *modu for (i = 0; data->attribute_maps[i].local_name; i++) { struct ldb_map_attribute *am = &data->attribute_maps[i]; - if ((am->type == LDB_MAP_RENAME && + if (((am->type == LDB_MAP_RENAME || am->type == LDB_MAP_RENDROP) && !strcmp(am->u.rename.remote_name, attr_name)) || (am->type == LDB_MAP_CONVERT && !strcmp(am->u.convert.remote_name, attr_name))) { @@ -306,6 +307,7 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local remote_name = attr_name; break; case LDB_MAP_RENAME: + case LDB_MAP_RENDROP: remote_name = map->u.rename.remote_name; break; case LDB_MAP_GENERATE: @@ -327,6 +329,7 @@ static int ldb_msg_el_merge(struct ldb_module *module, struct ldb_message *local /* fall through */ case LDB_MAP_KEEP: case LDB_MAP_RENAME: + case LDB_MAP_RENDROP: old = ldb_msg_find_element(remote, remote_name); if (old) { el = ldb_msg_el_map_remote(module, local, map, attr_name, old); @@ -834,7 +837,7 @@ int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, return 0; } - if (map->type == LDB_MAP_RENAME) { + if (map->type == LDB_MAP_RENAME || map->type == LDB_MAP_RENDROP) { /* Nothing more to do here, the attribute has been renamed */ return 0; } diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 451c7a1..87e3c65 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -362,7 +362,7 @@ static const struct ldb_map_attribute entryuuid_attributes[] = }, { .local_name = "distinguishedName", - .type = LDB_MAP_RENAME, + .type = LDB_MAP_RENDROP, .u = { .rename = { .remote_name = "entryDN" -- 1.9.1 From 3c757288e8d54fa949bfb00474cb3ecfc8593ee3 Mon Sep 17 00:00:00 2001 From: Nadezhda Ivanova Date: Wed, 18 Sep 2013 15:31:24 -0700 Subject: [PATCH 11/28] s4-openldap: Remove use of talloc_reference in ldb_map_outbound.c Instead of referencing the values array of the element to the new element, copy them, to avoid use of talloc_reference and remove a warning of talloc_steal with reference. The issue is only relevant when openldap backend is used. Signed-off-by: Nadezhda Ivanova Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison (cherry picked from commit 75705776929d87f1a694582261c07d1724574370) --- lib/ldb/ldb_map/ldb_map_outbound.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/ldb/ldb_map/ldb_map_outbound.c b/lib/ldb/ldb_map/ldb_map_outbound.c index b6357bd..1ee2dfe 100644 --- a/lib/ldb/ldb_map/ldb_map_outbound.c +++ b/lib/ldb/ldb_map/ldb_map_outbound.c @@ -190,7 +190,7 @@ static int map_attrs_partition(struct ldb_module *module, void *mem_ctx, const c static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_element *el) { struct ldb_message_element *old; - + int j; old = ldb_msg_find_element(msg, el->name); /* no local result, add as new element */ @@ -198,18 +198,22 @@ static int ldb_msg_replace(struct ldb_message *msg, const struct ldb_message_ele if (ldb_msg_add_empty(msg, el->name, 0, &old) != 0) { return LDB_ERR_OPERATIONS_ERROR; } - talloc_free(discard_const_p(char, old->name)); + } + else { + talloc_free(old->values); } - /* copy new element */ - *old = *el; - - /* and make sure we reference the contents */ - if (!talloc_reference(msg->elements, el->name)) { + old->values = talloc_array(msg->elements, struct ldb_val, el->num_values); + old->num_values = el->num_values; + if (old->values == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - if (!talloc_reference(msg->elements, el->values)) { - return LDB_ERR_OPERATIONS_ERROR; + /* copy the values into the element */ + for (j=0;jnum_values;j++) { + old->values[j] = ldb_val_dup(old->values, &el->values[j]); + if (old->values[j].data == NULL && el->values[j].length != 0) { + return LDB_ERR_OPERATIONS_ERROR; + } } return 0; -- 1.9.1 From 72cb9e5ac12c287cdebe54f847b806a9293b67f5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 23 Sep 2013 03:39:58 +0200 Subject: [PATCH 12/28] dsdb/tests/ldap: fix test_distinguished_name against w2k8r2 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett (cherry picked from commit da7ef12b43f355fa6ff92af98645c80c85699d78) --- source4/dsdb/tests/python/ldap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/dsdb/tests/python/ldap.py b/source4/dsdb/tests/python/ldap.py index f44f4ea..63c422a7 100755 --- a/source4/dsdb/tests/python/ldap.py +++ b/source4/dsdb/tests/python/ldap.py @@ -952,7 +952,7 @@ class BasicTests(samba.tests.TestCase): ldb.modify(m) self.fail() except LdbError, (num, _): - self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + self.assertEquals(num, ERR_UNWILLING_TO_PERFORM) m = Message() m.dn = Dn(ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) @@ -976,7 +976,7 @@ class BasicTests(samba.tests.TestCase): ldb.modify(m) self.fail() except LdbError, (num, _): - self.assertEquals(num, ERR_CONSTRAINT_VIOLATION) + self.assertEquals(num, ERR_UNWILLING_TO_PERFORM) delete_force(self.ldb, "cn=ldaptestgroup,cn=users," + self.base_dn) -- 1.9.1 From 191415b664c063403912318a7ec82208c7977070 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Sep 2013 01:30:23 +0200 Subject: [PATCH 13/28] ldb:rdn_name: reject 'distinguishedName' depending of the MOD flags This is what Windows 2008 R2 returns: LDB_MOD_ADD => LDB_ERR_UNWILLING_TO_PERFORM LDB_MOD_REPLACE => LDB_ERR_CONSTRAINT_VIOLATION LDB_MOD_DEL => LDB_ERR_UNWILLING_TO_PERFORM Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett (cherry picked from commit d2ff474766ebb104309bf1e801c54ce0f8ea0a64) --- lib/ldb/modules/rdn_name.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ldb/modules/rdn_name.c b/lib/ldb/modules/rdn_name.c index 50b63ae..f44ea71 100644 --- a/lib/ldb/modules/rdn_name.c +++ b/lib/ldb/modules/rdn_name.c @@ -371,6 +371,7 @@ static int rdn_name_modify(struct ldb_module *module, struct ldb_request *req) { struct ldb_context *ldb; const struct ldb_val *rdn_val_p; + struct ldb_message_element *e = NULL; ldb = ldb_module_get_ctx(module); @@ -389,10 +390,15 @@ static int rdn_name_modify(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_INVALID_DN_SYNTAX; } - if (ldb_msg_find_element(req->op.mod.message, "distinguishedName")) { + e = ldb_msg_find_element(req->op.mod.message, "distinguishedName"); + if (e != NULL) { ldb_asprintf_errstring(ldb, "Modify of 'distinguishedName' on %s not permitted, must use 'rename' operation instead", ldb_dn_get_linearized(req->op.mod.message->dn)); - return LDB_ERR_CONSTRAINT_VIOLATION; + if (e->flags == LDB_FLAG_MOD_REPLACE) { + return LDB_ERR_CONSTRAINT_VIOLATION; + } else { + return LDB_ERR_UNWILLING_TO_PERFORM; + } } if (ldb_msg_find_element(req->op.mod.message, "name")) { -- 1.9.1 From 66f7797d2ba49952a5b485d5dcffa81404bf4dda Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Oct 2013 17:29:29 +0200 Subject: [PATCH 14/28] ldb: Fix CID 240798 Uninitialized pointer read Not called right now, because nobody tries multiple sort attributes. But if someone did, build_response would have looked at the uninitialized controls. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Tue Oct 22 03:28:20 CEST 2013 on sn-devel-104 (cherry picked from commit 4e06c61b41fdde21fafaeee3c4fb3366744de9d9) --- lib/ldb/modules/sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ldb/modules/sort.c b/lib/ldb/modules/sort.c index c6fce2d..1b762f7 100644 --- a/lib/ldb/modules/sort.c +++ b/lib/ldb/modules/sort.c @@ -252,7 +252,6 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req struct ldb_control *control; struct ldb_server_sort_control **sort_ctrls; struct ldb_control **saved_controls; - struct ldb_control **controls; struct ldb_request *down_req; struct sort_context *ac; struct ldb_context *ldb; @@ -286,6 +285,7 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req if (sort_ctrls[1] != NULL) { if (control->critical) { + struct ldb_control **controls = NULL; /* callback immediately */ ret = build_response(req, &controls, -- 1.9.1 From 578c88242b560bd42a050c3c9126ec8c2f04ae9b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 9 Nov 2013 21:29:24 +0100 Subject: [PATCH 15/28] ldb: Fix CID 241329 Array compared against 0 u.generate.remote_names is an array, not a pointer Signed-off-by: Volker Lendecke Reviewed-by: Ira Cooper (cherry picked from commit d2731ad5aae9f1fb8c1c6a65a61ef787e993b248) --- lib/ldb/ldb_map/ldb_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ldb/ldb_map/ldb_map.c b/lib/ldb/ldb_map/ldb_map.c index 52b483b..66b0059 100644 --- a/lib/ldb/ldb_map/ldb_map.c +++ b/lib/ldb/ldb_map/ldb_map.c @@ -340,7 +340,7 @@ const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_contex break; case LDB_MAP_GENERATE: - for (j = 0; map->u.generate.remote_names && map->u.generate.remote_names[j]; j++) { + for (j = 0; map->u.generate.remote_names[j]; j++) { if (ldb_attr_cmp(map->u.generate.remote_names[j], name) == 0) { return map; } -- 1.9.1 From 210324ee9b116049190d11276f345bb877cf28f3 Mon Sep 17 00:00:00 2001 From: Pavel Reichl Date: Tue, 3 Dec 2013 14:37:20 +0000 Subject: [PATCH 16/28] ldb: use of NULL pointer bugfix Autobuild-User(master): Simo Sorce Autobuild-Date(master): Tue Dec 3 21:13:53 CET 2013 on sn-devel-104 (cherry picked from commit 4b637c367fdda832e95208f49e8893b0a0cac4b4) --- lib/ldb/common/ldb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c index 3dc6d87..d2b873f 100644 --- a/lib/ldb/common/ldb.c +++ b/lib/ldb/common/ldb.c @@ -572,8 +572,8 @@ int ldb_wait(struct ldb_handle *handle, enum ldb_wait_type type) struct tevent_context *ev; int ret; - if (!handle) { - return ldb_error(handle->ldb, LDB_ERR_UNAVAILABLE, NULL); + if (handle == NULL) { + return LDB_ERR_UNAVAILABLE; } if (handle->state == LDB_ASYNC_DONE) { -- 1.9.1 From a1f02fda6f81c01df276d8f0a3e6782b46d6ecf1 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Tue, 10 Dec 2013 17:45:58 +0100 Subject: [PATCH 17/28] lib/ldb fix compiler warnings about potentially uninitialized variables Signed-off-by: Christian Ambach Reviewed-by: Jeremy Allison (cherry picked from commit 9784ed9fb75022fcd7eaef24108ed8c6acf7f86f) --- lib/ldb/common/ldb_dn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c index 14596f6..6b6f90c 100644 --- a/lib/ldb/common/ldb_dn.c +++ b/lib/ldb/common/ldb_dn.c @@ -287,7 +287,7 @@ char *ldb_dn_escape_value(TALLOC_CTX *mem_ctx, struct ldb_val value) */ static bool ldb_dn_explode(struct ldb_dn *dn) { - char *p, *ex_name, *ex_value, *data, *d, *dt, *t; + char *p, *ex_name = NULL, *ex_value = NULL, *data, *d, *dt, *t; bool trim = true; bool in_extended = true; bool in_ex_name = false; @@ -298,7 +298,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn) bool is_oid = false; bool escape = false; unsigned int x; - size_t l; + size_t l = 0; int ret; char *parse_dn; bool is_index; -- 1.9.1 From f6950f1622a85e8ed042138952d6ca554407d7e1 Mon Sep 17 00:00:00 2001 From: Christian Ambach Date: Tue, 10 Dec 2013 17:46:30 +0100 Subject: [PATCH 18/28] lib/ldb fix compiler warnings about potentially uninitialized variables Signed-off-by: Christian Ambach Reviewed-by: Jeremy Allison (cherry picked from commit 35b4ba0193d783d85283b07f520f0af8dc2c1260) --- lib/ldb/ldb_map/ldb_map_inbound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c b/lib/ldb/ldb_map/ldb_map_inbound.c index 06d52aa..461e681 100644 --- a/lib/ldb/ldb_map/ldb_map_inbound.c +++ b/lib/ldb/ldb_map/ldb_map_inbound.c @@ -476,7 +476,7 @@ static int map_add_do_local(struct map_context *ac) int ldb_map_modify(struct ldb_module *module, struct ldb_request *req) { const struct ldb_message *msg = req->op.mod.message; - struct ldb_request *search_req; + struct ldb_request *search_req = NULL; struct ldb_message *remote_msg; struct ldb_context *ldb; struct map_context *ac; @@ -699,7 +699,7 @@ static int map_delete_do_local(struct map_context *ac) /* Rename a record. */ int ldb_map_rename(struct ldb_module *module, struct ldb_request *req) { - struct ldb_request *search_req; + struct ldb_request *search_req = NULL; struct ldb_context *ldb; struct map_context *ac; int ret; -- 1.9.1 From 88a63eb5ea19010c8957555397635243f4640b50 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 15 Dec 2013 21:23:59 +0100 Subject: [PATCH 19/28] ldb: Fix 1138330 Dereference null return value Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison (cherry picked from commit e8b0726411213acb133a25c14ab42020e4a8de68) --- lib/ldb/common/ldb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c index d2b873f..e5fa819 100644 --- a/lib/ldb/common/ldb.c +++ b/lib/ldb/common/ldb.c @@ -112,6 +112,10 @@ struct ldb_context *ldb_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx) * having to provide their own private one explicitly */ if (ev_ctx == NULL) { ev_ctx = tevent_context_init(ldb); + if (ev_ctx == NULL) { + talloc_free(ldb); + return NULL; + } tevent_set_debug(ev_ctx, ldb_tevent_debug, ldb); tevent_loop_allow_nesting(ev_ctx); } -- 1.9.1 From d5ea1b7709aeb1239d327f7470e3a65b341a2d7b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 5 Feb 2014 14:52:28 +1300 Subject: [PATCH 20/28] ldb: Return LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS rather than OPERATIONS_ERROR on EACCES and EPERM This makes provision errors clearer in Samba. Andrew Bartlett Reviewed-by: Garming Sam Signed-off-by: Andrew Bartlett Reviewed-by: Jelmer Vernooij (cherry picked from commit 673d41503c6e391337df1b86e49108d58f1af6bd) --- lib/ldb/ldb_tdb/ldb_tdb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c index 30c58f5..d3c83f5 100644 --- a/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/lib/ldb/ldb_tdb/ldb_tdb.c @@ -1560,10 +1560,13 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url, ldb_get_create_perms(ldb), ldb); if (!ltdb->tdb) { ldb_asprintf_errstring(ldb, - "Unable to open tdb '%s'", path); + "Unable to open tdb '%s': %s", path, strerror(errno)); ldb_debug(ldb, LDB_DEBUG_ERROR, - "Unable to open tdb '%s'", path); + "Unable to open tdb '%s': %s", path, strerror(errno)); talloc_free(ltdb); + if (errno == EACCES || errno == EPERM) { + return LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS; + } return LDB_ERR_OPERATIONS_ERROR; } -- 1.9.1 From 9d70eb192083e7f4882d891d88e344de5f0a6b08 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 5 Feb 2014 15:19:41 +1300 Subject: [PATCH 21/28] ldb: pass module init errors back to the caller This makes provision errors clearer in Samba, as we can now get permission denied errors presented from LDB modules. Andrew Bartlett Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam Reviewed-by: Jelmer Vernooij (cherry picked from commit e76bbef8b796441985550c553db1ab48d6495709) --- lib/ldb/common/ldb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c index e5fa819..36f1c37 100644 --- a/lib/ldb/common/ldb.c +++ b/lib/ldb/common/ldb.c @@ -257,11 +257,12 @@ int ldb_connect(struct ldb_context *ldb, const char *url, return ret; } - if (ldb_load_modules(ldb, options) != LDB_SUCCESS) { + ret = ldb_load_modules(ldb, options); + if (ret != LDB_SUCCESS) { ldb_debug(ldb, LDB_DEBUG_FATAL, "Unable to load modules for %s: %s", url, ldb_errstring(ldb)); - return LDB_ERR_OTHER; + return ret; } /* set the default base dn */ -- 1.9.1 From 4ce310438efec9fb767fab718352f47c45daab4b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 4 Mar 2014 13:50:41 +0100 Subject: [PATCH 22/28] ldb: Add a env variable to disable RTLD_DEEPBIND. We need a way to disable this in order to allow the ldb_*ldap modules to work with a preloaded socket wrapper. The only known user is the bind_dlz module, but symbol versioniong might be enough... So in future we may remove this completely or at least invert the default behavior. Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher (cherry picked from commit 11e87cdbb694cf542f3b7633326005abd49e43f1) --- lib/ldb/common/ldb_modules.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c index a39b12d..05a8d8a 100644 --- a/lib/ldb/common/ldb_modules.c +++ b/lib/ldb/common/ldb_modules.c @@ -901,6 +901,7 @@ static int ldb_modules_load_path(const char *path, const char *version) } *loaded; struct loaded *le; int dlopen_flags; + bool deepbind_enabled = (getenv("LDB_MODULES_DISABLE_DEEPBIND") == NULL); ret = stat(path, &st); if (ret != 0) { @@ -934,13 +935,25 @@ static int ldb_modules_load_path(const char *path, const char *version) dlopen_flags = RTLD_NOW; #ifdef RTLD_DEEPBIND - /* use deepbind if possible, to avoid issues with different - system library varients, for example ldb modules may be linked - against Heimdal while the application may use MIT kerberos - - See the dlopen manpage for details + /* + * use deepbind if possible, to avoid issues with different + * system library varients, for example ldb modules may be linked + * against Heimdal while the application may use MIT kerberos. + * + * See the dlopen manpage for details. + * + * One typical user is the bind_dlz module of Samba, + * but symbol versioniong might be enough... + * + * We need a way to disable this in order to allow the + * ldb_*ldap modules to work with a preloaded socket wrapper. + * + * So in future we may remove this completely + * or at least invert the default behavior. */ - dlopen_flags |= RTLD_DEEPBIND; + if (deepbind_enabled) { + dlopen_flags |= RTLD_DEEPBIND; + } #endif handle = dlopen(path, dlopen_flags); -- 1.9.1 From 28620fcc7145b8ff8b58d45f209be400459cefa9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 29 Apr 2014 09:32:45 +0200 Subject: [PATCH 23/28] ldb:pyldb: add some const to PyObject_FromLdbValue() PyString_FromStringAndSize() makes a copy of the value... Signed-off-by: Stefan Metzmacher Reviewed-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett (cherry picked from commit aae9da9803dd551364bc3c096e06601bb1c9ed50) --- lib/ldb/pyldb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 4583132..29e99b4 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -193,7 +193,7 @@ static void PyErr_SetLdbError(PyObject *error, int ret, struct ldb_context *ldb_ ldb_ctx == NULL?ldb_strerror(ret):ldb_errstring(ldb_ctx))); } -static PyObject *PyObject_FromLdbValue(struct ldb_val *val) +static PyObject *PyObject_FromLdbValue(const struct ldb_val *val) { return PyString_FromStringAndSize((const char *)val->data, val->length); } -- 1.9.1 From 8434fd4fc3a0db12579b63501a2b82030fedbee5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 29 Apr 2014 09:34:48 +0200 Subject: [PATCH 24/28] ldb:pyldb: fix doc string for set_extended_component() Signed-off-by: Stefan Metzmacher Reviewed-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett (cherry picked from commit 094c39107c0abf4951e6f7012ac06b08cae1ea04) --- lib/ldb/pyldb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 29e99b4..867fed4 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -601,7 +601,7 @@ static PyMethodDef py_ldb_dn_methods[] = { "S.get_extended_component(name) -> string\n\n" "returns a DN extended component as a binary string"}, { "set_extended_component", (PyCFunction)py_ldb_dn_set_extended_component, METH_VARARGS, - "S.set_extended_component(name, value) -> string\n\n" + "S.set_extended_component(name, value) -> None\n\n" "set a DN extended component as a binary string"}, { NULL } }; -- 1.9.1 From 115d2c0435140437f97fa85b921c8e27866236c1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 29 Apr 2014 09:35:31 +0200 Subject: [PATCH 25/28] ldb:pyldb: add some more helper functions for LdbDn This adds [g|s]et_component[|_name|_value]() and get_rdn_[name|value](). Signed-off-by: Stefan Metzmacher Reviewed-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett (cherry picked from commit 771d7b8c0df9240a9638dbf06a9f04431767bbb8) --- lib/ldb/pyldb.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 867fed4..a45317a 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -556,6 +556,103 @@ static PyObject *py_ldb_dn_is_child_of(PyLdbDnObject *self, PyObject *args) return PyBool_FromLong(ldb_dn_compare_base(base, dn) == 0); } +static PyObject *py_ldb_dn_get_component_name(PyLdbDnObject *self, PyObject *args) +{ + struct ldb_dn *dn; + const char *name; + unsigned int num = 0; + + if (!PyArg_ParseTuple(args, "I", &num)) + return NULL; + + dn = pyldb_Dn_AsDn((PyObject *)self); + + name = ldb_dn_get_component_name(dn, num); + if (name == NULL) { + Py_RETURN_NONE; + } + + return PyString_FromString(name); +} + +static PyObject *py_ldb_dn_get_component_value(PyLdbDnObject *self, PyObject *args) +{ + struct ldb_dn *dn; + const struct ldb_val *val; + unsigned int num = 0; + + if (!PyArg_ParseTuple(args, "I", &num)) + return NULL; + + dn = pyldb_Dn_AsDn((PyObject *)self); + + val = ldb_dn_get_component_val(dn, num); + if (val == NULL) { + Py_RETURN_NONE; + } + + return PyObject_FromLdbValue(val); +} + +static PyObject *py_ldb_dn_set_component(PyLdbDnObject *self, PyObject *args) +{ + unsigned int num = 0; + char *name = NULL; + PyObject *value = Py_None; + struct ldb_val val = { NULL, }; + int err; + + if (!PyArg_ParseTuple(args, "IsO", &num, &name, &value)) + return NULL; + + if (value != Py_None) { + if (!PyString_Check(value)) { + PyErr_SetString(PyExc_TypeError, "Expected a string argument"); + return NULL; + } + val.data = (uint8_t *)PyString_AsString(value); + val.length = PyString_Size(value); + } + + err = ldb_dn_set_component(self->dn, num, name, val); + if (err != LDB_SUCCESS) { + PyErr_SetString(PyExc_TypeError, "Failed to set component"); + return NULL; + } + + Py_RETURN_NONE; +} + +static PyObject *py_ldb_dn_get_rdn_name(PyLdbDnObject *self) +{ + struct ldb_dn *dn; + const char *name; + + dn = pyldb_Dn_AsDn((PyObject *)self); + + name = ldb_dn_get_rdn_name(dn); + if (name == NULL) { + Py_RETURN_NONE; + } + + return PyString_FromString(name); +} + +static PyObject *py_ldb_dn_get_rdn_value(PyLdbDnObject *self) +{ + struct ldb_dn *dn; + const struct ldb_val *val; + + dn = pyldb_Dn_AsDn((PyObject *)self); + + val = ldb_dn_get_rdn_val(dn); + if (val == NULL) { + Py_RETURN_NONE; + } + + return PyObject_FromLdbValue(val); +} + static PyMethodDef py_ldb_dn_methods[] = { { "validate", (PyCFunction)py_ldb_dn_validate, METH_NOARGS, "S.validate() -> bool\n" @@ -603,6 +700,21 @@ static PyMethodDef py_ldb_dn_methods[] = { { "set_extended_component", (PyCFunction)py_ldb_dn_set_extended_component, METH_VARARGS, "S.set_extended_component(name, value) -> None\n\n" "set a DN extended component as a binary string"}, + { "get_component_name", (PyCFunction)py_ldb_dn_get_component_name, METH_VARARGS, + "S.get_component_name(num) -> string\n" + "get the attribute name of the specified component" }, + { "get_component_value", (PyCFunction)py_ldb_dn_get_component_value, METH_VARARGS, + "S.get_component_value(num) -> string\n" + "get the attribute value of the specified component as a binary string" }, + { "set_component", (PyCFunction)py_ldb_dn_set_component, METH_VARARGS, + "S.get_component_value(num, name, value) -> None\n" + "set the attribute name and value of the specified component" }, + { "get_rdn_name", (PyCFunction)py_ldb_dn_get_rdn_name, METH_NOARGS, + "S.get_rdn_name() -> string\n" + "get the RDN attribute name" }, + { "get_rdn_value", (PyCFunction)py_ldb_dn_get_rdn_value, METH_NOARGS, + "S.get_rdn_value() -> string\n" + "get the RDN attribute value as a binary string" }, { NULL } }; -- 1.9.1 From 732d9bd09c2f07e712eade122b545a93a63fd7b2 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 29 Apr 2014 09:37:54 +0200 Subject: [PATCH 26/28] ldb: change version to 1.1.17 This adds some pyldb methods for ldb.Dn. Signed-off-by: Stefan Metzmacher Reviewed-by: Jelmer Vernooij Reviewed-by: Andrew Bartlett (cherry picked from commit 7f03a94ffa3752ccdb28cc50033b4e2a26e2b3f2) --- lib/ldb/ABI/ldb-1.1.17.sigs | 262 +++++++++++++++++++++++++++++++++++++ lib/ldb/ABI/pyldb-util-1.1.17.sigs | 2 + lib/ldb/wscript | 2 +- 3 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 lib/ldb/ABI/ldb-1.1.17.sigs create mode 100644 lib/ldb/ABI/pyldb-util-1.1.17.sigs diff --git a/lib/ldb/ABI/ldb-1.1.17.sigs b/lib/ldb/ABI/ldb-1.1.17.sigs new file mode 100644 index 0000000..eac5194 --- /dev/null +++ b/lib/ldb/ABI/ldb-1.1.17.sigs @@ -0,0 +1,262 @@ +ldb_add: int (struct ldb_context *, const struct ldb_message *) +ldb_any_comparison: int (struct ldb_context *, void *, ldb_attr_handler_t, const struct ldb_val *, const struct ldb_val *) +ldb_asprintf_errstring: void (struct ldb_context *, const char *, ...) +ldb_attr_casefold: char *(TALLOC_CTX *, const char *) +ldb_attr_dn: int (const char *) +ldb_attr_in_list: int (const char * const *, const char *) +ldb_attr_list_copy: const char **(TALLOC_CTX *, const char * const *) +ldb_attr_list_copy_add: const char **(TALLOC_CTX *, const char * const *, const char *) +ldb_base64_decode: int (char *) +ldb_base64_encode: char *(TALLOC_CTX *, const char *, int) +ldb_binary_decode: struct ldb_val (TALLOC_CTX *, const char *) +ldb_binary_encode: char *(TALLOC_CTX *, struct ldb_val) +ldb_binary_encode_string: char *(TALLOC_CTX *, const char *) +ldb_build_add_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_del_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_extended_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, const char *, void *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_mod_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_rename_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, struct ldb_dn *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_search_req: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, enum ldb_scope, const char *, const char * const *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_build_search_req_ex: int (struct ldb_request **, struct ldb_context *, TALLOC_CTX *, struct ldb_dn *, enum ldb_scope, struct ldb_parse_tree *, const char * const *, struct ldb_control **, void *, ldb_request_callback_t, struct ldb_request *) +ldb_casefold: char *(struct ldb_context *, TALLOC_CTX *, const char *, size_t) +ldb_casefold_default: char *(void *, TALLOC_CTX *, const char *, size_t) +ldb_check_critical_controls: int (struct ldb_control **) +ldb_comparison_binary: int (struct ldb_context *, void *, const struct ldb_val *, const struct ldb_val *) +ldb_comparison_fold: int (struct ldb_context *, void *, const struct ldb_val *, const struct ldb_val *) +ldb_connect: int (struct ldb_context *, const char *, unsigned int, const char **) +ldb_control_to_string: char *(TALLOC_CTX *, const struct ldb_control *) +ldb_controls_except_specified: struct ldb_control **(struct ldb_control **, TALLOC_CTX *, struct ldb_control *) +ldb_debug: void (struct ldb_context *, enum ldb_debug_level, const char *, ...) +ldb_debug_add: void (struct ldb_context *, const char *, ...) +ldb_debug_end: void (struct ldb_context *, enum ldb_debug_level) +ldb_debug_set: void (struct ldb_context *, enum ldb_debug_level, const char *, ...) +ldb_delete: int (struct ldb_context *, struct ldb_dn *) +ldb_dn_add_base: bool (struct ldb_dn *, struct ldb_dn *) +ldb_dn_add_base_fmt: bool (struct ldb_dn *, const char *, ...) +ldb_dn_add_child: bool (struct ldb_dn *, struct ldb_dn *) +ldb_dn_add_child_fmt: bool (struct ldb_dn *, const char *, ...) +ldb_dn_alloc_casefold: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_alloc_linearized: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_canonical_ex_string: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_canonical_string: char *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_check_local: bool (struct ldb_module *, struct ldb_dn *) +ldb_dn_check_special: bool (struct ldb_dn *, const char *) +ldb_dn_compare: int (struct ldb_dn *, struct ldb_dn *) +ldb_dn_compare_base: int (struct ldb_dn *, struct ldb_dn *) +ldb_dn_copy: struct ldb_dn *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_escape_value: char *(TALLOC_CTX *, struct ldb_val) +ldb_dn_extended_add_syntax: int (struct ldb_context *, unsigned int, const struct ldb_dn_extended_syntax *) +ldb_dn_extended_filter: void (struct ldb_dn *, const char * const *) +ldb_dn_extended_syntax_by_name: const struct ldb_dn_extended_syntax *(struct ldb_context *, const char *) +ldb_dn_from_ldb_val: struct ldb_dn *(TALLOC_CTX *, struct ldb_context *, const struct ldb_val *) +ldb_dn_get_casefold: const char *(struct ldb_dn *) +ldb_dn_get_comp_num: int (struct ldb_dn *) +ldb_dn_get_component_name: const char *(struct ldb_dn *, unsigned int) +ldb_dn_get_component_val: const struct ldb_val *(struct ldb_dn *, unsigned int) +ldb_dn_get_extended_comp_num: int (struct ldb_dn *) +ldb_dn_get_extended_component: const struct ldb_val *(struct ldb_dn *, const char *) +ldb_dn_get_extended_linearized: char *(TALLOC_CTX *, struct ldb_dn *, int) +ldb_dn_get_linearized: const char *(struct ldb_dn *) +ldb_dn_get_parent: struct ldb_dn *(TALLOC_CTX *, struct ldb_dn *) +ldb_dn_get_rdn_name: const char *(struct ldb_dn *) +ldb_dn_get_rdn_val: const struct ldb_val *(struct ldb_dn *) +ldb_dn_has_extended: bool (struct ldb_dn *) +ldb_dn_is_null: bool (struct ldb_dn *) +ldb_dn_is_special: bool (struct ldb_dn *) +ldb_dn_is_valid: bool (struct ldb_dn *) +ldb_dn_map_local: struct ldb_dn *(struct ldb_module *, void *, struct ldb_dn *) +ldb_dn_map_rebase_remote: struct ldb_dn *(struct ldb_module *, void *, struct ldb_dn *) +ldb_dn_map_remote: struct ldb_dn *(struct ldb_module *, void *, struct ldb_dn *) +ldb_dn_minimise: bool (struct ldb_dn *) +ldb_dn_new: struct ldb_dn *(TALLOC_CTX *, struct ldb_context *, const char *) +ldb_dn_new_fmt: struct ldb_dn *(TALLOC_CTX *, struct ldb_context *, const char *, ...) +ldb_dn_remove_base_components: bool (struct ldb_dn *, unsigned int) +ldb_dn_remove_child_components: bool (struct ldb_dn *, unsigned int) +ldb_dn_remove_extended_components: void (struct ldb_dn *) +ldb_dn_replace_components: bool (struct ldb_dn *, struct ldb_dn *) +ldb_dn_set_component: int (struct ldb_dn *, int, const char *, const struct ldb_val) +ldb_dn_set_extended_component: int (struct ldb_dn *, const char *, const struct ldb_val *) +ldb_dn_update_components: int (struct ldb_dn *, const struct ldb_dn *) +ldb_dn_validate: bool (struct ldb_dn *) +ldb_dump_results: void (struct ldb_context *, struct ldb_result *, FILE *) +ldb_error_at: int (struct ldb_context *, int, const char *, const char *, int) +ldb_errstring: const char *(struct ldb_context *) +ldb_extended: int (struct ldb_context *, const char *, void *, struct ldb_result **) +ldb_extended_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_filter_from_tree: char *(TALLOC_CTX *, const struct ldb_parse_tree *) +ldb_get_config_basedn: struct ldb_dn *(struct ldb_context *) +ldb_get_create_perms: unsigned int (struct ldb_context *) +ldb_get_default_basedn: struct ldb_dn *(struct ldb_context *) +ldb_get_event_context: struct tevent_context *(struct ldb_context *) +ldb_get_flags: unsigned int (struct ldb_context *) +ldb_get_opaque: void *(struct ldb_context *, const char *) +ldb_get_root_basedn: struct ldb_dn *(struct ldb_context *) +ldb_get_schema_basedn: struct ldb_dn *(struct ldb_context *) +ldb_global_init: int (void) +ldb_handle_new: struct ldb_handle *(TALLOC_CTX *, struct ldb_context *) +ldb_handler_copy: int (struct ldb_context *, void *, const struct ldb_val *, struct ldb_val *) +ldb_handler_fold: int (struct ldb_context *, void *, const struct ldb_val *, struct ldb_val *) +ldb_init: struct ldb_context *(TALLOC_CTX *, struct tevent_context *) +ldb_ldif_message_string: char *(struct ldb_context *, TALLOC_CTX *, enum ldb_changetype, const struct ldb_message *) +ldb_ldif_parse_modrdn: int (struct ldb_context *, const struct ldb_ldif *, TALLOC_CTX *, struct ldb_dn **, struct ldb_dn **, bool *, struct ldb_dn **, struct ldb_dn **) +ldb_ldif_read: struct ldb_ldif *(struct ldb_context *, int (*)(void *), void *) +ldb_ldif_read_file: struct ldb_ldif *(struct ldb_context *, FILE *) +ldb_ldif_read_file_state: struct ldb_ldif *(struct ldb_context *, struct ldif_read_file_state *) +ldb_ldif_read_free: void (struct ldb_context *, struct ldb_ldif *) +ldb_ldif_read_string: struct ldb_ldif *(struct ldb_context *, const char **) +ldb_ldif_write: int (struct ldb_context *, int (*)(void *, const char *, ...), void *, const struct ldb_ldif *) +ldb_ldif_write_file: int (struct ldb_context *, FILE *, const struct ldb_ldif *) +ldb_ldif_write_redacted_trace_string: char *(struct ldb_context *, TALLOC_CTX *, const struct ldb_ldif *) +ldb_ldif_write_string: char *(struct ldb_context *, TALLOC_CTX *, const struct ldb_ldif *) +ldb_load_modules: int (struct ldb_context *, const char **) +ldb_map_add: int (struct ldb_module *, struct ldb_request *) +ldb_map_delete: int (struct ldb_module *, struct ldb_request *) +ldb_map_init: int (struct ldb_module *, const struct ldb_map_attribute *, const struct ldb_map_objectclass *, const char * const *, const char *, const char *) +ldb_map_modify: int (struct ldb_module *, struct ldb_request *) +ldb_map_rename: int (struct ldb_module *, struct ldb_request *) +ldb_map_search: int (struct ldb_module *, struct ldb_request *) +ldb_match_msg: int (struct ldb_context *, const struct ldb_message *, const struct ldb_parse_tree *, struct ldb_dn *, enum ldb_scope) +ldb_match_msg_error: int (struct ldb_context *, const struct ldb_message *, const struct ldb_parse_tree *, struct ldb_dn *, enum ldb_scope, bool *) +ldb_match_msg_objectclass: int (const struct ldb_message *, const char *) +ldb_mod_register_control: int (struct ldb_module *, const char *) +ldb_modify: int (struct ldb_context *, const struct ldb_message *) +ldb_modify_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_module_call_chain: char *(struct ldb_request *, TALLOC_CTX *) +ldb_module_connect_backend: int (struct ldb_context *, const char *, const char **, struct ldb_module **) +ldb_module_done: int (struct ldb_request *, struct ldb_control **, struct ldb_extended *, int) +ldb_module_flags: uint32_t (struct ldb_context *) +ldb_module_get_ctx: struct ldb_context *(struct ldb_module *) +ldb_module_get_name: const char *(struct ldb_module *) +ldb_module_get_ops: const struct ldb_module_ops *(struct ldb_module *) +ldb_module_get_private: void *(struct ldb_module *) +ldb_module_init_chain: int (struct ldb_context *, struct ldb_module *) +ldb_module_load_list: int (struct ldb_context *, const char **, struct ldb_module *, struct ldb_module **) +ldb_module_new: struct ldb_module *(TALLOC_CTX *, struct ldb_context *, const char *, const struct ldb_module_ops *) +ldb_module_next: struct ldb_module *(struct ldb_module *) +ldb_module_popt_options: struct poptOption **(struct ldb_context *) +ldb_module_send_entry: int (struct ldb_request *, struct ldb_message *, struct ldb_control **) +ldb_module_send_referral: int (struct ldb_request *, char *) +ldb_module_set_next: void (struct ldb_module *, struct ldb_module *) +ldb_module_set_private: void (struct ldb_module *, void *) +ldb_modules_hook: int (struct ldb_context *, enum ldb_module_hook_type) +ldb_modules_list_from_string: const char **(struct ldb_context *, TALLOC_CTX *, const char *) +ldb_modules_load: int (const char *, const char *) +ldb_msg_add: int (struct ldb_message *, const struct ldb_message_element *, int) +ldb_msg_add_empty: int (struct ldb_message *, const char *, int, struct ldb_message_element **) +ldb_msg_add_fmt: int (struct ldb_message *, const char *, const char *, ...) +ldb_msg_add_linearized_dn: int (struct ldb_message *, const char *, struct ldb_dn *) +ldb_msg_add_steal_string: int (struct ldb_message *, const char *, char *) +ldb_msg_add_steal_value: int (struct ldb_message *, const char *, struct ldb_val *) +ldb_msg_add_string: int (struct ldb_message *, const char *, const char *) +ldb_msg_add_value: int (struct ldb_message *, const char *, const struct ldb_val *, struct ldb_message_element **) +ldb_msg_canonicalize: struct ldb_message *(struct ldb_context *, const struct ldb_message *) +ldb_msg_check_string_attribute: int (const struct ldb_message *, const char *, const char *) +ldb_msg_copy: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_copy_attr: int (struct ldb_message *, const char *, const char *) +ldb_msg_copy_shallow: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_diff: struct ldb_message *(struct ldb_context *, struct ldb_message *, struct ldb_message *) +ldb_msg_difference: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message *, struct ldb_message *, struct ldb_message **) +ldb_msg_element_compare: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_compare_name: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_equal_ordered: bool (const struct ldb_message_element *, const struct ldb_message_element *) +ldb_msg_find_attr_as_bool: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_dn: struct ldb_dn *(struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, const char *) +ldb_msg_find_attr_as_double: double (const struct ldb_message *, const char *, double) +ldb_msg_find_attr_as_int: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_int64: int64_t (const struct ldb_message *, const char *, int64_t) +ldb_msg_find_attr_as_string: const char *(const struct ldb_message *, const char *, const char *) +ldb_msg_find_attr_as_uint: unsigned int (const struct ldb_message *, const char *, unsigned int) +ldb_msg_find_attr_as_uint64: uint64_t (const struct ldb_message *, const char *, uint64_t) +ldb_msg_find_element: struct ldb_message_element *(const struct ldb_message *, const char *) +ldb_msg_find_ldb_val: const struct ldb_val *(const struct ldb_message *, const char *) +ldb_msg_find_val: struct ldb_val *(const struct ldb_message_element *, struct ldb_val *) +ldb_msg_new: struct ldb_message *(TALLOC_CTX *) +ldb_msg_normalize: int (struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, struct ldb_message **) +ldb_msg_remove_attr: void (struct ldb_message *, const char *) +ldb_msg_remove_element: void (struct ldb_message *, struct ldb_message_element *) +ldb_msg_rename_attr: int (struct ldb_message *, const char *, const char *) +ldb_msg_sanity_check: int (struct ldb_context *, const struct ldb_message *) +ldb_msg_sort_elements: void (struct ldb_message *) +ldb_next_del_trans: int (struct ldb_module *) +ldb_next_end_trans: int (struct ldb_module *) +ldb_next_init: int (struct ldb_module *) +ldb_next_prepare_commit: int (struct ldb_module *) +ldb_next_remote_request: int (struct ldb_module *, struct ldb_request *) +ldb_next_request: int (struct ldb_module *, struct ldb_request *) +ldb_next_start_trans: int (struct ldb_module *) +ldb_op_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_options_find: const char *(struct ldb_context *, const char **, const char *) +ldb_pack_data: int (struct ldb_context *, const struct ldb_message *, struct ldb_val *) +ldb_parse_control_from_string: struct ldb_control *(struct ldb_context *, TALLOC_CTX *, const char *) +ldb_parse_control_strings: struct ldb_control **(struct ldb_context *, TALLOC_CTX *, const char **) +ldb_parse_tree: struct ldb_parse_tree *(TALLOC_CTX *, const char *) +ldb_parse_tree_attr_replace: void (struct ldb_parse_tree *, const char *, const char *) +ldb_parse_tree_copy_shallow: struct ldb_parse_tree *(TALLOC_CTX *, const struct ldb_parse_tree *) +ldb_parse_tree_walk: int (struct ldb_parse_tree *, int (*)(struct ldb_parse_tree *, void *), void *) +ldb_qsort: void (void * const, size_t, size_t, void *, ldb_qsort_cmp_fn_t) +ldb_register_backend: int (const char *, ldb_connect_fn, bool) +ldb_register_hook: int (ldb_hook_fn) +ldb_register_module: int (const struct ldb_module_ops *) +ldb_rename: int (struct ldb_context *, struct ldb_dn *, struct ldb_dn *) +ldb_reply_add_control: int (struct ldb_reply *, const char *, bool, void *) +ldb_reply_get_control: struct ldb_control *(struct ldb_reply *, const char *) +ldb_req_get_custom_flags: uint32_t (struct ldb_request *) +ldb_req_is_untrusted: bool (struct ldb_request *) +ldb_req_location: const char *(struct ldb_request *) +ldb_req_mark_trusted: void (struct ldb_request *) +ldb_req_mark_untrusted: void (struct ldb_request *) +ldb_req_set_custom_flags: void (struct ldb_request *, uint32_t) +ldb_req_set_location: void (struct ldb_request *, const char *) +ldb_request: int (struct ldb_context *, struct ldb_request *) +ldb_request_add_control: int (struct ldb_request *, const char *, bool, void *) +ldb_request_done: int (struct ldb_request *, int) +ldb_request_get_control: struct ldb_control *(struct ldb_request *, const char *) +ldb_request_get_status: int (struct ldb_request *) +ldb_request_replace_control: int (struct ldb_request *, const char *, bool, void *) +ldb_request_set_state: void (struct ldb_request *, int) +ldb_reset_err_string: void (struct ldb_context *) +ldb_save_controls: int (struct ldb_control *, struct ldb_request *, struct ldb_control ***) +ldb_schema_attribute_add: int (struct ldb_context *, const char *, unsigned int, const char *) +ldb_schema_attribute_add_with_syntax: int (struct ldb_context *, const char *, unsigned int, const struct ldb_schema_syntax *) +ldb_schema_attribute_by_name: const struct ldb_schema_attribute *(struct ldb_context *, const char *) +ldb_schema_attribute_remove: void (struct ldb_context *, const char *) +ldb_schema_attribute_set_override_handler: void (struct ldb_context *, ldb_attribute_handler_override_fn_t, void *) +ldb_search: int (struct ldb_context *, TALLOC_CTX *, struct ldb_result **, struct ldb_dn *, enum ldb_scope, const char * const *, const char *, ...) +ldb_search_default_callback: int (struct ldb_request *, struct ldb_reply *) +ldb_sequence_number: int (struct ldb_context *, enum ldb_sequence_type, uint64_t *) +ldb_set_create_perms: void (struct ldb_context *, unsigned int) +ldb_set_debug: int (struct ldb_context *, void (*)(void *, enum ldb_debug_level, const char *, va_list), void *) +ldb_set_debug_stderr: int (struct ldb_context *) +ldb_set_default_dns: void (struct ldb_context *) +ldb_set_errstring: void (struct ldb_context *, const char *) +ldb_set_event_context: void (struct ldb_context *, struct tevent_context *) +ldb_set_flags: void (struct ldb_context *, unsigned int) +ldb_set_modules_dir: void (struct ldb_context *, const char *) +ldb_set_opaque: int (struct ldb_context *, const char *, void *) +ldb_set_timeout: int (struct ldb_context *, struct ldb_request *, int) +ldb_set_timeout_from_prev_req: int (struct ldb_context *, struct ldb_request *, struct ldb_request *) +ldb_set_utf8_default: void (struct ldb_context *) +ldb_set_utf8_fns: void (struct ldb_context *, void *, char *(*)(void *, void *, const char *, size_t)) +ldb_setup_wellknown_attributes: int (struct ldb_context *) +ldb_should_b64_encode: int (struct ldb_context *, const struct ldb_val *) +ldb_standard_syntax_by_name: const struct ldb_schema_syntax *(struct ldb_context *, const char *) +ldb_strerror: const char *(int) +ldb_string_to_time: time_t (const char *) +ldb_string_utc_to_time: time_t (const char *) +ldb_timestring: char *(TALLOC_CTX *, time_t) +ldb_timestring_utc: char *(TALLOC_CTX *, time_t) +ldb_transaction_cancel: int (struct ldb_context *) +ldb_transaction_cancel_noerr: int (struct ldb_context *) +ldb_transaction_commit: int (struct ldb_context *) +ldb_transaction_prepare_commit: int (struct ldb_context *) +ldb_transaction_start: int (struct ldb_context *) +ldb_unpack_data: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *) +ldb_val_dup: struct ldb_val (TALLOC_CTX *, const struct ldb_val *) +ldb_val_equal_exact: int (const struct ldb_val *, const struct ldb_val *) +ldb_val_map_local: struct ldb_val (struct ldb_module *, void *, const struct ldb_map_attribute *, const struct ldb_val *) +ldb_val_map_remote: struct ldb_val (struct ldb_module *, void *, const struct ldb_map_attribute *, const struct ldb_val *) +ldb_val_string_cmp: int (const struct ldb_val *, const char *) +ldb_val_to_time: int (const struct ldb_val *, time_t *) +ldb_valid_attr_name: int (const char *) +ldb_vdebug: void (struct ldb_context *, enum ldb_debug_level, const char *, va_list) +ldb_wait: int (struct ldb_handle *, enum ldb_wait_type) diff --git a/lib/ldb/ABI/pyldb-util-1.1.17.sigs b/lib/ldb/ABI/pyldb-util-1.1.17.sigs new file mode 100644 index 0000000..74d6719 --- /dev/null +++ b/lib/ldb/ABI/pyldb-util-1.1.17.sigs @@ -0,0 +1,2 @@ +pyldb_Dn_FromDn: PyObject *(struct ldb_dn *) +pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **) diff --git a/lib/ldb/wscript b/lib/ldb/wscript index 071038c..e88e95a 100755 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'ldb' -VERSION = '1.1.16' +VERSION = '1.1.17' blddir = 'bin' -- 1.9.1 From 79c95fc4f4dac11c62c330244b4db43938ae4c70 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Apr 2014 09:33:26 +1200 Subject: [PATCH 27/28] ldb: make the successful ldb_transaction_start() message clearer Change-Id: I00d0705484c3b53f55c4a8ec2953e92329b7408e Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Sat May 3 10:20:52 CEST 2014 on sn-devel-104 (cherry picked from commit d7c22d56d3f8be9b8293dd481fb450e3cf2343d3) --- lib/ldb/common/ldb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c index 36f1c37..c49513c 100644 --- a/lib/ldb/common/ldb.c +++ b/lib/ldb/common/ldb.c @@ -371,10 +371,14 @@ int ldb_transaction_start(struct ldb_context *ldb) ldb_strerror(status), status); } - } - if ((module && module->ldb->flags & LDB_FLG_ENABLE_TRACING)) { - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "start ldb transaction error: %s", - ldb_errstring(module->ldb)); + if ((module && module->ldb->flags & LDB_FLG_ENABLE_TRACING)) { + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "start ldb transaction error: %s", + ldb_errstring(module->ldb)); + } + } else { + if ((module && module->ldb->flags & LDB_FLG_ENABLE_TRACING)) { + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "start ldb transaction success"); + } } return status; } -- 1.9.1 From d26ddba0d04cefc2621921ce30b2f03be62bef16 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 20 Jun 2014 18:08:53 +0200 Subject: [PATCH 28/28] ldb:build: improve detection of srcdir Signed-off-by: Michael Adam Reviewed-by: Amitay Isaacs (cherry picked from commit 09b991b79b28c9a88742e06021bb15997aba8988) --- lib/ldb/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ldb/wscript b/lib/ldb/wscript index e88e95a..a375675 100755 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript @@ -10,7 +10,7 @@ import sys, os # find the buildtools directory srcdir = '.' while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5: - srcdir = '../' + srcdir + srcdir = srcdir + '/..' sys.path.insert(0, srcdir + '/buildtools/wafsamba') import wafsamba, samba_dist, Options -- 1.9.1