Projects
openEuler:Mainline
libldb
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 10
View file
_service:tar_scm:libldb.spec
Changed
@@ -1,36 +1,22 @@ %global with_lmdb 1 %global with_python3 1 -%global talloc_version 2.3.4 -%global tdb_version 1.4.7 -%global tevent_version 0.13.0 +%global talloc_version 2.4.0 +%global tdb_version 1.4.8 +%global tevent_version 0.14.1 Name: libldb -Version: 2.6.1 -Release: 2 +Version: 2.7.2 +Release: 1 Summary: A schema-less, ldap like, API and database Requires: libtalloc%{?_isa} >= %{talloc_version} Requires: libtdb%{?_isa} >= %{tdb_version} Requires: libtevent%{?_isa} >= %{tevent_version} -License: LGPLv3+ +License: LGPL-3.0-or-later URL: http://ldb.samba.org/ Source0: http://samba.org/ftp/ldb/ldb-%{version}.tar.gz Source1: http://samba.org/ftp/ldb/ldb-%{version}.tar.asc Patch0: backport-Skip-ldb_lmdb_free_list_test-on-ppc64el-ppc64-and-sp.patch -patch0001: backport-0001-CVE-2023-0614.patch -patch0002: backport-0002-CVE-2023-0614.patch -patch0003: backport-0003-CVE-2023-0614.patch -patch0004: backport-0004-CVE-2023-0614.patch -patch0005: backport-0005-CVE-2023-0614.patch -patch0006: backport-0006-CVE-2023-0614.patch -patch0007: backport-0007-CVE-2023-0614.patch -patch0008: backport-0008-CVE-2023-0614.patch -patch0009: backport-0009-CVE-2023-0614.patch -patch0010: backport-0010-CVE-2023-0614.patch -patch0011: backport-0011-CVE-2023-0614.patch -patch0012: backport-0012-CVE-2023-0614.patch -patch0013: backport-0013-CVE-2023-0614.patch -patch0014: backport-0014-CVE-2023-0614.patch BuildRequires: gcc libtalloc-devel >= %{talloc_version} libtdb-devel >= %{tdb_version} BuildRequires: libtevent-devel >= %{tevent_version} lmdb-devel >= 0.9.16 popt-devel @@ -184,6 +170,12 @@ %{_mandir}/man1/ldbsearch.1.* %changelog +* Sat Jul 22 2023 yanglu <yanglu72@h-partners.com> - 2.7.2-1 +- Type:requirement +- ID:NA +- SUG:NA +- DESC:update libldb version to 2.7.2 + * Sat Apr 01 2023 xinghe <xinghe2@h-partners.com> - 2.6.1-2 - Type:CVE - ID:CVE-2023-0614
View file
_service:tar_scm:backport-0001-CVE-2023-0614.patch
Deleted
@@ -1,174 +0,0 @@ -From 197d1f09158ee0575cd92c461ed12bdbf4efc074 Mon Sep 17 00:00:00 2001 -From: Andrew Bartlett <abartlet@samba.org> -Date: Mon, 13 Mar 2023 14:25:56 +1300 -Subject: PATCH 01/35 CVE-2023-0614 lib/ldb: Avoid allocation and memcpy() - for every wildcard match candidate - -The value can be quite large, the allocation will take much -longer than the actual match and is repeated per candidate -record. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15331 -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Andrew Bartlett <abartlet@samba.org> -Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz> -(cherry picked from commit cad96f59a08192df927fb1df4e9787c7f70991a2) - -abartlet@samba.org Included in the security release as this - makes the new large_ldap.py timeout test more reliable - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_match.c | 60 +++++++++++++++++++++++++++++++------- - 1 file changed, 50 insertions(+), 10 deletions(-) - -diff --git a/common/ldb_match.c b/common/ldb_match.c -index 2f4d41f3441..51376871b4c 100644 ---- a/common/ldb_match.c -+++ b/common/ldb_match.c -@@ -34,6 +34,7 @@ - - #include "ldb_private.h" - #include "dlinklist.h" -+#include "ldb_handlers.h" - - /* - check if the scope matches in a search result -@@ -259,20 +260,42 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -- if (a->syntax->canonicalise_fn(ldb, ldb, &value, &val) != 0) { -- return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -+ /* No need to just copy this value for a binary match */ -+ if (a->syntax->canonicalise_fn != ldb_handler_copy) { -+ if (a->syntax->canonicalise_fn(ldb, ldb, &value, &val) != 0) { -+ return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -+ } -+ -+ /* -+ * Only set save_p if we allocate (call -+ * a->syntax->canonicalise_fn()), as we -+ * talloc_free(save_p) below to clean up -+ */ -+ save_p = val.data; -+ } else { -+ val = value; - } - -- save_p = val.data; - cnk.data = NULL; - - if ( ! tree->u.substring.start_with_wildcard ) { -+ uint8_t *cnk_to_free = NULL; - - chunk = tree->u.substring.chunksc; -- if (a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto mismatch; -+ /* No need to just copy this value for a binary match */ -+ if (a->syntax->canonicalise_fn != ldb_handler_copy) { -+ if (a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) { -+ goto mismatch; -+ } -+ -+ cnk_to_free = cnk.data; -+ } else { -+ cnk = *chunk; -+ } - - /* This deals with wildcard prefix searches on binary attributes (eg objectGUID) */ - if (cnk.length > val.length) { -+ TALLOC_FREE(cnk_to_free); - goto mismatch; - } - /* -@@ -280,32 +303,47 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, - * we can cope with this. - */ - if (cnk.length == 0) { -+ TALLOC_FREE(cnk_to_free); -+ goto mismatch; -+ } -+ -+ if (memcmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) { -+ TALLOC_FREE(cnk_to_free); - goto mismatch; - } - -- if (memcmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) goto mismatch; - val.length -= cnk.length; - val.data += cnk.length; - c++; -- talloc_free(cnk.data); -+ TALLOC_FREE(cnk_to_free); - cnk.data = NULL; - } - - while (tree->u.substring.chunksc) { - uint8_t *p; -+ uint8_t *cnk_to_free = NULL; - - chunk = tree->u.substring.chunksc; -- if(a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) { -- goto mismatch; -+ /* No need to just copy this value for a binary match */ -+ if (a->syntax->canonicalise_fn != ldb_handler_copy) { -+ if (a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) { -+ goto mismatch; -+ } -+ -+ cnk_to_free = cnk.data; -+ } else { -+ cnk = *chunk; - } - /* - * Empty strings are returned as length 0. Ensure - * we can cope with this. - */ - if (cnk.length == 0) { -+ TALLOC_FREE(cnk_to_free); - goto mismatch; - } - if (cnk.length > val.length) { -+ TALLOC_FREE(cnk_to_free); - goto mismatch; - } - -@@ -320,6 +358,8 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, - cmp = memcmp(p, - cnk.data, - cnk.length); -+ TALLOC_FREE(cnk_to_free); -+ - if (cmp != 0) { - goto mismatch; - } -@@ -331,15 +371,16 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, - p = memmem((const void *)val.data, val.length, - (const void *)cnk.data, cnk.length); - if (p == NULL) { -+ TALLOC_FREE(cnk_to_free); - goto mismatch; - } - /* move val to the end of the match */ - p += cnk.length; - val.length -= (p - val.data); - val.data = p; -+ TALLOC_FREE(cnk_to_free); - } - c++; -- TALLOC_FREE(cnk.data); - } - - talloc_free(save_p); -@@ -349,7 +390,6 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, - mismatch: - *matched = false; - talloc_free(save_p); -- talloc_free(cnk.data); - return LDB_SUCCESS; - } - --- -2.25.1
View file
_service:tar_scm:backport-0002-CVE-2023-0614.patch
Deleted
@@ -1,72 +0,0 @@ -From b01d3ae3261264236504475a26c54ab45dd2175f Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 27 Jan 2023 08:28:36 +1300 -Subject: PATCH 05/34 CVE-2023-0614 ldb: Add functions for handling - inaccessible message elements - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_msg.c | 26 ++++++++++++++++++++++++++ - include/ldb_module.h | 4 ++++ - 2 files changed, 30 insertions(+) - -diff --git a/common/ldb_msg.c b/common/ldb_msg.c -index 9cd7998e21c..cbc7e32b2ba 100644 ---- a/common/ldb_msg.c -+++ b/common/ldb_msg.c -@@ -795,6 +795,32 @@ int ldb_msg_element_compare_name(struct ldb_message_element *el1, - return ldb_attr_cmp(el1->name, el2->name); - } - -+void ldb_msg_element_mark_inaccessible(struct ldb_message_element *el) -+{ -+ el->flags |= LDB_FLAG_INTERNAL_INACCESSIBLE_ATTRIBUTE; -+} -+ -+bool ldb_msg_element_is_inaccessible(const struct ldb_message_element *el) -+{ -+ return (el->flags & LDB_FLAG_INTERNAL_INACCESSIBLE_ATTRIBUTE) != 0; -+} -+ -+void ldb_msg_remove_inaccessible(struct ldb_message *msg) -+{ -+ unsigned i; -+ unsigned num_del = 0; -+ -+ for (i = 0; i < msg->num_elements; ++i) { -+ if (ldb_msg_element_is_inaccessible(&msg->elementsi)) { -+ ++num_del; -+ } else if (num_del) { -+ msg->elementsi - num_del = msg->elementsi; -+ } -+ } -+ -+ msg->num_elements -= num_del; -+} -+ - /* - convenience functions to return common types from a message - these return the first value if the attribute is multi-valued -diff --git a/include/ldb_module.h b/include/ldb_module.h -index 4c7c85a17f0..8481fd3991a 100644 ---- a/include/ldb_module.h -+++ b/include/ldb_module.h -@@ -513,6 +513,10 @@ struct ldb_extended_match_rule - int ldb_register_extended_match_rule(struct ldb_context *ldb, - const struct ldb_extended_match_rule *rule); - -+void ldb_msg_element_mark_inaccessible(struct ldb_message_element *el); -+bool ldb_msg_element_is_inaccessible(const struct ldb_message_element *el); -+void ldb_msg_remove_inaccessible(struct ldb_message *msg); -+ - /* - * these pack/unpack functions are exposed in the library for use by - * ldb tools like ldbdump and for use in tests, --- -2.25.1
View file
_service:tar_scm:backport-0003-CVE-2023-0614.patch
Deleted
@@ -1,409 +0,0 @@ -From e7445d18badee6c3b1bbee48c689eb2629c31681 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Wed, 15 Feb 2023 12:34:51 +1300 -Subject: PATCH 07/34 CVE-2023-0614 ldb:tests: Ensure ldb_val data is - zero-terminated - -If the value of an ldb message element is not zero-terminated, calling -ldb_msg_find_attr_as_string() will cause the function to read off the -end of the buffer in an attempt to verify that the value is -zero-terminated. This can cause unexpected behaviour and make the test -randomly fail. - -To avoid this, we must have a terminating null byte that is *not* -counted as part of the length, and so we must calculate the length with -strlen() rather than sizeof. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - tests/ldb_filter_attrs_test.c | 171 +++++++++++++------------- - 1 file changed, 86 insertions(+), 85 deletions(-) - -diff --git a/tests/ldb_filter_attrs_test.c b/tests/ldb_filter_attrs_test.c -index 7d555e0da2e..442d9c77ed2 100644 ---- a/tests/ldb_filter_attrs_test.c -+++ b/tests/ldb_filter_attrs_test.c -@@ -36,6 +36,7 @@ - #include <stdarg.h> - #include <stddef.h> - #include <stdint.h> -+#include <string.h> - #include <setjmp.h> - #include <cmocka.h> - -@@ -96,10 +97,10 @@ static void test_filter_attrs_one_attr_matched(void **state) - - const char *attrs = {"foo", NULL}; - -- uint8_t value = "The value.......end"; -+ char value = "The value.......end"; - struct ldb_val value_1 = { -- .data = value, -- .length = (sizeof(value)) -+ .data = (uint8_t *)value, -+ .length = strlen(value) - }; - struct ldb_message_element element_1 = { - .name = "foo", -@@ -130,9 +131,9 @@ static void test_filter_attrs_one_attr_matched(void **state) - assert_string_equal(filtered_msg->elements0.name, "foo"); - assert_int_equal(filtered_msg->elements0.num_values, 1); - assert_int_equal(filtered_msg->elements0.values0.length, -- sizeof(value)); -+ strlen(value)); - assert_memory_equal(filtered_msg->elements0.values0.data, -- value, sizeof(value)); -+ value, strlen(value)); - } - - /* -@@ -148,10 +149,10 @@ static void test_filter_attrs_one_attr_matched_of_many(void **state) - - const char *attrs = {"foo", "bar", "baz", NULL}; - -- uint8_t value = "The value.......end"; -+ char value = "The value.......end"; - struct ldb_val value_1 = { -- .data = value, -- .length = (sizeof(value)) -+ .data = (uint8_t *)value, -+ .length = strlen(value) - }; - struct ldb_message_element element_1 = { - .name = "foo", -@@ -182,9 +183,9 @@ static void test_filter_attrs_one_attr_matched_of_many(void **state) - assert_string_equal(filtered_msg->elements0.name, "foo"); - assert_int_equal(filtered_msg->elements0.num_values, 1); - assert_int_equal(filtered_msg->elements0.values0.length, -- sizeof(value)); -+ strlen(value)); - assert_memory_equal(filtered_msg->elements0.values0.data, -- value, sizeof(value)); -+ value, strlen(value)); - } - - /* -@@ -201,15 +202,15 @@ static void test_filter_attrs_two_attr_matched_attrs(void **state) - /* deliberatly the other order */ - const char *attrs = {"bar", "foo", NULL}; - -- uint8_t value1 = "The value.......end"; -- uint8_t value2 = "The value..MUST.end"; -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; - struct ldb_val value_1 = { -- .data = value1, -- .length = (sizeof(value1)) -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) - }; - struct ldb_val value_2 = { -- .data = value2, -- .length = (sizeof(value2)) -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) - }; - - /* foo and bar are the other order to in attrs */ -@@ -251,15 +252,15 @@ static void test_filter_attrs_two_attr_matched_attrs(void **state) - assert_string_equal(filtered_msg->elements0.name, "foo"); - assert_int_equal(filtered_msg->elements0.num_values, 1); - assert_int_equal(filtered_msg->elements0.values0.length, -- sizeof(value1)); -+ strlen(value1)); - assert_memory_equal(filtered_msg->elements0.values0.data, -- value1, sizeof(value1)); -+ value1, strlen(value1)); - assert_string_equal(filtered_msg->elements1.name, "bar"); - assert_int_equal(filtered_msg->elements1.num_values, 1); - assert_int_equal(filtered_msg->elements1.values0.length, -- sizeof(value2)); -+ strlen(value2)); - assert_memory_equal(filtered_msg->elements1.values0.data, -- value2, sizeof(value2)); -+ value2, strlen(value2)); - } - - /* -@@ -276,15 +277,15 @@ static void test_filter_attrs_two_attr_matched_one_attr(void **state) - /* deliberatly the other order */ - const char *attrs = {"bar", NULL}; - -- uint8_t value1 = "The value.......end"; -- uint8_t value2 = "The value..MUST.end"; -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; - struct ldb_val value_1 = { -- .data = value1, -- .length = (sizeof(value1)) -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) - }; - struct ldb_val value_2 = { -- .data = value2, -- .length = (sizeof(value2)) -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) - }; - - /* foo and bar are the other order to in attrs */ -@@ -326,9 +327,9 @@ static void test_filter_attrs_two_attr_matched_one_attr(void **state) - assert_string_equal(filtered_msg->elements0.name, "bar"); - assert_int_equal(filtered_msg->elements0.num_values, 1); - assert_int_equal(filtered_msg->elements0.values0.length, -- sizeof(value2)); -+ strlen(value2)); - assert_memory_equal(filtered_msg->elements0.values0.data, -- value2, sizeof(value2)); -+ value2, strlen(value2)); - } - - /* -@@ -345,15 +346,15 @@ static void test_filter_attrs_two_dup_attr_matched_one_attr(void **state) - /* deliberatly the other order */ - const char *attrs = {"bar", NULL}; - -- uint8_t value1 = "The value.......end"; -- uint8_t value2 = "The value..MUST.end"; -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; - struct ldb_val value_1 = { -- .data = value1, -- .length = (sizeof(value1)) -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) - }; - struct ldb_val value_2 = { -- .data = value2, -- .length = (sizeof(value2)) -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) - }; - - /* foo and bar are the other order to in attrs */ -@@ -400,15 +401,15 @@ static void test_filter_attrs_two_dup_attr_matched_dup(void **state) - - const char *attrs = {"bar", "bar", NULL}; - -- uint8_t value1 = "The value.......end"; -- uint8_t value2 = "The value..MUST.end"; -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; - struct ldb_val value_1 = { -- .data = value1, -- .length = (sizeof(value1)) -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) - }; - struct ldb_val value_2 = { -- .data = value2, -- .length = (sizeof(value2)) -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) - }; - - /* foo and bar are the other order to in attrs */ -@@ -445,15 +446,15 @@ static void test_filter_attrs_two_dup_attr_matched_dup(void **state) - assert_string_equal(filtered_msg->elements0.name, "bar"); - assert_int_equal(filtered_msg->elements0.num_values, 1); - assert_int_equal(filtered_msg->elements0.values0.length, -- sizeof(value1)); -+ strlen(value1)); - assert_memory_equal(filtered_msg->elements0.values0.data, -- value1, sizeof(value1)); -+ value1, strlen(value1)); - assert_string_equal(filtered_msg->elements1.name, "bar"); - assert_int_equal(filtered_msg->elements1.num_values, 1); - assert_int_equal(filtered_msg->elements1.values0.length, -- sizeof(value2)); -+ strlen(value2)); - assert_memory_equal(filtered_msg->elements1.values0.data, -- value2, sizeof(value2)); -+ value2, strlen(value2)); - } - - /* -@@ -469,15 +470,15 @@ static void test_filter_attrs_two_dup_attr_matched_one_of_two(void **state) - - const char *attrs = {"bar", "foo", NULL}; - -- uint8_t value1 = "The value.......end"; -- uint8_t value2 = "The value..MUST.end"; -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; - struct ldb_val value_1 = { -- .data = value1, -- .length = (sizeof(value1)) -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) - }; - struct ldb_val value_2 = { -- .data = value2, -- .length = (sizeof(value2)) -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) - }; - - /* foo and bar are the other order to in attrs */ -@@ -514,15 +515,15 @@ static void test_filter_attrs_two_dup_attr_matched_one_of_two(void **state) - assert_string_equal(filtered_msg->elements0.name, "bar"); - assert_int_equal(filtered_msg->elements0.num_values, 1); - assert_int_equal(filtered_msg->elements0.values0.length, -- sizeof(value1)); -+ strlen(value1)); - assert_memory_equal(filtered_msg->elements0.values0.data, -- value1, sizeof(value1)); -+ value1, strlen(value1)); - assert_string_equal(filtered_msg->elements1.name, "bar"); - assert_int_equal(filtered_msg->elements1.num_values, 1); - assert_int_equal(filtered_msg->elements1.values0.length, -- sizeof(value2)); -+ strlen(value2)); - assert_memory_equal(filtered_msg->elements1.values0.data, -- value2, sizeof(value2)); -+ value2, strlen(value2)); - } - - /* -@@ -538,15 +539,15 @@ static void test_filter_attrs_two_dup_attr_matched_star(void **state) - - const char *attrs = {"*", "foo", NULL}; - -- uint8_t value1 = "The value.......end"; -- uint8_t value2 = "The value..MUST.end"; -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; - struct ldb_val value_1 = { -- .data = value1, -- .length = (sizeof(value1)) -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) - }; - struct ldb_val value_2 = { -- .data = value2, -- .length = (sizeof(value2)) -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) - }; - - /* foo and bar are the other order to in attrs */ -@@ -586,15 +587,15 @@ static void test_filter_attrs_two_dup_attr_matched_star(void **state) - assert_string_equal(filtered_msg->elements0.name, "bar"); - assert_int_equal(filtered_msg->elements0.num_values, 1); - assert_int_equal(filtered_msg->elements0.values0.length, -- sizeof(value1)); -+ strlen(value1)); - assert_memory_equal(filtered_msg->elements0.values0.data, -- value1, sizeof(value1)); -+ value1, strlen(value1)); - assert_string_equal(filtered_msg->elements1.name, "bar"); - assert_int_equal(filtered_msg->elements1.num_values, 1); - assert_int_equal(filtered_msg->elements1.values0.length, -- sizeof(value2)); -+ strlen(value2)); - assert_memory_equal(filtered_msg->elements1.values0.data, -- value2, sizeof(value2)); -+ value2, strlen(value2)); - /* - * assert the ldb_filter_attrs does not modify filtered_msg.dn - * in this case -@@ -619,10 +620,10 @@ static void test_filter_attrs_one_attr_matched_star(void **state) - - const char *attrs = {"*", NULL}; - -- uint8_t value = "The value.......end"; -+ char value = "The value.......end"; - struct ldb_val value_1 = { -- .data = value, -- .length = (sizeof(value)) -+ .data = (uint8_t *)value, -+ .length = strlen(value) - }; - struct ldb_message_element element_1 = { - .name = "foo", -@@ -676,15 +677,15 @@ static void test_filter_attrs_two_attr_matched_star(void **state) - - const char *attrs = {"*", NULL}; - -- uint8_t value1 = "The value.......end"; -- uint8_t value2 = "The value..MUST.end"; -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; - struct ldb_val value_1 = { -- .data = value1, -- .length = (sizeof(value1)) -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) - }; - struct ldb_val value_2 = { -- .data = value2, -- .length = (sizeof(value2)) -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) - }; - struct ldb_message_element elements = { - { -@@ -750,10 +751,10 @@ static void test_filter_attrs_one_attr_matched_star_no_dn(void **state) - - const char *attrs = {"*", NULL}; - -- uint8_t value = "The value.......end"; -+ char value = "The value.......end"; - struct ldb_val value_1 = { -- .data = value, -- .length = (sizeof(value)) -+ .data = (uint8_t *)value, -+ .length = strlen(value) - }; - struct ldb_message_element element_1 = { - .name = "foo", -@@ -789,10 +790,10 @@ static void test_filter_attrs_one_attr_matched_star_dn(void **state) - - const char *attrs = {"*", "distinguishedName", NULL}; - -- uint8_t value = "The value.......end"; -+ char value = "The value.......end"; - struct ldb_val value_1 = { -- .data = value, -- .length = (sizeof(value)) -+ .data = (uint8_t *)value, -+ .length = strlen(value) - }; - struct ldb_message_element element_1 = { - .name = "foo", -@@ -844,10 +845,10 @@ static void test_filter_attrs_one_attr_matched_dn(void **state) - - const char *attrs = {"distinguishedName", NULL}; - -- uint8_t value = "The value.......end"; -+ char value = "The value.......end"; - struct ldb_val value_1 = { -- .data = value, -- .length = (sizeof(value)) -+ .data = (uint8_t *)value, -+ .length = strlen(value) - }; - struct ldb_message_element element_1 = { - .name = "foo", -@@ -894,10 +895,10 @@ static void test_filter_attrs_one_attr_empty_list(void **state) - - const char *attrs = {NULL}; - -- uint8_t value = "The value.......end"; -+ char value = "The value.......end"; - struct ldb_val value_1 = { -- .data = value, -- .length = (sizeof(value)) -+ .data = (uint8_t *)value, -+ .length = strlen(value) - }; - struct ldb_message_element element_1 = { - .name = "foo", --- -2.25.1
View file
_service:tar_scm:backport-0004-CVE-2023-0614.patch
Deleted
@@ -1,48 +0,0 @@ -From 936bfcb6ef804d2224072f3770ca09fe2596ee1f Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Wed, 15 Feb 2023 14:08:57 +1300 -Subject: PATCH 08/34 CVE-2023-0614 ldb:tests: Ensure all tests are accounted - for - -Add ldb_filter_attrs_test to the list of tests so that it actually gets -run. - -Remove a duplicate ldb_msg_test that was accidentally added in commit -5ca90e758ade97fb5e335029c7a1768094e70564. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - wscript | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/wscript b/wscript -index 60bb7cf48b3..c862229822d 100644 ---- a/wscript -+++ b/wscript -@@ -627,7 +627,6 @@ def test(ctx): - 'ldb_msg_test', - 'ldb_tdb_mod_op_test', - 'ldb_tdb_guid_mod_op_test', -- 'ldb_msg_test', - 'ldb_tdb_kv_ops_test', - 'ldb_tdb_test', - 'ldb_match_test', -@@ -637,7 +636,9 @@ def test(ctx): - # on operations which the TDB backend does not currently - # support - # 'ldb_key_value_sub_txn_tdb_test' -- 'ldb_parse_test' -+ 'ldb_parse_test', -+ 'ldb_filter_attrs_test', -+ - - # if LIB_LDAP and LIB_LBER defined, then we can test ldb_ldap backend - # behavior regression for bz#14413 --- -2.25.1
View file
_service:tar_scm:backport-0005-CVE-2023-0614.patch
Deleted
@@ -1,104 +0,0 @@ -From 83217ce77381f8faa3cde948e15a36db234d3033 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:23:42 +1300 -Subject: PATCH 09/34 CVE-2023-0614 ldb: Add function to take ownership of an - ldb message - -Many places in Samba depend upon various components of an ldb message -being talloc allocated, and hence able to be used as talloc contexts. -The elements and values of an unpacked ldb message point to unowned data -inside the memory-mapped database, and this function ensures that such -messages have talloc ownership of said elements and values. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_pack.c | 41 ++++++++++++++++++++++++++++++++++++ - include/ldb_module.h | 4 ++++ - 2 files changed, 45 insertions(+) - -diff --git a/common/ldb_pack.c b/common/ldb_pack.c -index e7dd364008a..028d96a619a 100644 ---- a/common/ldb_pack.c -+++ b/common/ldb_pack.c -@@ -690,6 +690,7 @@ static int ldb_unpack_data_flags_v1(struct ldb_context *ldb, - element->values = NULL; - if ((flags & LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC) && element->num_values == 1) { - element->values = &ldb_val_single_arraynelem; -+ element->flags |= LDB_FLAG_INTERNAL_SHARED_VALUES; - } else if (element->num_values != 0) { - element->values = talloc_array(message->elements, - struct ldb_val, -@@ -932,6 +933,7 @@ static int ldb_unpack_data_flags_v2(struct ldb_context *ldb, - if ((flags & LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC) && - element->num_values == 1) { - element->values = &ldb_val_single_arraynelem; -+ element->flags |= LDB_FLAG_INTERNAL_SHARED_VALUES; - } else if (element->num_values != 0) { - element->values = talloc_array(message->elements, - struct ldb_val, -@@ -1259,3 +1261,42 @@ failed: - TALLOC_FREE(filtered_msg->elements); - return -1; - } -+ -+/* Have an unpacked ldb message take talloc ownership of its elements. */ -+int ldb_msg_elements_take_ownership(struct ldb_message *msg) -+{ -+ unsigned int i = 0; -+ -+ for (i = 0; i < msg->num_elements; i++) { -+ struct ldb_message_element *el = &msg->elementsi; -+ const char *name; -+ unsigned int j; -+ -+ name = talloc_strdup(msg->elements, -+ el->name); -+ if (name == NULL) { -+ return -1; -+ } -+ el->name = name; -+ -+ if (el->flags & LDB_FLAG_INTERNAL_SHARED_VALUES) { -+ struct ldb_val *values = talloc_memdup(msg->elements, el->values, -+ sizeof(struct ldb_val) * el->num_values); -+ if (values == NULL) { -+ return -1; -+ } -+ el->values = values; -+ el->flags &= ~LDB_FLAG_INTERNAL_SHARED_VALUES; -+ } -+ -+ for (j = 0; j < el->num_values; j++) { -+ struct ldb_val val = ldb_val_dup(el->values, &el->valuesj); -+ if (val.data == NULL && el->valuesj.length != 0) { -+ return -1; -+ } -+ el->valuesj = val; -+ } -+ } -+ -+ return LDB_SUCCESS; -+} -diff --git a/include/ldb_module.h b/include/ldb_module.h -index 8481fd3991a..8c7f33496fb 100644 ---- a/include/ldb_module.h -+++ b/include/ldb_module.h -@@ -542,6 +542,10 @@ int ldb_filter_attrs(struct ldb_context *ldb, - const struct ldb_message *msg, - const char *const *attrs, - struct ldb_message *filtered_msg); -+ -+/* Have an unpacked ldb message take talloc ownership of its elements. */ -+int ldb_msg_elements_take_ownership(struct ldb_message *msg); -+ - /* - * Unpack a ldb message from a linear buffer in ldb_val - * --- -2.25.1
View file
_service:tar_scm:backport-0006-CVE-2023-0614.patch
Deleted
@@ -1,62 +0,0 @@ -From a9b625bc8ab00b83b55bcd21ba0df48e73e4df29 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:26:04 +1300 -Subject: PATCH 10/34 CVE-2023-0614 ldb: Add function to remove excess - capacity from an ldb message - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -abartlet@samba.org Adapted to conflict from lack of new -ldb_ascii_toupper() in ldb_private.h - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_msg.c | 16 ++++++++++++++++ - include/ldb_private.h | 3 +++ - 2 files changed, 19 insertions(+) - -diff --git a/common/ldb_msg.c b/common/ldb_msg.c -index cbc7e32b2ba..2ea2cce2e83 100644 ---- a/common/ldb_msg.c -+++ b/common/ldb_msg.c -@@ -1497,6 +1497,22 @@ void ldb_msg_remove_attr(struct ldb_message *msg, const char *attr) - } - } - -+/* Reallocate elements to drop any excess capacity. */ -+void ldb_msg_shrink_to_fit(struct ldb_message *msg) -+{ -+ if (msg->num_elements > 0) { -+ struct ldb_message_element *elements = talloc_realloc(msg, -+ msg->elements, -+ struct ldb_message_element, -+ msg->num_elements); -+ if (elements != NULL) { -+ msg->elements = elements; -+ } -+ } else { -+ TALLOC_FREE(msg->elements); -+ } -+} -+ - /* - return a LDAP formatted GeneralizedTime string - */ -diff --git a/include/ldb_private.h b/include/ldb_private.h -index 4deb24691ca..338e71def6d 100644 ---- a/include/ldb_private.h -+++ b/include/ldb_private.h -@@ -317,4 +317,7 @@ int ldb_match_message(struct ldb_context *ldb, - const struct ldb_parse_tree *tree, - enum ldb_scope scope, bool *matched); - -+/* Reallocate elements to drop any excess capacity. */ -+void ldb_msg_shrink_to_fit(struct ldb_message *msg); -+ - #endif --- -2.25.1
View file
_service:tar_scm:backport-0007-CVE-2023-0614.patch
Deleted
@@ -1,68 +0,0 @@ -From 8b7374780e3e7b67e51a1b54a09bf48d89fa9f26 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:27:38 +1300 -Subject: PATCH 11/34 CVE-2023-0614 ldb: Add function to add - distinguishedName to message - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -abartlet@samba.org Adapted to conflict from lack of new -ldb_ascii_toupper() in ldb_private.h - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_pack.c | 6 +++--- - include/ldb_private.h | 5 +++++ - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/common/ldb_pack.c b/common/ldb_pack.c -index 028d96a619a..b0b0d64a5ba 100644 ---- a/common/ldb_pack.c -+++ b/common/ldb_pack.c -@@ -1098,7 +1098,7 @@ int ldb_unpack_data(struct ldb_context *ldb, - /* - add the special distinguishedName element - */ --static int msg_add_distinguished_name(struct ldb_message *msg) -+int ldb_msg_add_distinguished_name(struct ldb_message *msg) - { - const char *dn_attr = "distinguishedName"; - char *dn = NULL; -@@ -1158,7 +1158,7 @@ int ldb_filter_attrs(struct ldb_context *ldb, - - /* Shortcuts for the simple cases */ - } else if (add_dn && i == 1) { -- if (msg_add_distinguished_name(filtered_msg) != 0) { -+ if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { - goto failed; - } - return 0; -@@ -1238,7 +1238,7 @@ int ldb_filter_attrs(struct ldb_context *ldb, - filtered_msg->num_elements = num_elements; - - if (add_dn) { -- if (msg_add_distinguished_name(filtered_msg) != 0) { -+ if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { - goto failed; - } - } -diff --git a/include/ldb_private.h b/include/ldb_private.h -index 338e71def6d..ca43817d07a 100644 ---- a/include/ldb_private.h -+++ b/include/ldb_private.h -@@ -320,4 +320,9 @@ int ldb_match_message(struct ldb_context *ldb, - /* Reallocate elements to drop any excess capacity. */ - void ldb_msg_shrink_to_fit(struct ldb_message *msg); - -+/* -+ add the special distinguishedName element -+*/ -+int ldb_msg_add_distinguished_name(struct ldb_message *msg); -+ - #endif --- -2.25.1
View file
_service:tar_scm:backport-0008-CVE-2023-0614.patch
Deleted
@@ -1,1224 +0,0 @@ -From 4f8b4ce403ff68ca26d33d7272276052829c96f7 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:29:03 +1300 -Subject: PATCH 12/34 CVE-2023-0614 ldb: Add function to filter message in - place - -At present this function is an exact duplicate of ldb_filter_attrs(), -but in the next commit we shall modify it to work in place, without the -need for the allocation of a second message. - -The test is a near duplicate of the existing test for -ldb_filter_attrs(). - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_pack.c | 143 +++ - include/ldb_module.h | 10 + - .../tests/ldb_filter_attrs_in_place_test.c | 989 ++++++++++++++++++ - wscript | 6 + - 4 files changed, 1148 insertions(+) - create mode 100644 tests/ldb_filter_attrs_in_place_test.c - -diff --git a/common/ldb_pack.c b/common/ldb_pack.c -index b0b0d64a5ba..f19ac73fa5e 100644 ---- a/common/ldb_pack.c -+++ b/common/ldb_pack.c -@@ -1262,6 +1262,149 @@ failed: - return -1; - } - -+/* -+ * filter the specified list of attributes from msg, -+ * adding requested attributes, and perhaps all for *, -+ * but not the DN to filtered_msg. -+ */ -+int ldb_filter_attrs_in_place(struct ldb_context *ldb, -+ const struct ldb_message *msg, -+ const char *const *attrs, -+ struct ldb_message *filtered_msg) -+{ -+ unsigned int i; -+ bool keep_all = false; -+ bool add_dn = false; -+ uint32_t num_elements; -+ uint32_t elements_size; -+ -+ if (attrs) { -+ /* check for special attrs */ -+ for (i = 0; attrsi; i++) { -+ int cmp = strcmp(attrsi, "*"); -+ if (cmp == 0) { -+ keep_all = true; -+ break; -+ } -+ cmp = ldb_attr_cmp(attrsi, "distinguishedName"); -+ if (cmp == 0) { -+ add_dn = true; -+ } -+ } -+ } else { -+ keep_all = true; -+ } -+ -+ if (keep_all) { -+ add_dn = true; -+ elements_size = msg->num_elements + 1; -+ -+ /* Shortcuts for the simple cases */ -+ } else if (add_dn && i == 1) { -+ if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { -+ goto failed; -+ } -+ return 0; -+ } else if (i == 0) { -+ return 0; -+ -+ /* -+ * Otherwise we are copying at most as many elements as we -+ * have attributes -+ */ -+ } else { -+ elements_size = i; -+ } -+ -+ filtered_msg->elements = talloc_array(filtered_msg, -+ struct ldb_message_element, -+ elements_size); -+ if (filtered_msg->elements == NULL) goto failed; -+ -+ num_elements = 0; -+ -+ for (i = 0; i < msg->num_elements; i++) { -+ struct ldb_message_element *el = &msg->elementsi; -+ -+ /* -+ * el2 is assigned after the Pigeonhole principle -+ * check below for clarity -+ */ -+ struct ldb_message_element *el2 = NULL; -+ unsigned int j; -+ -+ if (keep_all == false) { -+ bool found = false; -+ for (j = 0; attrsj; j++) { -+ int cmp = ldb_attr_cmp(el->name, attrsj); -+ if (cmp == 0) { -+ found = true; -+ break; -+ } -+ } -+ if (found == false) { -+ continue; -+ } -+ } -+ -+ /* -+ * Pigeonhole principle: we can't have more elements -+ * than the number of attributes if they are unique in -+ * the DB. -+ */ -+ if (num_elements >= elements_size) { -+ goto failed; -+ } -+ -+ el2 = &filtered_msg->elementsnum_elements; -+ -+ *el2 = *el; -+ el2->name = talloc_strdup(filtered_msg->elements, -+ el->name); -+ if (el2->name == NULL) { -+ goto failed; -+ } -+ el2->values = talloc_array(filtered_msg->elements, -+ struct ldb_val, el->num_values); -+ if (el2->values == NULL) { -+ goto failed; -+ } -+ for (j=0;j<el->num_values;j++) { -+ el2->valuesj = ldb_val_dup(el2->values, &el->valuesj); -+ if (el2->valuesj.data == NULL && el->valuesj.length != 0) { -+ goto failed; -+ } -+ } -+ num_elements++; -+ } -+ -+ filtered_msg->num_elements = num_elements; -+ -+ if (add_dn) { -+ if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { -+ goto failed; -+ } -+ } -+ -+ if (filtered_msg->num_elements > 0) { -+ filtered_msg->elements -+ = talloc_realloc(filtered_msg, -+ filtered_msg->elements, -+ struct ldb_message_element, -+ filtered_msg->num_elements); -+ if (filtered_msg->elements == NULL) { -+ goto failed; -+ } -+ } else { -+ TALLOC_FREE(filtered_msg->elements); -+ } -+ -+ return 0; -+failed: -+ TALLOC_FREE(filtered_msg->elements); -+ return -1; -+} -+ - /* Have an unpacked ldb message take talloc ownership of its elements. */ - int ldb_msg_elements_take_ownership(struct ldb_message *msg) - { -diff --git a/include/ldb_module.h b/include/ldb_module.h -index 8c7f33496fb..105093cf38c 100644 ---- a/include/ldb_module.h -+++ b/include/ldb_module.h -@@ -543,6 +543,16 @@ int ldb_filter_attrs(struct ldb_context *ldb, - const char *const *attrs, - struct ldb_message *filtered_msg); - -+/* -+ * filter the specified list of attributes from msg, -+ * adding requested attributes, and perhaps all for *, -+ * but not the DN to filtered_msg. -+ */ -+int ldb_filter_attrs_in_place(struct ldb_context *ldb, -+ const struct ldb_message *msg, -+ const char *const *attrs, -+ struct ldb_message *filtered_msg); -+ - /* Have an unpacked ldb message take talloc ownership of its elements. */ - int ldb_msg_elements_take_ownership(struct ldb_message *msg); - -diff --git a/tests/ldb_filter_attrs_in_place_test.c b/tests/ldb_filter_attrs_in_place_test.c -new file mode 100644 -index 00000000000..bef961f8f9c ---- /dev/null -+++ b/tests/ldb_filter_attrs_in_place_test.c -@@ -0,0 +1,989 @@ -+/* -+ * Tests exercising ldb_filter_attrs_in_place(). -+ * -+ * -+ * Copyright (C) Catalyst.NET Ltd 2017 -+ * Copyright (C) Andrew Bartlett <abartlet@samba.org> 2019 -+ * -+ * 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 <http://www.gnu.org/licenses/>. -+ * -+ */ -+ -+/* -+ * from cmocka.c: -+ * These headers or their equivalents should be included prior to -+ * including -+ * this header file. -+ * -+ * #include <stdarg.h> -+ * #include <stddef.h> -+ * #include <setjmp.h> -+ * -+ * This allows test applications to use custom definitions of C standard -+ * library functions and types. -+ */ -+#include <stdarg.h> -+#include <stddef.h> -+#include <stdint.h> -+#include <string.h> -+#include <setjmp.h> -+#include <cmocka.h> -+ -+#include "../include/ldb.h" -+#include "../include/ldb_module.h" -+ -+struct ldbtest_ctx { -+ struct tevent_context *ev; -+ struct ldb_context *ldb; -+}; -+ -+/* -+ * NOTE WELL: -+ * -+ * This test checks the current behaviour of the function, however -+ * this is not in a public ABI and many of the tested behaviours are -+ * not ideal. If the behaviour is deliberatly improved, this test -+ * should be updated without worry to the new better behaviour. -+ * -+ * In particular the test is particularly to ensure the current -+ * behaviour is memory-safe. -+ */ -+ -+static int setup(void **state) -+{ -+ struct ldbtest_ctx *test_ctx; -+ -+ test_ctx = talloc_zero(NULL, struct ldbtest_ctx); -+ assert_non_null(test_ctx); -+ -+ test_ctx->ev = tevent_context_init(test_ctx); -+ assert_non_null(test_ctx->ev); -+ -+ test_ctx->ldb = ldb_init(test_ctx, test_ctx->ev); -+ assert_non_null(test_ctx->ldb); -+ -+ *state = test_ctx; -+ return 0; -+} -+ -+static int teardown(void **state) -+{ -+ talloc_free(*state); -+ return 0; -+} -+ -+ -+/* -+ * Test against a record with only one attribute, matching the one in -+ * the list -+ */ -+static void test_filter_attrs_one_attr_matched(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"foo", NULL}; -+ -+ char value = "The value.......end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value, -+ .length = strlen(value) -+ }; -+ struct ldb_message_element element_1 = { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 1, -+ .elements = &element_1, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ -+ /* -+ * assert the ldb_filter_attrs_in_place does not read or modify -+ * filtered_msg.dn in this case -+ */ -+ assert_null(filtered_msg->dn); -+ assert_int_equal(filtered_msg->num_elements, 1); -+ assert_string_equal(filtered_msg->elements0.name, "foo"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_int_equal(filtered_msg->elements0.values0.length, -+ strlen(value)); -+ assert_memory_equal(filtered_msg->elements0.values0.data, -+ value, strlen(value)); -+} -+ -+/* -+ * Test against a record with only one attribute, matching the one of -+ * the multiple attributes in the list -+ */ -+static void test_filter_attrs_one_attr_matched_of_many(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"foo", "bar", "baz", NULL}; -+ -+ char value = "The value.......end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value, -+ .length = strlen(value) -+ }; -+ struct ldb_message_element element_1 = { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 1, -+ .elements = &element_1, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ -+ /* -+ * assert the ldb_filter_attrs_in_place does not read or modify -+ * filtered_msg.dn in this case -+ */ -+ assert_null(filtered_msg->dn); -+ assert_int_equal(filtered_msg->num_elements, 1); -+ assert_string_equal(filtered_msg->elements0.name, "foo"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_int_equal(filtered_msg->elements0.values0.length, -+ strlen(value)); -+ assert_memory_equal(filtered_msg->elements0.values0.data, -+ value, strlen(value)); -+} -+ -+/* -+ * Test against a record with only one attribute, matching both -+ * attributes in the list -+ */ -+static void test_filter_attrs_two_attr_matched_attrs(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ /* deliberatly the other order */ -+ const char *attrs = {"bar", "foo", NULL}; -+ -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) -+ }; -+ struct ldb_val value_2 = { -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) -+ }; -+ -+ /* foo and bar are the other order to in attrs */ -+ struct ldb_message_element elements = { -+ { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }, -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_2 -+ } -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 2, -+ .elements = elements, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ assert_int_equal(filtered_msg->num_elements, 2); -+ -+ /* -+ * assert the ldb_filter_attrs_in_place does not read or modify -+ * filtered_msg.dn in this case -+ */ -+ assert_null(filtered_msg->dn); -+ -+ /* Assert that DB order is preserved */ -+ assert_string_equal(filtered_msg->elements0.name, "foo"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_int_equal(filtered_msg->elements0.values0.length, -+ strlen(value1)); -+ assert_memory_equal(filtered_msg->elements0.values0.data, -+ value1, strlen(value1)); -+ assert_string_equal(filtered_msg->elements1.name, "bar"); -+ assert_int_equal(filtered_msg->elements1.num_values, 1); -+ assert_int_equal(filtered_msg->elements1.values0.length, -+ strlen(value2)); -+ assert_memory_equal(filtered_msg->elements1.values0.data, -+ value2, strlen(value2)); -+} -+ -+/* -+ * Test against a record with two attributes, only of which is in -+ * the list -+ */ -+static void test_filter_attrs_two_attr_matched_one_attr(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ /* deliberatly the other order */ -+ const char *attrs = {"bar", NULL}; -+ -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) -+ }; -+ struct ldb_val value_2 = { -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) -+ }; -+ -+ /* foo and bar are the other order to in attrs */ -+ struct ldb_message_element elements = { -+ { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }, -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_2 -+ } -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 2, -+ .elements = elements, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ assert_int_equal(filtered_msg->num_elements, 1); -+ -+ /* -+ * assert the ldb_filter_attrs_in_place does not read or modify -+ * filtered_msg.dn in this case -+ */ -+ assert_null(filtered_msg->dn); -+ -+ /* Assert that DB order is preserved */ -+ assert_string_equal(filtered_msg->elements0.name, "bar"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_int_equal(filtered_msg->elements0.values0.length, -+ strlen(value2)); -+ assert_memory_equal(filtered_msg->elements0.values0.data, -+ value2, strlen(value2)); -+} -+ -+/* -+ * Test against a record with two attributes, both matching the one -+ * specified attribute in the list (a corrupt record) -+ */ -+static void test_filter_attrs_two_dup_attr_matched_one_attr(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ /* deliberatly the other order */ -+ const char *attrs = {"bar", NULL}; -+ -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) -+ }; -+ struct ldb_val value_2 = { -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) -+ }; -+ -+ /* foo and bar are the other order to in attrs */ -+ struct ldb_message_element elements = { -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_1 -+ }, -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_2 -+ } -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 2, -+ .elements = elements, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ -+ /* This should fail the pidgenhole test */ -+ assert_int_equal(ret, -1); -+ assert_null(filtered_msg->elements); -+} -+ -+/* -+ * Test against a record with two attributes, both matching the one -+ * specified attribute in the list (a corrupt record) -+ */ -+static void test_filter_attrs_two_dup_attr_matched_dup(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"bar", "bar", NULL}; -+ -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) -+ }; -+ struct ldb_val value_2 = { -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) -+ }; -+ -+ /* foo and bar are the other order to in attrs */ -+ struct ldb_message_element elements = { -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_1 -+ }, -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_2 -+ } -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 2, -+ .elements = elements, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ -+ /* This does not fail the pidgenhole test */ -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_int_equal(filtered_msg->num_elements, 2); -+ -+ /* Assert that DB order is preserved */ -+ assert_string_equal(filtered_msg->elements0.name, "bar"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_int_equal(filtered_msg->elements0.values0.length, -+ strlen(value1)); -+ assert_memory_equal(filtered_msg->elements0.values0.data, -+ value1, strlen(value1)); -+ assert_string_equal(filtered_msg->elements1.name, "bar"); -+ assert_int_equal(filtered_msg->elements1.num_values, 1); -+ assert_int_equal(filtered_msg->elements1.values0.length, -+ strlen(value2)); -+ assert_memory_equal(filtered_msg->elements1.values0.data, -+ value2, strlen(value2)); -+} -+ -+/* -+ * Test against a record with two attributes, both matching one of the -+ * specified attributes in the list (a corrupt record) -+ */ -+static void test_filter_attrs_two_dup_attr_matched_one_of_two(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"bar", "foo", NULL}; -+ -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) -+ }; -+ struct ldb_val value_2 = { -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) -+ }; -+ -+ /* foo and bar are the other order to in attrs */ -+ struct ldb_message_element elements = { -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_1 -+ }, -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_2 -+ } -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 2, -+ .elements = elements, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ -+ /* This does not fail the pidgenhole test */ -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_int_equal(filtered_msg->num_elements, 2); -+ -+ /* Assert that DB order is preserved */ -+ assert_string_equal(filtered_msg->elements0.name, "bar"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_int_equal(filtered_msg->elements0.values0.length, -+ strlen(value1)); -+ assert_memory_equal(filtered_msg->elements0.values0.data, -+ value1, strlen(value1)); -+ assert_string_equal(filtered_msg->elements1.name, "bar"); -+ assert_int_equal(filtered_msg->elements1.num_values, 1); -+ assert_int_equal(filtered_msg->elements1.values0.length, -+ strlen(value2)); -+ assert_memory_equal(filtered_msg->elements1.values0.data, -+ value2, strlen(value2)); -+} -+ -+/* -+ * Test against a record with two attributes against * (but not the -+ * other named attribute) (a corrupt record) -+ */ -+static void test_filter_attrs_two_dup_attr_matched_star(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"*", "foo", NULL}; -+ -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) -+ }; -+ struct ldb_val value_2 = { -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) -+ }; -+ -+ /* foo and bar are the other order to in attrs */ -+ struct ldb_message_element elements = { -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_1 -+ }, -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_2 -+ } -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 2, -+ .elements = elements, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ /* Needed as * implies distinguishedName */ -+ filtered_msg->dn = in.dn; -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ -+ /* This does not fail the pidgenhole test */ -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_int_equal(filtered_msg->num_elements, 3); -+ -+ /* Assert that DB order is preserved */ -+ assert_string_equal(filtered_msg->elements0.name, "bar"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_int_equal(filtered_msg->elements0.values0.length, -+ strlen(value1)); -+ assert_memory_equal(filtered_msg->elements0.values0.data, -+ value1, strlen(value1)); -+ assert_string_equal(filtered_msg->elements1.name, "bar"); -+ assert_int_equal(filtered_msg->elements1.num_values, 1); -+ assert_int_equal(filtered_msg->elements1.values0.length, -+ strlen(value2)); -+ assert_memory_equal(filtered_msg->elements1.values0.data, -+ value2, strlen(value2)); -+ /* -+ * assert the ldb_filter_attrs_in_place does not modify filtered_msg.dn -+ * in this case -+ */ -+ assert_ptr_equal(filtered_msg->dn, in.dn); -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "distinguishedName", -+ NULL), -+ ldb_dn_get_linearized(in.dn)); -+} -+ -+/* -+ * Test against a record with only one attribute, matching the * in -+ * the list -+ */ -+static void test_filter_attrs_one_attr_matched_star(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"*", NULL}; -+ -+ char value = "The value.......end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value, -+ .length = strlen(value) -+ }; -+ struct ldb_message_element element_1 = { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 1, -+ .elements = &element_1, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ /* Needed as * implies distinguishedName */ -+ filtered_msg->dn = in.dn; -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ assert_int_equal(filtered_msg->num_elements, 2); -+ -+ /* -+ * assert the ldb_filter_attrs_in_place does not modify filtered_msg.dn -+ * in this case -+ */ -+ assert_ptr_equal(filtered_msg->dn, in.dn); -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "distinguishedName", -+ NULL), -+ ldb_dn_get_linearized(in.dn)); -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "foo", -+ NULL), -+ value); -+} -+ -+/* -+ * Test against a record with two attributes, matching the * in -+ * the list -+ */ -+static void test_filter_attrs_two_attr_matched_star(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"*", NULL}; -+ -+ char value1 = "The value.......end"; -+ char value2 = "The value..MUST.end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value1, -+ .length = strlen(value1) -+ }; -+ struct ldb_val value_2 = { -+ .data = (uint8_t *)value2, -+ .length = strlen(value2) -+ }; -+ struct ldb_message_element elements = { -+ { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }, -+ { -+ .name = "bar", -+ .num_values = 1, -+ .values = &value_2 -+ } -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 2, -+ .elements = elements, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ /* Needed as * implies distinguishedName */ -+ filtered_msg->dn = in.dn; -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ assert_int_equal(filtered_msg->num_elements, 3); -+ -+ /* -+ * assert the ldb_filter_attrs_in_place does not modify filtered_msg.dn -+ * in this case -+ */ -+ assert_ptr_equal(filtered_msg->dn, in.dn); -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "distinguishedName", -+ NULL), -+ ldb_dn_get_linearized(in.dn)); -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "foo", -+ NULL), -+ value1); -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "bar", -+ NULL), -+ value2); -+} -+ -+/* -+ * Test against a record with only one attribute, matching the * in -+ * the list, but without the DN being pre-filled. Fails due to need -+ * to contstruct the distinguishedName -+ */ -+static void test_filter_attrs_one_attr_matched_star_no_dn(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"*", NULL}; -+ -+ char value = "The value.......end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value, -+ .length = strlen(value) -+ }; -+ struct ldb_message_element element_1 = { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 1, -+ .elements = &element_1, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, -1); -+ assert_null(filtered_msg->elements); -+} -+ -+/* -+ * Test against a record with only one attribute, matching the * in -+ * the list plus requsesting distinguishedName -+ */ -+static void test_filter_attrs_one_attr_matched_star_dn(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"*", "distinguishedName", NULL}; -+ -+ char value = "The value.......end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value, -+ .length = strlen(value) -+ }; -+ struct ldb_message_element element_1 = { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 1, -+ .elements = &element_1, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ /* Needed for distinguishedName */ -+ filtered_msg->dn = in.dn; -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ assert_int_equal(filtered_msg->num_elements, 2); -+ -+ /* show that ldb_filter_attrs_in_place does not modify in.dn */ -+ assert_ptr_equal(filtered_msg->dn, in.dn); -+ -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "distinguishedName", -+ NULL), -+ ldb_dn_get_linearized(in.dn)); -+ assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ "foo", -+ NULL), -+ value); -+} -+ -+/* -+ * Test against a record with only one attribute, but returning -+ * distinguishedName from the list (only) -+ */ -+static void test_filter_attrs_one_attr_matched_dn(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {"distinguishedName", NULL}; -+ -+ char value = "The value.......end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value, -+ .length = strlen(value) -+ }; -+ struct ldb_message_element element_1 = { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 1, -+ .elements = &element_1, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ /* Needed for distinguishedName */ -+ filtered_msg->dn = in.dn; -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ assert_int_equal(filtered_msg->num_elements, 1); -+ -+ /* show that ldb_filter_attrs_in_place does not modify in.dn */ -+ assert_ptr_equal(filtered_msg->dn, in.dn); -+ assert_string_equal(filtered_msg->elements0.name, "distinguishedName"); -+ assert_int_equal(filtered_msg->elements0.num_values, 1); -+ assert_string_equal(filtered_msg->elements0.values0.data, -+ ldb_dn_get_linearized(in.dn)); -+} -+ -+/* -+ * Test against a record with only one attribute, not matching the -+ * empty attribute list -+ */ -+static void test_filter_attrs_one_attr_empty_list(void **state) -+{ -+ struct ldbtest_ctx *ctx = *state; -+ int ret; -+ -+ struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ -+ const char *attrs = {NULL}; -+ -+ char value = "The value.......end"; -+ struct ldb_val value_1 = { -+ .data = (uint8_t *)value, -+ .length = strlen(value) -+ }; -+ struct ldb_message_element element_1 = { -+ .name = "foo", -+ .num_values = 1, -+ .values = &value_1 -+ }; -+ struct ldb_message in = { -+ .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -+ .num_elements = 1, -+ .elements = &element_1, -+ }; -+ -+ assert_non_null(in.dn); -+ -+ ret = ldb_filter_attrs_in_place(ctx->ldb, -+ &in, -+ attrs, -+ filtered_msg); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_non_null(filtered_msg); -+ assert_int_equal(filtered_msg->num_elements, 0); -+ assert_null(filtered_msg->dn); -+ assert_null(filtered_msg->elements); -+} -+ -+int main(int argc, const char **argv) -+{ -+ const struct CMUnitTest tests = { -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_one_attr_matched, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_one_attr_matched_of_many, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_two_attr_matched_attrs, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_two_attr_matched_one_attr, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_two_dup_attr_matched_one_attr, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_two_dup_attr_matched_dup, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_two_dup_attr_matched_one_of_two, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_two_dup_attr_matched_star, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_one_attr_matched_star, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_two_attr_matched_star, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_one_attr_matched_star_no_dn, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_one_attr_matched_star_dn, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_one_attr_matched_dn, -+ setup, -+ teardown), -+ cmocka_unit_test_setup_teardown( -+ test_filter_attrs_one_attr_empty_list, -+ setup, -+ teardown), -+ }; -+ -+ return cmocka_run_group_tests(tests, NULL, NULL); -+} -diff --git a/wscript b/wscript -index c862229822d..7e02309c1d5 100644 ---- a/wscript -+++ b/wscript -@@ -518,6 +518,11 @@ def build(bld): - deps='cmocka ldb ldb_tdb_err_map', - install=False) - -+ bld.SAMBA_BINARY('ldb_filter_attrs_in_place_test', -+ source='tests/ldb_filter_attrs_in_place_test.c', -+ deps='cmocka ldb ldb_tdb_err_map', -+ install=False) -+ - bld.SAMBA_BINARY('ldb_key_value_sub_txn_tdb_test', - bld.SUBDIR('ldb_key_value', - '''ldb_kv_search.c -@@ -638,6 +643,7 @@ def test(ctx): - # 'ldb_key_value_sub_txn_tdb_test' - 'ldb_parse_test', - 'ldb_filter_attrs_test', -+ 'ldb_filter_attrs_in_place_test', - - - # if LIB_LDAP and LIB_LBER defined, then we can test ldb_ldap backend --- -2.25.1
View file
_service:tar_scm:backport-0009-CVE-2023-0614.patch
Deleted
@@ -1,1275 +0,0 @@ -From fd0f06e43f03bc8b8c5b4a978a119e4401c02160 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:30:19 +1300 -Subject: PATCH 13/34 CVE-2023-0614 ldb: Make ldb_filter_attrs_in_place() - work in place - -ldb_filter_attrs() previously did too much. Now its replacement, -ldb_filter_attrs_in_place(), only does the actual filtering, while -taking ownership of each element's values is handled in a separate -function, ldb_msg_elements_take_ownership(). - -Also, ldb_filter_attrs_in_place() no longer adds the distinguishedName -to the message if it is missing. That is handled in another function, -ldb_msg_add_distinguished_name(). - -As we're now modifying the original message rather than copying it into -a new one, we no longer need the filtered_msg parameter. - -We adapt a test, based on ldb_filter_attrs_test, to exercise the new -function. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_pack.c | 129 +--- - include/ldb_module.h | 11 +- - .../tests/ldb_filter_attrs_in_place_test.c | 609 ++++++++---------- - 3 files changed, 307 insertions(+), 442 deletions(-) - -diff --git a/common/ldb_pack.c b/common/ldb_pack.c -index f19ac73fa5e..28b9a8dfe07 100644 ---- a/common/ldb_pack.c -+++ b/common/ldb_pack.c -@@ -1264,19 +1264,16 @@ failed: - - /* - * filter the specified list of attributes from msg, -- * adding requested attributes, and perhaps all for *, -- * but not the DN to filtered_msg. -+ * adding requested attributes, and perhaps all for *. -+ * Unlike ldb_filter_attrs(), the DN will not be added -+ * if it is missing. - */ --int ldb_filter_attrs_in_place(struct ldb_context *ldb, -- const struct ldb_message *msg, -- const char *const *attrs, -- struct ldb_message *filtered_msg) -+int ldb_filter_attrs_in_place(struct ldb_message *msg, -+ const char *const *attrs) - { -- unsigned int i; -+ unsigned int i = 0; - bool keep_all = false; -- bool add_dn = false; -- uint32_t num_elements; -- uint32_t elements_size; -+ unsigned int num_del = 0; - - if (attrs) { - /* check for special attrs */ -@@ -1286,123 +1283,41 @@ int ldb_filter_attrs_in_place(struct ldb_context *ldb, - keep_all = true; - break; - } -- cmp = ldb_attr_cmp(attrsi, "distinguishedName"); -- if (cmp == 0) { -- add_dn = true; -- } - } -- } else { -- keep_all = true; -- } -- -- if (keep_all) { -- add_dn = true; -- elements_size = msg->num_elements + 1; -- -- /* Shortcuts for the simple cases */ -- } else if (add_dn && i == 1) { -- if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { -- goto failed; -+ if (!keep_all && i == 0) { -+ msg->num_elements = 0; -+ return LDB_SUCCESS; - } -- return 0; -- } else if (i == 0) { -- return 0; -- -- /* -- * Otherwise we are copying at most as many elements as we -- * have attributes -- */ - } else { -- elements_size = i; -+ keep_all = true; - } - -- filtered_msg->elements = talloc_array(filtered_msg, -- struct ldb_message_element, -- elements_size); -- if (filtered_msg->elements == NULL) goto failed; -- -- num_elements = 0; -- - for (i = 0; i < msg->num_elements; i++) { -- struct ldb_message_element *el = &msg->elementsi; -- -- /* -- * el2 is assigned after the Pigeonhole principle -- * check below for clarity -- */ -- struct ldb_message_element *el2 = NULL; -+ bool found = false; - unsigned int j; - -- if (keep_all == false) { -- bool found = false; -+ if (keep_all) { -+ found = true; -+ } else { - for (j = 0; attrsj; j++) { -- int cmp = ldb_attr_cmp(el->name, attrsj); -+ int cmp = ldb_attr_cmp(msg->elementsi.name, attrsj); - if (cmp == 0) { - found = true; - break; - } - } -- if (found == false) { -- continue; -- } -- } -- -- /* -- * Pigeonhole principle: we can't have more elements -- * than the number of attributes if they are unique in -- * the DB. -- */ -- if (num_elements >= elements_size) { -- goto failed; - } - -- el2 = &filtered_msg->elementsnum_elements; -- -- *el2 = *el; -- el2->name = talloc_strdup(filtered_msg->elements, -- el->name); -- if (el2->name == NULL) { -- goto failed; -- } -- el2->values = talloc_array(filtered_msg->elements, -- struct ldb_val, el->num_values); -- if (el2->values == NULL) { -- goto failed; -+ if (!found) { -+ ++num_del; -+ } else if (num_del != 0) { -+ msg->elementsi - num_del = msg->elementsi; - } -- for (j=0;j<el->num_values;j++) { -- el2->valuesj = ldb_val_dup(el2->values, &el->valuesj); -- if (el2->valuesj.data == NULL && el->valuesj.length != 0) { -- goto failed; -- } -- } -- num_elements++; - } - -- filtered_msg->num_elements = num_elements; -- -- if (add_dn) { -- if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { -- goto failed; -- } -- } -+ msg->num_elements -= num_del; - -- if (filtered_msg->num_elements > 0) { -- filtered_msg->elements -- = talloc_realloc(filtered_msg, -- filtered_msg->elements, -- struct ldb_message_element, -- filtered_msg->num_elements); -- if (filtered_msg->elements == NULL) { -- goto failed; -- } -- } else { -- TALLOC_FREE(filtered_msg->elements); -- } -- -- return 0; --failed: -- TALLOC_FREE(filtered_msg->elements); -- return -1; -+ return LDB_SUCCESS; - } - - /* Have an unpacked ldb message take talloc ownership of its elements. */ -diff --git a/include/ldb_module.h b/include/ldb_module.h -index 105093cf38c..4ae381ba5be 100644 ---- a/include/ldb_module.h -+++ b/include/ldb_module.h -@@ -545,13 +545,12 @@ int ldb_filter_attrs(struct ldb_context *ldb, - - /* - * filter the specified list of attributes from msg, -- * adding requested attributes, and perhaps all for *, -- * but not the DN to filtered_msg. -+ * adding requested attributes, and perhaps all for *. -+ * Unlike ldb_filter_attrs(), the DN will not be added -+ * if it is missing. - */ --int ldb_filter_attrs_in_place(struct ldb_context *ldb, -- const struct ldb_message *msg, -- const char *const *attrs, -- struct ldb_message *filtered_msg); -+int ldb_filter_attrs_in_place(struct ldb_message *msg, -+ const char *const *attrs); - - /* Have an unpacked ldb message take talloc ownership of its elements. */ - int ldb_msg_elements_take_ownership(struct ldb_message *msg); -diff --git a/tests/ldb_filter_attrs_in_place_test.c b/tests/ldb_filter_attrs_in_place_test.c -index bef961f8f9c..da333c73c99 100644 ---- a/tests/ldb_filter_attrs_in_place_test.c -+++ b/tests/ldb_filter_attrs_in_place_test.c -@@ -83,17 +83,41 @@ static int teardown(void **state) - return 0; - } - -+static void msg_add_dn(struct ldb_message *msg) -+{ -+ const char *dn_attr = "distinguishedName"; -+ char *dn = NULL; -+ int ret; -+ -+ assert_null(ldb_msg_find_element(msg, dn_attr)); -+ -+ assert_non_null(msg->dn); -+ dn = ldb_dn_alloc_linearized(msg, msg->dn); -+ assert_non_null(dn); -+ -+ /* -+ * The message's elements must be talloc allocated to call -+ * ldb_msg_add_steal_string(). -+ */ -+ msg->elements = talloc_memdup(msg, -+ msg->elements, -+ msg->num_elements * sizeof(msg->elements0)); -+ assert_non_null(msg->elements); -+ -+ ret = ldb_msg_add_steal_string(msg, dn_attr, dn); -+ assert_int_equal(ret, LDB_SUCCESS); -+} - - /* - * Test against a record with only one attribute, matching the one in - * the list - */ --static void test_filter_attrs_one_attr_matched(void **state) -+static void test_filter_attrs_in_place_one_attr_matched(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"foo", NULL}; - -@@ -107,32 +131,25 @@ static void test_filter_attrs_one_attr_matched(void **state) - .num_values = 1, - .values = &value_1 - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 1, -- .elements = &element_1, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 1; -+ msg->elements = &element_1; - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); -+ -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); - -- /* -- * assert the ldb_filter_attrs_in_place does not read or modify -- * filtered_msg.dn in this case -- */ -- assert_null(filtered_msg->dn); -- assert_int_equal(filtered_msg->num_elements, 1); -- assert_string_equal(filtered_msg->elements0.name, "foo"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_int_equal(filtered_msg->elements0.values0.length, -+ assert_non_null(msg->dn); -+ assert_int_equal(msg->num_elements, 1); -+ assert_string_equal(msg->elements0.name, "foo"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, - strlen(value)); -- assert_memory_equal(filtered_msg->elements0.values0.data, -+ assert_memory_equal(msg->elements0.values0.data, - value, strlen(value)); - } - -@@ -140,12 +157,12 @@ static void test_filter_attrs_one_attr_matched(void **state) - * Test against a record with only one attribute, matching the one of - * the multiple attributes in the list - */ --static void test_filter_attrs_one_attr_matched_of_many(void **state) -+static void test_filter_attrs_in_place_one_attr_matched_of_many(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"foo", "bar", "baz", NULL}; - -@@ -159,32 +176,25 @@ static void test_filter_attrs_one_attr_matched_of_many(void **state) - .num_values = 1, - .values = &value_1 - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 1, -- .elements = &element_1, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 1; -+ msg->elements = &element_1; - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); -+ -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); - -- /* -- * assert the ldb_filter_attrs_in_place does not read or modify -- * filtered_msg.dn in this case -- */ -- assert_null(filtered_msg->dn); -- assert_int_equal(filtered_msg->num_elements, 1); -- assert_string_equal(filtered_msg->elements0.name, "foo"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_int_equal(filtered_msg->elements0.values0.length, -+ assert_non_null(msg->dn); -+ assert_int_equal(msg->num_elements, 1); -+ assert_string_equal(msg->elements0.name, "foo"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, - strlen(value)); -- assert_memory_equal(filtered_msg->elements0.values0.data, -+ assert_memory_equal(msg->elements0.values0.data, - value, strlen(value)); - } - -@@ -192,12 +202,12 @@ static void test_filter_attrs_one_attr_matched_of_many(void **state) - * Test against a record with only one attribute, matching both - * attributes in the list - */ --static void test_filter_attrs_two_attr_matched_attrs(void **state) -+static void test_filter_attrs_in_place_two_attr_matched_attrs(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - /* deliberatly the other order */ - const char *attrs = {"bar", "foo", NULL}; -@@ -226,40 +236,33 @@ static void test_filter_attrs_two_attr_matched_attrs(void **state) - .values = &value_2 - } - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 2, -- .elements = elements, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 2; -+ msg->elements = elements; - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); -+ -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); -- assert_int_equal(filtered_msg->num_elements, 2); -+ assert_int_equal(msg->num_elements, 2); - -- /* -- * assert the ldb_filter_attrs_in_place does not read or modify -- * filtered_msg.dn in this case -- */ -- assert_null(filtered_msg->dn); -+ assert_non_null(msg->dn); - - /* Assert that DB order is preserved */ -- assert_string_equal(filtered_msg->elements0.name, "foo"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_int_equal(filtered_msg->elements0.values0.length, -+ assert_string_equal(msg->elements0.name, "foo"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, - strlen(value1)); -- assert_memory_equal(filtered_msg->elements0.values0.data, -+ assert_memory_equal(msg->elements0.values0.data, - value1, strlen(value1)); -- assert_string_equal(filtered_msg->elements1.name, "bar"); -- assert_int_equal(filtered_msg->elements1.num_values, 1); -- assert_int_equal(filtered_msg->elements1.values0.length, -+ assert_string_equal(msg->elements1.name, "bar"); -+ assert_int_equal(msg->elements1.num_values, 1); -+ assert_int_equal(msg->elements1.values0.length, - strlen(value2)); -- assert_memory_equal(filtered_msg->elements1.values0.data, -+ assert_memory_equal(msg->elements1.values0.data, - value2, strlen(value2)); - } - -@@ -267,14 +270,13 @@ static void test_filter_attrs_two_attr_matched_attrs(void **state) - * Test against a record with two attributes, only of which is in - * the list - */ --static void test_filter_attrs_two_attr_matched_one_attr(void **state) -+static void test_filter_attrs_in_place_two_attr_matched_one_attr(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - -- /* deliberatly the other order */ - const char *attrs = {"bar", NULL}; - - char value1 = "The value.......end"; -@@ -288,7 +290,6 @@ static void test_filter_attrs_two_attr_matched_one_attr(void **state) - .length = strlen(value2) - }; - -- /* foo and bar are the other order to in attrs */ - struct ldb_message_element elements = { - { - .name = "foo", -@@ -301,34 +302,27 @@ static void test_filter_attrs_two_attr_matched_one_attr(void **state) - .values = &value_2 - } - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 2, -- .elements = elements, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 2; -+ msg->elements = elements; - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); -+ -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); -- assert_int_equal(filtered_msg->num_elements, 1); -+ assert_int_equal(msg->num_elements, 1); - -- /* -- * assert the ldb_filter_attrs_in_place does not read or modify -- * filtered_msg.dn in this case -- */ -- assert_null(filtered_msg->dn); -+ assert_non_null(msg->dn); - - /* Assert that DB order is preserved */ -- assert_string_equal(filtered_msg->elements0.name, "bar"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_int_equal(filtered_msg->elements0.values0.length, -+ assert_string_equal(msg->elements0.name, "bar"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, - strlen(value2)); -- assert_memory_equal(filtered_msg->elements0.values0.data, -+ assert_memory_equal(msg->elements0.values0.data, - value2, strlen(value2)); - } - -@@ -336,14 +330,13 @@ static void test_filter_attrs_two_attr_matched_one_attr(void **state) - * Test against a record with two attributes, both matching the one - * specified attribute in the list (a corrupt record) - */ --static void test_filter_attrs_two_dup_attr_matched_one_attr(void **state) -+static void test_filter_attrs_in_place_two_dup_attr_matched_one_attr(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - -- /* deliberatly the other order */ - const char *attrs = {"bar", NULL}; - - char value1 = "The value.......end"; -@@ -357,7 +350,6 @@ static void test_filter_attrs_two_dup_attr_matched_one_attr(void **state) - .length = strlen(value2) - }; - -- /* foo and bar are the other order to in attrs */ - struct ldb_message_element elements = { - { - .name = "bar", -@@ -370,34 +362,49 @@ static void test_filter_attrs_two_dup_attr_matched_one_attr(void **state) - .values = &value_2 - } - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 2, -- .elements = elements, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 2; -+ msg->elements = elements; -+ -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); -+ -+ ret = ldb_filter_attrs_in_place(msg, attrs); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ /* Both elements match the filter */ -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_int_equal(msg->num_elements, 2); -+ -+ assert_non_null(msg->dn); - -- /* This should fail the pidgenhole test */ -- assert_int_equal(ret, -1); -- assert_null(filtered_msg->elements); -+ /* Assert that DB order is preserved */ -+ assert_string_equal(msg->elements0.name, "bar"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, -+ strlen(value1)); -+ assert_memory_equal(msg->elements0.values0.data, -+ value1, strlen(value1)); -+ -+ assert_string_equal(msg->elements1.name, "bar"); -+ assert_int_equal(msg->elements1.num_values, 1); -+ assert_int_equal(msg->elements1.values0.length, -+ strlen(value2)); -+ assert_memory_equal(msg->elements1.values0.data, -+ value2, strlen(value2)); - } - - /* - * Test against a record with two attributes, both matching the one - * specified attribute in the list (a corrupt record) - */ --static void test_filter_attrs_two_dup_attr_matched_dup(void **state) -+static void test_filter_attrs_in_place_two_dup_attr_matched_dup(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"bar", "bar", NULL}; - -@@ -412,7 +419,6 @@ static void test_filter_attrs_two_dup_attr_matched_dup(void **state) - .length = strlen(value2) - }; - -- /* foo and bar are the other order to in attrs */ - struct ldb_message_element elements = { - { - .name = "bar", -@@ -425,35 +431,33 @@ static void test_filter_attrs_two_dup_attr_matched_dup(void **state) - .values = &value_2 - } - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 2, -- .elements = elements, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 2; -+ msg->elements = elements; -+ -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ ret = ldb_filter_attrs_in_place(msg, attrs); - - /* This does not fail the pidgenhole test */ - assert_int_equal(ret, LDB_SUCCESS); -- assert_int_equal(filtered_msg->num_elements, 2); -+ assert_int_equal(msg->num_elements, 2); - - /* Assert that DB order is preserved */ -- assert_string_equal(filtered_msg->elements0.name, "bar"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_int_equal(filtered_msg->elements0.values0.length, -+ assert_string_equal(msg->elements0.name, "bar"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, - strlen(value1)); -- assert_memory_equal(filtered_msg->elements0.values0.data, -+ assert_memory_equal(msg->elements0.values0.data, - value1, strlen(value1)); -- assert_string_equal(filtered_msg->elements1.name, "bar"); -- assert_int_equal(filtered_msg->elements1.num_values, 1); -- assert_int_equal(filtered_msg->elements1.values0.length, -+ assert_string_equal(msg->elements1.name, "bar"); -+ assert_int_equal(msg->elements1.num_values, 1); -+ assert_int_equal(msg->elements1.values0.length, - strlen(value2)); -- assert_memory_equal(filtered_msg->elements1.values0.data, -+ assert_memory_equal(msg->elements1.values0.data, - value2, strlen(value2)); - } - -@@ -461,12 +465,12 @@ static void test_filter_attrs_two_dup_attr_matched_dup(void **state) - * Test against a record with two attributes, both matching one of the - * specified attributes in the list (a corrupt record) - */ --static void test_filter_attrs_two_dup_attr_matched_one_of_two(void **state) -+static void test_filter_attrs_in_place_two_dup_attr_matched_one_of_two(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"bar", "foo", NULL}; - -@@ -481,7 +485,6 @@ static void test_filter_attrs_two_dup_attr_matched_one_of_two(void **state) - .length = strlen(value2) - }; - -- /* foo and bar are the other order to in attrs */ - struct ldb_message_element elements = { - { - .name = "bar", -@@ -494,35 +497,33 @@ static void test_filter_attrs_two_dup_attr_matched_one_of_two(void **state) - .values = &value_2 - } - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 2, -- .elements = elements, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 2; -+ msg->elements = elements; - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); -+ -+ ret = ldb_filter_attrs_in_place(msg, attrs); - - /* This does not fail the pidgenhole test */ - assert_int_equal(ret, LDB_SUCCESS); -- assert_int_equal(filtered_msg->num_elements, 2); -+ assert_int_equal(msg->num_elements, 2); - - /* Assert that DB order is preserved */ -- assert_string_equal(filtered_msg->elements0.name, "bar"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_int_equal(filtered_msg->elements0.values0.length, -+ assert_string_equal(msg->elements0.name, "bar"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, - strlen(value1)); -- assert_memory_equal(filtered_msg->elements0.values0.data, -+ assert_memory_equal(msg->elements0.values0.data, - value1, strlen(value1)); -- assert_string_equal(filtered_msg->elements1.name, "bar"); -- assert_int_equal(filtered_msg->elements1.num_values, 1); -- assert_int_equal(filtered_msg->elements1.values0.length, -+ assert_string_equal(msg->elements1.name, "bar"); -+ assert_int_equal(msg->elements1.num_values, 1); -+ assert_int_equal(msg->elements1.values0.length, - strlen(value2)); -- assert_memory_equal(filtered_msg->elements1.values0.data, -+ assert_memory_equal(msg->elements1.values0.data, - value2, strlen(value2)); - } - -@@ -530,12 +531,12 @@ static void test_filter_attrs_two_dup_attr_matched_one_of_two(void **state) - * Test against a record with two attributes against * (but not the - * other named attribute) (a corrupt record) - */ --static void test_filter_attrs_two_dup_attr_matched_star(void **state) -+static void test_filter_attrs_in_place_two_dup_attr_matched_star(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"*", "foo", NULL}; - -@@ -550,7 +551,6 @@ static void test_filter_attrs_two_dup_attr_matched_star(void **state) - .length = strlen(value2) - }; - -- /* foo and bar are the other order to in attrs */ - struct ldb_message_element elements = { - { - .name = "bar", -@@ -563,60 +563,52 @@ static void test_filter_attrs_two_dup_attr_matched_star(void **state) - .values = &value_2 - } - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 2, -- .elements = elements, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 2; -+ msg->elements = elements; - -- /* Needed as * implies distinguishedName */ -- filtered_msg->dn = in.dn; -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ ret = ldb_filter_attrs_in_place(msg, attrs); - - /* This does not fail the pidgenhole test */ - assert_int_equal(ret, LDB_SUCCESS); -- assert_int_equal(filtered_msg->num_elements, 3); -+ assert_int_equal(msg->num_elements, 3); - - /* Assert that DB order is preserved */ -- assert_string_equal(filtered_msg->elements0.name, "bar"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_int_equal(filtered_msg->elements0.values0.length, -+ assert_string_equal(msg->elements0.name, "bar"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_int_equal(msg->elements0.values0.length, - strlen(value1)); -- assert_memory_equal(filtered_msg->elements0.values0.data, -+ assert_memory_equal(msg->elements0.values0.data, - value1, strlen(value1)); -- assert_string_equal(filtered_msg->elements1.name, "bar"); -- assert_int_equal(filtered_msg->elements1.num_values, 1); -- assert_int_equal(filtered_msg->elements1.values0.length, -+ assert_string_equal(msg->elements1.name, "bar"); -+ assert_int_equal(msg->elements1.num_values, 1); -+ assert_int_equal(msg->elements1.values0.length, - strlen(value2)); -- assert_memory_equal(filtered_msg->elements1.values0.data, -+ assert_memory_equal(msg->elements1.values0.data, - value2, strlen(value2)); -- /* -- * assert the ldb_filter_attrs_in_place does not modify filtered_msg.dn -- * in this case -- */ -- assert_ptr_equal(filtered_msg->dn, in.dn); -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ -+ assert_non_null(msg->dn); -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "distinguishedName", - NULL), -- ldb_dn_get_linearized(in.dn)); -+ ldb_dn_get_linearized(msg->dn)); - } - - /* - * Test against a record with only one attribute, matching the * in - * the list - */ --static void test_filter_attrs_one_attr_matched_star(void **state) -+static void test_filter_attrs_in_place_one_attr_matched_star(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"*", NULL}; - -@@ -630,35 +622,25 @@ static void test_filter_attrs_one_attr_matched_star(void **state) - .num_values = 1, - .values = &value_1 - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 1, -- .elements = &element_1, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 1; -+ msg->elements = &element_1; - -- /* Needed as * implies distinguishedName */ -- filtered_msg->dn = in.dn; -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); -- assert_int_equal(filtered_msg->num_elements, 2); -+ assert_int_equal(msg->num_elements, 2); - -- /* -- * assert the ldb_filter_attrs_in_place does not modify filtered_msg.dn -- * in this case -- */ -- assert_ptr_equal(filtered_msg->dn, in.dn); -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ assert_non_null(msg->dn); -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "distinguishedName", - NULL), -- ldb_dn_get_linearized(in.dn)); -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ ldb_dn_get_linearized(msg->dn)); -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "foo", - NULL), - value); -@@ -668,12 +650,12 @@ static void test_filter_attrs_one_attr_matched_star(void **state) - * Test against a record with two attributes, matching the * in - * the list - */ --static void test_filter_attrs_two_attr_matched_star(void **state) -+static void test_filter_attrs_in_place_two_attr_matched_star(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"*", NULL}; - -@@ -699,39 +681,29 @@ static void test_filter_attrs_two_attr_matched_star(void **state) - .values = &value_2 - } - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 2, -- .elements = elements, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 2; -+ msg->elements = elements; - -- /* Needed as * implies distinguishedName */ -- filtered_msg->dn = in.dn; -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); -- assert_int_equal(filtered_msg->num_elements, 3); -+ assert_int_equal(msg->num_elements, 3); - -- /* -- * assert the ldb_filter_attrs_in_place does not modify filtered_msg.dn -- * in this case -- */ -- assert_ptr_equal(filtered_msg->dn, in.dn); -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ assert_non_null(msg->dn); -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "distinguishedName", - NULL), -- ldb_dn_get_linearized(in.dn)); -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ ldb_dn_get_linearized(msg->dn)); -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "foo", - NULL), - value1); -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "bar", - NULL), - value2); -@@ -739,15 +711,15 @@ static void test_filter_attrs_two_attr_matched_star(void **state) - - /* - * Test against a record with only one attribute, matching the * in -- * the list, but without the DN being pre-filled. Fails due to need -- * to contstruct the distinguishedName -+ * the list, but without the DN being pre-filled. Succeeds, but the -+ * distinguishedName is not added. - */ --static void test_filter_attrs_one_attr_matched_star_no_dn(void **state) -+static void test_filter_attrs_in_place_one_attr_matched_star_no_dn(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"*", NULL}; - -@@ -761,32 +733,29 @@ static void test_filter_attrs_one_attr_matched_star_no_dn(void **state) - .num_values = 1, - .values = &value_1 - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 1, -- .elements = &element_1, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = NULL; -+ msg->num_elements = 1; -+ msg->elements = &element_1; -+ -+ assert_null(msg->dn); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -- assert_int_equal(ret, -1); -- assert_null(filtered_msg->elements); -+ ret = ldb_filter_attrs_in_place(msg, attrs); -+ assert_int_equal(ret, LDB_SUCCESS); -+ assert_int_equal(msg->num_elements, 1); - } - - /* - * Test against a record with only one attribute, matching the * in - * the list plus requsesting distinguishedName - */ --static void test_filter_attrs_one_attr_matched_star_dn(void **state) -+static void test_filter_attrs_in_place_one_attr_matched_star_dn(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"*", "distinguishedName", NULL}; - -@@ -800,33 +769,26 @@ static void test_filter_attrs_one_attr_matched_star_dn(void **state) - .num_values = 1, - .values = &value_1 - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 1, -- .elements = &element_1, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 1; -+ msg->elements = &element_1; - -- /* Needed for distinguishedName */ -- filtered_msg->dn = in.dn; -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); -- assert_int_equal(filtered_msg->num_elements, 2); -+ assert_int_equal(msg->num_elements, 2); - -- /* show that ldb_filter_attrs_in_place does not modify in.dn */ -- assert_ptr_equal(filtered_msg->dn, in.dn); -+ assert_non_null(msg->dn); - -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "distinguishedName", - NULL), -- ldb_dn_get_linearized(in.dn)); -- assert_string_equal(ldb_msg_find_attr_as_string(filtered_msg, -+ ldb_dn_get_linearized(msg->dn)); -+ assert_string_equal(ldb_msg_find_attr_as_string(msg, - "foo", - NULL), - value); -@@ -836,12 +798,12 @@ static void test_filter_attrs_one_attr_matched_star_dn(void **state) - * Test against a record with only one attribute, but returning - * distinguishedName from the list (only) - */ --static void test_filter_attrs_one_attr_matched_dn(void **state) -+static void test_filter_attrs_in_place_one_attr_matched_dn(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {"distinguishedName", NULL}; - -@@ -855,43 +817,36 @@ static void test_filter_attrs_one_attr_matched_dn(void **state) - .num_values = 1, - .values = &value_1 - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 1, -- .elements = &element_1, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 1; -+ msg->elements = &element_1; - -- /* Needed for distinguishedName */ -- filtered_msg->dn = in.dn; -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); -- assert_int_equal(filtered_msg->num_elements, 1); -- -- /* show that ldb_filter_attrs_in_place does not modify in.dn */ -- assert_ptr_equal(filtered_msg->dn, in.dn); -- assert_string_equal(filtered_msg->elements0.name, "distinguishedName"); -- assert_int_equal(filtered_msg->elements0.num_values, 1); -- assert_string_equal(filtered_msg->elements0.values0.data, -- ldb_dn_get_linearized(in.dn)); -+ assert_int_equal(msg->num_elements, 1); -+ -+ assert_non_null(msg->dn); -+ assert_string_equal(msg->elements0.name, "distinguishedName"); -+ assert_int_equal(msg->elements0.num_values, 1); -+ assert_string_equal(msg->elements0.values0.data, -+ ldb_dn_get_linearized(msg->dn)); - } - - /* - * Test against a record with only one attribute, not matching the - * empty attribute list - */ --static void test_filter_attrs_one_attr_empty_list(void **state) -+static void test_filter_attrs_in_place_one_attr_empty_list(void **state) - { - struct ldbtest_ctx *ctx = *state; - int ret; - -- struct ldb_message *filtered_msg = ldb_msg_new(ctx); -+ struct ldb_message *msg = ldb_msg_new(ctx); - - const char *attrs = {NULL}; - -@@ -905,82 +860,78 @@ static void test_filter_attrs_one_attr_empty_list(void **state) - .num_values = 1, - .values = &value_1 - }; -- struct ldb_message in = { -- .dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"), -- .num_elements = 1, -- .elements = &element_1, -- }; - -- assert_non_null(in.dn); -+ assert_non_null(msg); -+ msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); -+ msg->num_elements = 1; -+ msg->elements = &element_1; -+ -+ assert_non_null(msg->dn); -+ msg_add_dn(msg); - -- ret = ldb_filter_attrs_in_place(ctx->ldb, -- &in, -- attrs, -- filtered_msg); -+ ret = ldb_filter_attrs_in_place(msg, attrs); - assert_int_equal(ret, LDB_SUCCESS); -- assert_non_null(filtered_msg); -- assert_int_equal(filtered_msg->num_elements, 0); -- assert_null(filtered_msg->dn); -- assert_null(filtered_msg->elements); -+ assert_int_equal(msg->num_elements, 0); -+ assert_non_null(msg->dn); - } - - int main(int argc, const char **argv) - { - const struct CMUnitTest tests = { - cmocka_unit_test_setup_teardown( -- test_filter_attrs_one_attr_matched, -+ test_filter_attrs_in_place_one_attr_matched, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_one_attr_matched_of_many, -+ test_filter_attrs_in_place_one_attr_matched_of_many, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_two_attr_matched_attrs, -+ test_filter_attrs_in_place_two_attr_matched_attrs, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_two_attr_matched_one_attr, -+ test_filter_attrs_in_place_two_attr_matched_one_attr, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_two_dup_attr_matched_one_attr, -+ test_filter_attrs_in_place_two_dup_attr_matched_one_attr, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_two_dup_attr_matched_dup, -+ test_filter_attrs_in_place_two_dup_attr_matched_dup, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_two_dup_attr_matched_one_of_two, -+ test_filter_attrs_in_place_two_dup_attr_matched_one_of_two, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_two_dup_attr_matched_star, -+ test_filter_attrs_in_place_two_dup_attr_matched_star, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_one_attr_matched_star, -+ test_filter_attrs_in_place_one_attr_matched_star, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_two_attr_matched_star, -+ test_filter_attrs_in_place_two_attr_matched_star, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_one_attr_matched_star_no_dn, -+ test_filter_attrs_in_place_one_attr_matched_star_no_dn, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_one_attr_matched_star_dn, -+ test_filter_attrs_in_place_one_attr_matched_star_dn, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_one_attr_matched_dn, -+ test_filter_attrs_in_place_one_attr_matched_dn, - setup, - teardown), - cmocka_unit_test_setup_teardown( -- test_filter_attrs_one_attr_empty_list, -+ test_filter_attrs_in_place_one_attr_empty_list, - setup, - teardown), - }; --- -2.25.1
View file
_service:tar_scm:backport-0010-CVE-2023-0614.patch
Deleted
@@ -1,257 +0,0 @@ -From 8e84201f508b2893b6ec9383c656cccb08b148ef Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Mon, 27 Feb 2023 10:31:52 +1300 -Subject: PATCH 14/34 CVE-2023-0614 ldb: Make use of - ldb_filter_attrs_in_place() - -Change all uses of ldb_kv_filter_attrs() to use -ldb_filter_attrs_in_place() instead. This function does less work than -its predecessor, and no longer requires the allocation of a second ldb -message. Some of the work is able to be split out into separate -functions that each accomplish a single task, with a purpose to make the -code clearer. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - ldb_key_value/ldb_kv.h | 6 +- - ldb_key_value/ldb_kv_index.c | 27 +++++---- - ldb_key_value/ldb_kv_search.c | 86 ++++++++++++++------------- - 4 files changed, 66 insertions(+), 65 deletions(-) - -diff --git a/ldb_key_value/ldb_kv.h b/ldb_key_value/ldb_kv.h -index ac474b04b4c..7d5a40e76e9 100644 ---- a/ldb_key_value/ldb_kv.h -+++ b/ldb_key_value/ldb_kv.h -@@ -301,10 +301,8 @@ int ldb_kv_search_key(struct ldb_module *module, - const struct ldb_val ldb_key, - struct ldb_message *msg, - unsigned int unpack_flags); --int ldb_kv_filter_attrs(struct ldb_context *ldb, -- const struct ldb_message *msg, -- const char *const *attrs, -- struct ldb_message *filtered_msg); -+int ldb_kv_filter_attrs_in_place(struct ldb_message *msg, -+ const char *const *attrs); - int ldb_kv_search(struct ldb_kv_context *ctx); - - /* -diff --git a/ldb_key_value/ldb_kv_index.c b/ldb_key_value/ldb_kv_index.c -index d70e5f619ef..203266ea8c9 100644 ---- a/ldb_key_value/ldb_kv_index.c -+++ b/ldb_key_value/ldb_kv_index.c -@@ -2264,7 +2264,6 @@ static int ldb_kv_index_filter(struct ldb_kv_private *ldb_kv, - { - struct ldb_context *ldb = ldb_module_get_ctx(ac->module); - struct ldb_message *msg; -- struct ldb_message *filtered_msg; - unsigned int i; - unsigned int num_keys = 0; - uint8_t previous_guid_keyLDB_KV_GUID_KEY_SIZE = {0}; -@@ -2456,27 +2455,31 @@ static int ldb_kv_index_filter(struct ldb_kv_private *ldb_kv, - continue; - } - -- filtered_msg = ldb_msg_new(ac); -- if (filtered_msg == NULL) { -- TALLOC_FREE(keys); -- TALLOC_FREE(msg); -+ ret = ldb_msg_add_distinguished_name(msg); -+ if (ret == -1) { -+ talloc_free(msg); - return LDB_ERR_OPERATIONS_ERROR; - } - -- filtered_msg->dn = talloc_steal(filtered_msg, msg->dn); -- - /* filter the attributes that the user wants */ -- ret = ldb_kv_filter_attrs(ldb, msg, ac->attrs, filtered_msg); -+ ret = ldb_kv_filter_attrs_in_place(msg, ac->attrs); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(keys); -+ talloc_free(msg); -+ return LDB_ERR_OPERATIONS_ERROR; -+ } - -- talloc_free(msg); -+ ldb_msg_shrink_to_fit(msg); - -- if (ret == -1) { -- TALLOC_FREE(filtered_msg); -+ /* Ensure the message elements are all talloc'd. */ -+ ret = ldb_msg_elements_take_ownership(msg); -+ if (ret != LDB_SUCCESS) { - talloc_free(keys); -+ talloc_free(msg); - return LDB_ERR_OPERATIONS_ERROR; - } - -- ret = ldb_module_send_entry(ac->req, filtered_msg, NULL); -+ ret = ldb_module_send_entry(ac->req, msg, NULL); - if (ret != LDB_SUCCESS) { - /* Regardless of success or failure, the msg - * is the callbacks responsiblity, and should -diff --git a/ldb_key_value/ldb_kv_search.c b/ldb_key_value/ldb_kv_search.c -index 46031b99c16..f3333510eab 100644 ---- a/ldb_key_value/ldb_kv_search.c -+++ b/ldb_key_value/ldb_kv_search.c -@@ -292,15 +292,13 @@ int ldb_kv_search_dn1(struct ldb_module *module, - - /* - * filter the specified list of attributes from msg, -- * adding requested attributes, and perhaps all for *, -- * but not the DN to filtered_msg. -+ * adding requested attributes, and perhaps all for *. -+ * The DN will not be added if it is missing. - */ --int ldb_kv_filter_attrs(struct ldb_context *ldb, -- const struct ldb_message *msg, -- const char *const *attrs, -- struct ldb_message *filtered_msg) -+int ldb_kv_filter_attrs_in_place(struct ldb_message *msg, -+ const char *const *attrs) - { -- return ldb_filter_attrs(ldb, msg, attrs, filtered_msg); -+ return ldb_filter_attrs_in_place(msg, attrs); - } - - /* -@@ -313,7 +311,7 @@ static int search_func(_UNUSED_ struct ldb_kv_private *ldb_kv, - { - struct ldb_context *ldb; - struct ldb_kv_context *ac; -- struct ldb_message *msg, *filtered_msg; -+ struct ldb_message *msg; - struct timeval now; - int ret, timeval_cmp; - bool matched; -@@ -410,25 +408,31 @@ static int search_func(_UNUSED_ struct ldb_kv_private *ldb_kv, - return 0; - } - -- filtered_msg = ldb_msg_new(ac); -- if (filtered_msg == NULL) { -- TALLOC_FREE(msg); -+ ret = ldb_msg_add_distinguished_name(msg); -+ if (ret == -1) { -+ talloc_free(msg); - return LDB_ERR_OPERATIONS_ERROR; - } - -- filtered_msg->dn = talloc_steal(filtered_msg, msg->dn); -- - /* filter the attributes that the user wants */ -- ret = ldb_kv_filter_attrs(ldb, msg, ac->attrs, filtered_msg); -- talloc_free(msg); -+ ret = ldb_kv_filter_attrs_in_place(msg, ac->attrs); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(msg); -+ ac->error = LDB_ERR_OPERATIONS_ERROR; -+ return -1; -+ } - -- if (ret == -1) { -- TALLOC_FREE(filtered_msg); -+ ldb_msg_shrink_to_fit(msg); -+ -+ /* Ensure the message elements are all talloc'd. */ -+ ret = ldb_msg_elements_take_ownership(msg); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(msg); - ac->error = LDB_ERR_OPERATIONS_ERROR; - return -1; - } - -- ret = ldb_module_send_entry(ac->req, filtered_msg, NULL); -+ ret = ldb_module_send_entry(ac->req, msg, NULL); - if (ret != LDB_SUCCESS) { - ac->request_terminated = true; - /* the callback failed, abort the operation */ -@@ -491,7 +495,7 @@ static int ldb_kv_search_full(struct ldb_kv_context *ctx) - static int ldb_kv_search_and_return_base(struct ldb_kv_private *ldb_kv, - struct ldb_kv_context *ctx) - { -- struct ldb_message *msg, *filtered_msg; -+ struct ldb_message *msg; - struct ldb_context *ldb = ldb_module_get_ctx(ctx->module); - const char *dn_linearized; - const char *msg_dn_linearized; -@@ -549,12 +553,6 @@ static int ldb_kv_search_and_return_base(struct ldb_kv_private *ldb_kv, - dn_linearized = ldb_dn_get_linearized(ctx->base); - msg_dn_linearized = ldb_dn_get_linearized(msg->dn); - -- filtered_msg = ldb_msg_new(ctx); -- if (filtered_msg == NULL) { -- talloc_free(msg); -- return LDB_ERR_OPERATIONS_ERROR; -- } -- - if (strcmp(dn_linearized, msg_dn_linearized) == 0) { - /* - * If the DN is exactly the same string, then -@@ -562,36 +560,42 @@ static int ldb_kv_search_and_return_base(struct ldb_kv_private *ldb_kv, - * returned result, as it has already been - * casefolded - */ -- filtered_msg->dn = ldb_dn_copy(filtered_msg, ctx->base); -+ struct ldb_dn *dn = ldb_dn_copy(msg, ctx->base); -+ if (dn != NULL) { -+ msg->dn = dn; -+ } - } - -- /* -- * If the ldb_dn_copy() failed, or if we did not choose that -- * optimisation (filtered_msg is zeroed at allocation), -- * steal the one from the unpack -- */ -- if (filtered_msg->dn == NULL) { -- filtered_msg->dn = talloc_steal(filtered_msg, msg->dn); -+ ret = ldb_msg_add_distinguished_name(msg); -+ if (ret == -1) { -+ talloc_free(msg); -+ return LDB_ERR_OPERATIONS_ERROR; - } - - /* - * filter the attributes that the user wants. - */ -- ret = ldb_kv_filter_attrs(ldb, msg, ctx->attrs, filtered_msg); -- if (ret == -1) { -+ ret = ldb_kv_filter_attrs_in_place(msg, ctx->attrs); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(msg); -+ return LDB_ERR_OPERATIONS_ERROR; -+ } -+ -+ ldb_msg_shrink_to_fit(msg); -+ -+ /* Ensure the message elements are all talloc'd. */ -+ ret = ldb_msg_elements_take_ownership(msg); -+ if (ret != LDB_SUCCESS) { - talloc_free(msg); -- filtered_msg = NULL; - return LDB_ERR_OPERATIONS_ERROR; - } - - /* -- * Remove any extended components possibly copied in from -- * msg->dn, we just want the casefold components -+ * Remove any extended components, we just want the casefold components - */ -- ldb_dn_remove_extended_components(filtered_msg->dn); -- talloc_free(msg); -+ ldb_dn_remove_extended_components(msg->dn); - -- ret = ldb_module_send_entry(ctx->req, filtered_msg, NULL); -+ ret = ldb_module_send_entry(ctx->req, msg, NULL); - if (ret != LDB_SUCCESS) { - /* Regardless of success or failure, the msg - * is the callbacks responsiblity, and should --- -2.25.1
View file
_service:tar_scm:backport-0011-CVE-2023-0614.patch
Deleted
@@ -1,66 +0,0 @@ -From b23fb132e63a6d3d791469614593c43906686ac9 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:31:54 +1300 -Subject: PATCH 20/34 CVE-2023-0614 ldb: Add ldb_parse_tree_get_attr() - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_parse.c | 25 +++++++++++++++++++++++++ - include/ldb_module.h | 3 +++ - 2 files changed, 28 insertions(+) - -diff --git a/common/ldb_parse.c b/common/ldb_parse.c -index f0045ad2093..2d102ff750e 100644 ---- a/common/ldb_parse.c -+++ b/common/ldb_parse.c -@@ -997,3 +997,28 @@ struct ldb_parse_tree *ldb_parse_tree_copy_shallow(TALLOC_CTX *mem_ctx, - - return nt; - } -+ -+/* Get the attribute (if any) associated with the top node of a parse tree. */ -+const char *ldb_parse_tree_get_attr(const struct ldb_parse_tree *tree) -+{ -+ switch (tree->operation) { -+ case LDB_OP_AND: -+ case LDB_OP_OR: -+ case LDB_OP_NOT: -+ return NULL; -+ case LDB_OP_EQUALITY: -+ return tree->u.equality.attr; -+ case LDB_OP_SUBSTRING: -+ return tree->u.substring.attr; -+ case LDB_OP_GREATER: -+ case LDB_OP_LESS: -+ case LDB_OP_APPROX: -+ return tree->u.comparison.attr; -+ case LDB_OP_PRESENT: -+ return tree->u.present.attr; -+ case LDB_OP_EXTENDED: -+ return tree->u.extended.attr; -+ } -+ -+ return NULL; -+} -diff --git a/include/ldb_module.h b/include/ldb_module.h -index 4ae381ba5be..bd369ed9512 100644 ---- a/include/ldb_module.h -+++ b/include/ldb_module.h -@@ -490,6 +490,9 @@ int ldb_init_module(const char *version); - */ - bool ldb_dn_replace_components(struct ldb_dn *dn, struct ldb_dn *new_dn); - -+/* Get the attribute (if any) associated with the top node of a parse tree. */ -+const char *ldb_parse_tree_get_attr(const struct ldb_parse_tree *tree); -+ - /* - walk a parse tree, calling the provided callback on each node - */ --- -2.25.1
View file
_service:tar_scm:backport-0012-CVE-2023-0614.patch
Deleted
@@ -1,231 +0,0 @@ -From f87af853e2db99269acea572dcc109bc6f797aa9 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:34:29 +1300 -Subject: PATCH 24/34 CVE-2023-0614 ldb: Prevent disclosure of confidential - attributes - -Add a hook, acl_redact_msg_for_filter(), in the aclread module, that -marks inaccessible any message elements used by an LDAP search filter -that the user has no right to access. Make the various ldb_match_*() -functions check whether message elements are accessible, and refuse to -match any that are not. Remaining message elements, not mentioned in the -search filter, are checked in aclread_callback(), and any inaccessible -elements are removed at this point. - -Certain attributes, namely objectClass, distinguishedName, name, and -objectGUID, are always present, and hence the presence of said -attributes is always allowed to be checked in a search filter. This -corresponds with the behaviour of Windows. - -Further, we unconditionally allow the attributes isDeleted and -isRecycled in a check for presence or equality. Windows is not known to -make this special exception, but it seems mostly harmless, and should -mitigate the performance impact on searches made by the show_deleted -module. - -As a result of all these changes, our behaviour regarding confidential -attributes happens to match Windows more closely. For the test in -confidential_attr.py, we can now model our attribute handling with -DC_MODE_RETURN_ALL, which corresponds to the behaviour exhibited by -Windows. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Signed-off-by: Andrew Bartlett <abartlet@samba.org> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -abartlet@samba.org adapted due to Samba 4.17 and lower -not having the patches for CVE-2020-25720 - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_match.c | 37 + - include/ldb_module.h | 11 + - include/ldb_private.h | 5 + - ldb_key_value/ldb_kv_index.c | 8 + - ldb_key_value/ldb_kv_search.c | 15 + - 12 files changed, 672 insertions(+), 455 deletions(-) - delete mode 100644 selftest/knownfail.d/confidential-attr-timing - -diff --git a/common/ldb_match.c b/common/ldb_match.c -index 2f4d41f3441..17314f1b9ca 100644 ---- a/common/ldb_match.c -+++ b/common/ldb_match.c -@@ -98,6 +98,11 @@ static int ldb_match_present(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -+ if (ldb_msg_element_is_inaccessible(el)) { -+ *matched = false; -+ return LDB_SUCCESS; -+ } -+ - a = ldb_schema_attribute_by_name(ldb, el->name); - if (!a) { - return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -@@ -139,6 +144,11 @@ static int ldb_match_comparison(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -+ if (ldb_msg_element_is_inaccessible(el)) { -+ *matched = false; -+ return LDB_SUCCESS; -+ } -+ - a = ldb_schema_attribute_by_name(ldb, el->name); - if (!a) { - return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -@@ -209,6 +219,11 @@ static int ldb_match_equality(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -+ if (ldb_msg_element_is_inaccessible(el)) { -+ *matched = false; -+ return LDB_SUCCESS; -+ } -+ - a = ldb_schema_attribute_by_name(ldb, el->name); - if (a == NULL) { - return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -@@ -370,6 +385,11 @@ static int ldb_match_substring(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -+ if (ldb_msg_element_is_inaccessible(el)) { -+ *matched = false; -+ return LDB_SUCCESS; -+ } -+ - for (i = 0; i < el->num_values; i++) { - int ret; - ret = ldb_wildcard_compare(ldb, tree, el->valuesi, matched); -@@ -443,6 +463,11 @@ static int ldb_match_bitmask(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -+ if (ldb_msg_element_is_inaccessible(el)) { -+ *matched = false; -+ return LDB_SUCCESS; -+ } -+ - for (i=0;i<el->num_values;i++) { - int ret; - struct ldb_val *v = &el->valuesi; -@@ -741,3 +766,15 @@ int ldb_register_extended_match_rule(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -+int ldb_register_redact_callback(struct ldb_context *ldb, -+ ldb_redact_fn redact_fn, -+ struct ldb_module *module) -+{ -+ if (ldb->redact.callback != NULL) { -+ return LDB_ERR_ENTRY_ALREADY_EXISTS; -+ } -+ -+ ldb->redact.callback = redact_fn; -+ ldb->redact.module = module; -+ return LDB_SUCCESS; -+} -diff --git a/include/ldb_module.h b/include/ldb_module.h -index bd369ed9512..0f14b1ad346 100644 ---- a/include/ldb_module.h -+++ b/include/ldb_module.h -@@ -102,6 +102,12 @@ struct ldb_module; - */ - #define LDB_FLAG_INTERNAL_SHARED_VALUES 0x200 - -+/* -+ * this attribute has been access checked. We know the user has the right to -+ * view it. Used internally in Samba aclread module. -+ */ -+#define LDB_FLAG_INTERNAL_ACCESS_CHECKED 0x400 -+ - /* an extended match rule that always fails to match */ - #define SAMBA_LDAP_MATCH_ALWAYS_FALSE "1.3.6.1.4.1.7165.4.5.1" - -@@ -520,6 +526,11 @@ void ldb_msg_element_mark_inaccessible(struct ldb_message_element *el); - bool ldb_msg_element_is_inaccessible(const struct ldb_message_element *el); - void ldb_msg_remove_inaccessible(struct ldb_message *msg); - -+typedef int (*ldb_redact_fn)(struct ldb_module *, struct ldb_request *, struct ldb_message *); -+int ldb_register_redact_callback(struct ldb_context *ldb, -+ ldb_redact_fn redact_fn, -+ struct ldb_module *module); -+ - /* - * these pack/unpack functions are exposed in the library for use by - * ldb tools like ldbdump and for use in tests, -diff --git a/include/ldb_private.h b/include/ldb_private.h -index ca43817d07a..b0a42f6421c 100644 ---- a/include/ldb_private.h -+++ b/include/ldb_private.h -@@ -119,6 +119,11 @@ struct ldb_context { - struct ldb_extended_match_entry *prev, *next; - } *extended_match_rules; - -+ struct { -+ struct ldb_module *module; -+ ldb_redact_fn callback; -+ } redact; -+ - /* custom utf8 functions */ - struct ldb_utf8_fns utf8_fns; - -diff --git a/ldb_key_value/ldb_kv_index.c b/ldb_key_value/ldb_kv_index.c -index 203266ea8c9..163052fecf7 100644 ---- a/ldb_key_value/ldb_kv_index.c -+++ b/ldb_key_value/ldb_kv_index.c -@@ -2428,6 +2428,14 @@ static int ldb_kv_index_filter(struct ldb_kv_private *ldb_kv, - return LDB_ERR_OPERATIONS_ERROR; - } - -+ if (ldb->redact.callback != NULL) { -+ ret = ldb->redact.callback(ldb->redact.module, ac->req, msg); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(msg); -+ return ret; -+ } -+ } -+ - /* - * We trust the index for LDB_SCOPE_ONELEVEL - * unless the index key has been truncated. -diff --git a/ldb_key_value/ldb_kv_search.c b/ldb_key_value/ldb_kv_search.c -index f3333510eab..d187ba223e1 100644 ---- a/ldb_key_value/ldb_kv_search.c -+++ b/ldb_key_value/ldb_kv_search.c -@@ -395,6 +395,14 @@ static int search_func(_UNUSED_ struct ldb_kv_private *ldb_kv, - } - } - -+ if (ldb->redact.callback != NULL) { -+ ret = ldb->redact.callback(ldb->redact.module, ac->req, msg); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(msg); -+ return ret; -+ } -+ } -+ - /* see if it matches the given expression */ - ret = ldb_match_msg_error(ldb, msg, - ac->tree, ac->base, ac->scope, &matched); -@@ -530,6 +538,13 @@ static int ldb_kv_search_and_return_base(struct ldb_kv_private *ldb_kv, - return ret; - } - -+ if (ldb->redact.callback != NULL) { -+ ret = ldb->redact.callback(ldb->redact.module, ctx->req, msg); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(msg); -+ return ret; -+ } -+ } - - /* - * We use this, not ldb_match_msg_error() as we know ---
View file
_service:tar_scm:backport-0013-CVE-2023-0614.patch
Deleted
@@ -1,130 +0,0 @@ -From 94efa3fc3053a623a7a5c3a4a6428356bc334152 Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Tue, 14 Feb 2023 13:17:24 +1300 -Subject: PATCH 27/34 CVE-2023-0614 ldb: Centralise checking for inaccessible - matches - -This makes it less likely that we forget to handle a case. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_match.c | 56 +++++++++++++++++------------- - 2 files changed, 31 insertions(+), 30 deletions(-) - -diff --git a/common/ldb_match.c b/common/ldb_match.c -index 17314f1b9ca..645cb695ef1 100644 ---- a/common/ldb_match.c -+++ b/common/ldb_match.c -@@ -98,11 +98,6 @@ static int ldb_match_present(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -- if (ldb_msg_element_is_inaccessible(el)) { -- *matched = false; -- return LDB_SUCCESS; -- } -- - a = ldb_schema_attribute_by_name(ldb, el->name); - if (!a) { - return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -@@ -144,11 +139,6 @@ static int ldb_match_comparison(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -- if (ldb_msg_element_is_inaccessible(el)) { -- *matched = false; -- return LDB_SUCCESS; -- } -- - a = ldb_schema_attribute_by_name(ldb, el->name); - if (!a) { - return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -@@ -219,11 +209,6 @@ static int ldb_match_equality(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -- if (ldb_msg_element_is_inaccessible(el)) { -- *matched = false; -- return LDB_SUCCESS; -- } -- - a = ldb_schema_attribute_by_name(ldb, el->name); - if (a == NULL) { - return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; -@@ -385,11 +370,6 @@ static int ldb_match_substring(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -- if (ldb_msg_element_is_inaccessible(el)) { -- *matched = false; -- return LDB_SUCCESS; -- } -- - for (i = 0; i < el->num_values; i++) { - int ret; - ret = ldb_wildcard_compare(ldb, tree, el->valuesi, matched); -@@ -463,11 +443,6 @@ static int ldb_match_bitmask(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -- if (ldb_msg_element_is_inaccessible(el)) { -- *matched = false; -- return LDB_SUCCESS; -- } -- - for (i=0;i<el->num_values;i++) { - int ret; - struct ldb_val *v = &el->valuesi; -@@ -556,6 +531,26 @@ static int ldb_match_extended(struct ldb_context *ldb, - &tree->u.extended.value, matched); - } - -+static bool ldb_must_suppress_match(const struct ldb_message *msg, -+ const struct ldb_parse_tree *tree) -+{ -+ const char *attr = NULL; -+ struct ldb_message_element *el = NULL; -+ -+ attr = ldb_parse_tree_get_attr(tree); -+ if (attr == NULL) { -+ return false; -+ } -+ -+ /* find the message element */ -+ el = ldb_msg_find_element(msg, attr); -+ if (el == NULL) { -+ return false; -+ } -+ -+ return ldb_msg_element_is_inaccessible(el); -+} -+ - /* - Check if a particular message will match the given filter - -@@ -580,6 +575,17 @@ int ldb_match_message(struct ldb_context *ldb, - return LDB_SUCCESS; - } - -+ /* -+ * Suppress matches on confidential attributes (handled -+ * manually in extended matches as these can do custom things -+ * like read other parts of the DB or other attributes). -+ */ -+ if (tree->operation != LDB_OP_EXTENDED) { -+ if (ldb_must_suppress_match(msg, tree)) { -+ return LDB_SUCCESS; -+ } -+ } -+ - switch (tree->operation) { - case LDB_OP_AND: - for (i=0;i<tree->u.list.num_elements;i++) { --- -2.25.1
View file
_service:tar_scm:backport-0014-CVE-2023-0614.patch
Deleted
@@ -1,155 +0,0 @@ -From a0c888bd0ed2ec5b4d84f9df241bebd5d428818c Mon Sep 17 00:00:00 2001 -From: Joseph Sutton <josephsutton@catalyst.net.nz> -Date: Fri, 3 Mar 2023 17:35:55 +1300 -Subject: PATCH 28/34 CVE-2023-0614 ldb: Filter on search base before - redacting message - -Redaction may be expensive if we end up needing to fetch a security -descriptor to verify rights to an attribute. Checking the search scope -is probably cheaper, so do that first. - -BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 - -Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> -Reviewed-by: Andrew Bartlett <abartlet@samba.org> - -Conflict: NA -Reference: https://attachments.samba.org/attachment.cgi?id=17821 ---- - common/ldb_match.c | 8 +++--- - include/ldb_private.h | 8 ++++++ - ldb_key_value/ldb_kv_index.c | 40 +++++++++++++++------------ - ldb_key_value/ldb_kv_search.c | 14 ++++++++-- - 4 files changed, 47 insertions(+), 23 deletions(-) - -diff --git a/common/ldb_match.c b/common/ldb_match.c -index 645cb695ef1..8e27ecbe723 100644 ---- a/common/ldb_match.c -+++ b/common/ldb_match.c -@@ -38,10 +38,10 @@ - /* - check if the scope matches in a search result - */ --static int ldb_match_scope(struct ldb_context *ldb, -- struct ldb_dn *base, -- struct ldb_dn *dn, -- enum ldb_scope scope) -+int ldb_match_scope(struct ldb_context *ldb, -+ struct ldb_dn *base, -+ struct ldb_dn *dn, -+ enum ldb_scope scope) - { - int ret = 0; - -diff --git a/include/ldb_private.h b/include/ldb_private.h -index b0a42f6421c..5e29de34f79 100644 ---- a/include/ldb_private.h -+++ b/include/ldb_private.h -@@ -322,6 +322,14 @@ int ldb_match_message(struct ldb_context *ldb, - const struct ldb_parse_tree *tree, - enum ldb_scope scope, bool *matched); - -+/* -+ check if the scope matches in a search result -+*/ -+int ldb_match_scope(struct ldb_context *ldb, -+ struct ldb_dn *base, -+ struct ldb_dn *dn, -+ enum ldb_scope scope); -+ - /* Reallocate elements to drop any excess capacity. */ - void ldb_msg_shrink_to_fit(struct ldb_message *msg); - -diff --git a/ldb_key_value/ldb_kv_index.c b/ldb_key_value/ldb_kv_index.c -index 163052fecf7..aac0913f431 100644 ---- a/ldb_key_value/ldb_kv_index.c -+++ b/ldb_key_value/ldb_kv_index.c -@@ -2428,31 +2428,37 @@ static int ldb_kv_index_filter(struct ldb_kv_private *ldb_kv, - return LDB_ERR_OPERATIONS_ERROR; - } - -- if (ldb->redact.callback != NULL) { -- ret = ldb->redact.callback(ldb->redact.module, ac->req, msg); -- if (ret != LDB_SUCCESS) { -- talloc_free(msg); -- return ret; -- } -- } -- - /* - * We trust the index for LDB_SCOPE_ONELEVEL - * unless the index key has been truncated. - * - * LDB_SCOPE_BASE is not passed in by our only caller. - */ -- if (ac->scope == LDB_SCOPE_ONELEVEL && -- ldb_kv->cache->one_level_indexes && -- scope_one_truncation == KEY_NOT_TRUNCATED) { -- ret = ldb_match_message(ldb, msg, ac->tree, -- ac->scope, &matched); -- } else { -- ret = ldb_match_msg_error(ldb, msg, -- ac->tree, ac->base, -- ac->scope, &matched); -+ if (ac->scope != LDB_SCOPE_ONELEVEL || -+ !ldb_kv->cache->one_level_indexes || -+ scope_one_truncation != KEY_NOT_TRUNCATED) -+ { -+ /* -+ * The redaction callback may be expensive to call if it -+ * fetches a security descriptor. Check the DN early and -+ * bail out if it doesn't match the base. -+ */ -+ if (!ldb_match_scope(ldb, ac->base, msg->dn, ac->scope)) { -+ talloc_free(msg); -+ continue; -+ } -+ } -+ -+ if (ldb->redact.callback != NULL) { -+ ret = ldb->redact.callback(ldb->redact.module, ac->req, msg); -+ if (ret != LDB_SUCCESS) { -+ talloc_free(msg); -+ return ret; -+ } - } - -+ ret = ldb_match_message(ldb, msg, ac->tree, -+ ac->scope, &matched); - if (ret != LDB_SUCCESS) { - talloc_free(keys); - talloc_free(msg); -diff --git a/ldb_key_value/ldb_kv_search.c b/ldb_key_value/ldb_kv_search.c -index d187ba223e1..27f68caef01 100644 ---- a/ldb_key_value/ldb_kv_search.c -+++ b/ldb_key_value/ldb_kv_search.c -@@ -395,6 +395,16 @@ static int search_func(_UNUSED_ struct ldb_kv_private *ldb_kv, - } - } - -+ /* -+ * The redaction callback may be expensive to call if it fetches a -+ * security descriptor. Check the DN early and bail out if it doesn't -+ * match the base. -+ */ -+ if (!ldb_match_scope(ldb, ac->base, msg->dn, ac->scope)) { -+ talloc_free(msg); -+ return 0; -+ } -+ - if (ldb->redact.callback != NULL) { - ret = ldb->redact.callback(ldb->redact.module, ac->req, msg); - if (ret != LDB_SUCCESS) { -@@ -404,8 +414,8 @@ static int search_func(_UNUSED_ struct ldb_kv_private *ldb_kv, - } - - /* see if it matches the given expression */ -- ret = ldb_match_msg_error(ldb, msg, -- ac->tree, ac->base, ac->scope, &matched); -+ ret = ldb_match_message(ldb, msg, -+ ac->tree, ac->scope, &matched); - if (ret != LDB_SUCCESS) { - talloc_free(msg); - ac->error = LDB_ERR_OPERATIONS_ERROR; --- -2.25.1
View file
_service:tar_scm:ldb-2.6.1.tar.asc
Deleted
@@ -1,11 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQEzBAABCgAdFiEEkUejOXGVGO6QEby1R5ORYRMIQCUFAmLhN68ACgkQR5ORYRMI -QCWqKAgAswqnQft1oEc4c2DIJIF9jcXfLeOz4czUndBu5st6h3KVqZDCWjUAdPdX -BrYV+6cLTtDSjH0nQocnvtwm3AbVPxwukBglVtEuq0DU4fk8DptzRJvyLy2vU5VP -sKQQ+uwgYSWnKeds0PjPNMxpompeurDbQ1n4XgW4BzRQpK4Gvg6ZXBGg+q5nKht2 -+PfQTVuaPi4O6gUWfxDbLBBPNDf97gz21Sa8pS1K3sspcPQJzMNumXs/d9LBhU1G -BaDanganpN1Ru724J18jvZ8NEogldHuSk29DljreHiiWY2hEVlp5rZDTgrlYOP50 -b9kfHAnpBcHhQZlLf2/hponIccDo6A== -=ccfS ------END PGP SIGNATURE-----
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_liboop.c
Deleted
@@ -1,292 +0,0 @@ -/* - Unix SMB/CIFS implementation. - main select loop and event handling - wrapper for http://git.lysator.liu.se/liboop/ - - Copyright (C) Stefan Metzmacher 2005 - - ** NOTE! The following LGPL license applies to the tevent - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "events.h" -#include "events_internal.h" - -#include <oop.h> - -/* - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - NOTE: this code compiles fine, but is completely *UNTESTED* - and is only committed as an example - - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*/ - -static int oop_event_context_destructor(struct tevent_context *ev) -{ - oop_source_sys *oop_sys = ev->additional_data; - - oop_sys_delete(oop_sys); - - return 0; -} - -/* - create a oop_event_context structure. -*/ -static int oop_event_context_init(struct tevent_context *ev, void *private_data) -{ - oop_source_sys *oop_sys = private_data; - - if (!oop_sys) { - oop_sys = oop_sys_new(); - if (!oop_sys) { - return -1; - } - - talloc_set_destructor(ev, oop_event_context_destructor); - } - - ev->additional_data = oop_sys; - - return 0; -} - -static void *oop_event_fd_handler(oop_source *oop, int fd, oop_event oop_type, void *ptr) -{ - struct tevent_fd *fde = ptr; - - if (fd != fde->fd) return OOP_ERROR; - - switch(oop_type) { - case OOP_READ: - fde->handler(fde->event_ctx, fde, EVENT_FD_READ, fde->private_data); - return OOP_CONTINUE; - case OOP_WRITE: - fde->handler(fde->event_ctx, fde, EVENT_FD_WRITE, fde->private_data); - return OOP_CONTINUE; - case OOP_EXCEPTION: - return OOP_ERROR; - case OOP_NUM_EVENTS: - return OOP_ERROR; - } - - return OOP_ERROR; -} - -/* - destroy an fd_event -*/ -static int oop_event_fd_destructor(struct tevent_fd *fde) -{ - struct tevent_context *ev = fde->event_ctx; - oop_source_sys *oop_sys = ev->additional_data; - oop_source *oop = oop_sys_source(oop_sys); - - if (fde->flags & EVENT_FD_READ) - oop->cancel_fd(oop, fde->fd, OOP_READ); - if (fde->flags & EVENT_FD_WRITE) - oop->cancel_fd(oop, fde->fd, OOP_WRITE); - - if (fde->flags & EVENT_FD_AUTOCLOSE) { - close(fde->fd); - fde->fd = -1; - } - - return 0; -} - -/* - add a fd based event - return NULL on failure (memory allocation error) -*/ -static struct tevent_fd *oop_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - event_fd_handler_t handler, - void *private_data) -{ - struct tevent_fd *fde; - oop_source_sys *oop_sys = ev->additional_data; - oop_source *oop = oop_sys_source(oop_sys); - - fde = talloc(mem_ctx?mem_ctx:ev, struct tevent_fd); - if (!fde) return NULL; - - fde->event_ctx = ev; - fde->fd = fd; - fde->flags = flags; - fde->handler = handler; - fde->private_data = private_data; - fde->additional_flags = 0; - fde->additional_data = NULL; - - if (fde->flags & EVENT_FD_READ) - oop->on_fd(oop, fde->fd, OOP_READ, oop_event_fd_handler, fde); - if (fde->flags & EVENT_FD_WRITE) - oop->on_fd(oop, fde->fd, OOP_WRITE, oop_event_fd_handler, fde); - - talloc_set_destructor(fde, oop_event_fd_destructor); - - return fde; -} - -/* - return the fd event flags -*/ -static uint16_t oop_event_get_fd_flags(struct tevent_fd *fde) -{ - return fde->flags; -} - -/* - set the fd event flags -*/ -static void oop_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags) -{ - oop_source_sys *oop_sys; - oop_source *oop; - - oop_sys = fde->event_ctx->additional_data; - oop = oop_sys_source(oop_sys); - - if ((fde->flags & EVENT_FD_READ)&&(!(flags & EVENT_FD_READ))) - oop->cancel_fd(oop, fde->fd, OOP_READ); - - if ((!(fde->flags & EVENT_FD_READ))&&(flags & EVENT_FD_READ)) - oop->on_fd(oop, fde->fd, OOP_READ, oop_event_fd_handler, fde); - - if ((fde->flags & EVENT_FD_WRITE)&&(!(flags & EVENT_FD_WRITE))) - oop->cancel_fd(oop, fde->fd, OOP_WRITE); - - if ((!(fde->flags & EVENT_FD_WRITE))&&(flags & EVENT_FD_WRITE)) - oop->on_fd(oop, fde->fd, OOP_WRITE, oop_event_fd_handler, fde); - - fde->flags = flags; -} - -static int oop_event_timed_destructor(struct tevent_timer *te); - -static int oop_event_timed_deny_destructor(struct tevent_timer *te) -{ - return -1; -} - -static void *oop_event_timed_handler(oop_source *oop, struct timeval t, void *ptr) -{ - struct tevent_timer *te = ptr; - - /* deny the handler to free the event */ - talloc_set_destructor(te, oop_event_timed_deny_destructor); - te->handler(te->event_ctx, te, t, te->private_data); - - talloc_set_destructor(te, oop_event_timed_destructor); - talloc_free(te); - - return OOP_CONTINUE; -} - -/* - destroy a timed event -*/ -static int oop_event_timed_destructor(struct tevent_timer *te) -{ - struct tevent_context *ev = te->event_ctx; - oop_source_sys *oop_sys = ev->additional_data; - oop_source *oop = oop_sys_source(oop_sys); - - oop->cancel_time(oop, te->next_event, oop_event_timed_handler, te); - - return 0; -} - -/* - add a timed event - return NULL on failure (memory allocation error) -*/ -static struct tevent_timer *oop_event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - struct timeval next_event, - event_timed_handler_t handler, - void *private_data) -{ - oop_source_sys *oop_sys = ev->additional_data; - oop_source *oop = oop_sys_source(oop_sys); - struct tevent_timer *te; - - te = talloc(mem_ctx?mem_ctx:ev, struct tevent_timer); - if (te == NULL) return NULL; - - te->event_ctx = ev; - te->next_event = next_event; - te->handler = handler; - te->private_data = private_data; - te->additional_data = NULL; - - oop->on_time(oop, te->next_event, oop_event_timed_handler, te); - - talloc_set_destructor(te, oop_event_timed_destructor); - - return te; -} - -/* - do a single event loop using the events defined in ev -*/ -static int oop_event_loop_once(struct tevent_context *ev) -{ - void *oop_ret; - oop_source_sys *oop_sys = ev->additional_data; - - oop_ret = oop_sys_run_once(oop_sys); - if (oop_ret == OOP_CONTINUE) { - return 0; - } - - return -1; -} - -/* - return on failure or (with 0) if all fd events are removed -*/ -static int oop_event_loop_wait(struct tevent_context *ev) -{ - void *oop_ret; - oop_source_sys *oop_sys = ev->additional_data; - - oop_ret = oop_sys_run(oop_sys); - if (oop_ret == OOP_CONTINUE) { - return 0; - } - - return -1; -} - -static const struct event_ops event_oop_ops = { - .context_init = oop_event_context_init, - .add_fd = oop_event_add_fd, - .get_fd_flags = oop_event_get_fd_flags, - .set_fd_flags = oop_event_set_fd_flags, - .add_timer = oop_event_add_timed, - .add_signal = common_event_add_signal, - .loop_once = oop_event_loop_once, - .loop_wait = oop_event_loop_wait, -}; - -const struct event_ops *event_liboop_get_ops(void) -{ - return &event_oop_ops; -}
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_port.c
Deleted
@@ -1,804 +0,0 @@ -/* - Unix SMB/CIFS implementation. - - Main select loop and event handling - Solaris port implementation. - Losely based on the Linux epoll backend. - - Copyright (C) Jeremy Allison 2013 - - ** NOTE! The following LGPL license applies to the tevent - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see <http://www.gnu.org/licenses/>. -*/ - -#include "replace.h" -#include "system/filesys.h" -#include "system/select.h" -#include "tevent.h" -#include "tevent_internal.h" -#include "tevent_util.h" - -struct port_associate_vals { - struct port_associate_vals *prev, *next; - struct port_event_context *port_ev; - int events; - struct tevent_fd *fde; - bool associated_event; -}; - -struct port_event_context { - /* a pointer back to the generic event_context */ - struct tevent_context *ev; - - /* This is the handle from port_create */ - int port_fd; - - pid_t pid; - - /* List of associations. */ - struct port_associate_vals *po_vals; -}; - -#define PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION (1<<0) -#define PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR (1<<1) -#define PORT_ADDITIONAL_FD_FLAG_GOT_ERROR (1<<2) -#define PORT_ADDITIONAL_FD_FLAG_HAS_MPX (1<<3) - -/* - Map from TEVENT_FD_* to POLLIN/POLLOUT -*/ -static int port_map_flags(uint16_t flags) -{ - int ret = 0; - if (flags & TEVENT_FD_READ) ret |= (POLLIN | POLLERR | POLLHUP); - if (flags & TEVENT_FD_WRITE) ret |= (POLLOUT | POLLERR | POLLHUP); - return ret; -} - -/* - Free the port fd -*/ -static int port_ctx_destructor(struct port_event_context *port_ev) -{ - close(port_ev->port_fd); - port_ev->port_fd = -1; - return 0; -} - -/* - Init the port fd -*/ -static int port_init_ctx(struct port_event_context *port_ev) -{ - port_ev->port_fd = port_create(); - if (port_ev->port_fd == -1) { - tevent_debug(port_ev->ev, TEVENT_DEBUG_FATAL, - "Failed to create port handle.\n"); - return -1; - } - - if (!ev_set_close_on_exec(port_ev->port_fd)) { - tevent_debug(port_ev->ev, TEVENT_DEBUG_WARNING, - "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); - } - - port_ev->pid = tevent_cached_getpid(); - talloc_set_destructor(port_ev, port_ctx_destructor); - - return 0; -} - -/* - Functions to manage the lower level cache of associated events on the port_fd. -*/ - -static int port_associate_vals_destructor(struct port_associate_vals *val) -{ - DLIST_REMOVE(val->port_ev->po_vals, val); - memset(val, '\0', sizeof(struct port_associate_vals)); - return 0; -} - -/* - * TODO: As the port_association is per-fde, it should be possible to store it - * directly in fde->additional_data, alongside any multiplexed-fde. That way the - * lookup on store and delete would be avoided, and associate_all_events() could - * walk the ev->fd_events list. - */ -static bool store_port_association(struct port_event_context *port_ev, - struct tevent_fd *fde, - int events) -{ - struct port_associate_vals *val; - - for (val = port_ev->po_vals; val; val = val->next) { - if (val->fde->fd == fde->fd) { - /* Association already attached to fd. */ - if (val->events != events) { - val->events = events; - val->associated_event = false; - } - return true; - } - } - - val = talloc_zero(port_ev, struct port_associate_vals); - if (val == NULL) { - return false; - } - - val->port_ev = port_ev; - val->fde = fde; - val->events = events; - val->associated_event = false; - - DLIST_ADD(port_ev->po_vals, val); - talloc_set_destructor(val, port_associate_vals_destructor); - - return true; -} - -static void delete_port_association(struct port_event_context *port_ev, - struct tevent_fd *fde) -{ - struct port_associate_vals *val; - - for (val = port_ev->po_vals; val; val = val->next) { - if (val->fde == fde) { - if (val->associated_event) { - (void)port_dissociate(port_ev->port_fd, - PORT_SOURCE_FD, - fde->fd); - } - talloc_free(val); - return; - } - } -} - -static int associate_all_events(struct port_event_context *port_ev) -{ - struct port_associate_vals *val; - - for (val = port_ev->po_vals; val; val = val->next) { - int ret; - if (val->associated_event) { - continue; - } - ret = port_associate(port_ev->port_fd, - PORT_SOURCE_FD, - (uintptr_t)val->fde->fd, - val->events, - (void *)val); - if (ret != 0) { - return -1; - } - val->associated_event = true; - } - return 0; -} - -static int port_update_event(struct port_event_context *port_ev, struct tevent_fd *fde); - -/* - Reopen the port handle when our pid changes. - */ -static int port_check_reopen(struct port_event_context *port_ev) -{ - struct tevent_fd *fde; - pid_t pid = tevent_cached_getpid(); - - if (port_ev->pid == pid) { - return 0; - } - - close(port_ev->port_fd); - port_ev->port_fd = port_create(); - if (port_ev->port_fd == -1) { - tevent_debug(port_ev->ev, TEVENT_DEBUG_FATAL, - "port_create() failed"); - return -1; - } - - if (!ev_set_close_on_exec(port_ev->port_fd)) { - tevent_debug(port_ev->ev, TEVENT_DEBUG_WARNING, - "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); - } - - port_ev->pid = pid; - for (fde=port_ev->ev->fd_events;fde;fde=fde->next) { - fde->additional_flags &= PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - if (port_update_event(port_ev, fde) != 0) { - return -1; - } - } - return 0; -} - -/* - * Solaris ports cannot add the same file descriptor twice, once - * with read, once with write which is allowed by the tevent backend. - * Multiplex the existing fde, flag it as such so we can search for the - * correct fde on event triggering. - */ - -static void port_setup_multiplex_fd(struct port_event_context *port_ev, - struct tevent_fd *add_fde, - struct tevent_fd *mpx_fde) -{ - /* - * Make each fde->additional_data pointers point at each other - * so we can look them up from each other. They are now paired. - */ - mpx_fde->additional_data = add_fde; - add_fde->additional_data = mpx_fde; - - /* Now flag both fde's as being multiplexed. */ - mpx_fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_HAS_MPX; - add_fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_HAS_MPX; - - /* We need to keep the GOT_ERROR flag. */ - if (mpx_fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_GOT_ERROR) { - add_fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_GOT_ERROR; - } -} - -/* - Add the port event to the given fd_event, - Or modify an existing event. -*/ - -static int port_add_event(struct port_event_context *port_ev, struct tevent_fd *fde) -{ - int flags = port_map_flags(fde->flags); - struct tevent_fd *mpx_fde = NULL; - - fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR; - - if (fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * This is already a multiplexed fde, we need to include both - * flags in the modified event. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - mpx_fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - mpx_fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR; - - flags |= port_map_flags(mpx_fde->flags); - } else { - /* - * Not (yet) a multiplexed event. See if there - * is already an event with the same fd. - */ - for (mpx_fde = port_ev->ev->fd_events; mpx_fde; mpx_fde = mpx_fde->next) { - if (mpx_fde->fd != fde->fd) { - continue; - } - if (mpx_fde == fde) { - continue; - } - /* Same fd. */ - break; - } - if (mpx_fde) { - if (mpx_fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* Logic error. Can't have more then 2 multiplexed fde's. */ - tevent_debug(port_ev->ev, TEVENT_DEBUG_FATAL, - "multiplex fde for fd%d is already multiplexed\n", - mpx_fde->fd); - return -1; - } - flags |= port_map_flags(mpx_fde->flags); - } - } - - if (!store_port_association(port_ev, - fde, - flags)) { - tevent_debug(port_ev->ev, TEVENT_DEBUG_FATAL, - "store_port_association failed for fd%d\n", - fde->fd); - return -1; - } - - /* Note we have an association now. */ - fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - /* Only if we want to read do we tell the event handler about errors. */ - if (fde->flags & TEVENT_FD_READ) { - fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } - if (mpx_fde == NULL) { - return 0; - } - /* Set up the multiplex pointer. Does no harm if already multiplexed. */ - port_setup_multiplex_fd(port_ev, - fde, - mpx_fde); - - mpx_fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - /* Only if we want to read do we tell the event handler about errors. */ - if (mpx_fde->flags & TEVENT_FD_READ) { - mpx_fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR; - } - - return 0; -} - -/* - Delete the port association for the given fd_event. -*/ - -static void port_del_event(struct port_event_context *port_ev, struct tevent_fd *fde) -{ - struct tevent_fd *mpx_fde = NULL; - - fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR; - - if (fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * This is a multiplexed fde, we need to remove - * both associations. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - mpx_fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - mpx_fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR; - mpx_fde->additional_data = NULL; - - fde->additional_data = NULL; - } - delete_port_association(port_ev, fde); -} - -/* - Add or remove the port event from the given fd_event -*/ -static int port_update_event(struct port_event_context *port_ev, struct tevent_fd *fde) -{ - bool got_error = (fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_GOT_ERROR); - bool want_read = (fde->flags & TEVENT_FD_READ); - bool want_write = (fde->flags & TEVENT_FD_WRITE); - struct tevent_fd *mpx_fde = NULL; - - if (fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * work out what the multiplexed fde wants. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - if (mpx_fde->flags & TEVENT_FD_READ) { - want_read = true; - } - if (mpx_fde->flags & TEVENT_FD_WRITE) { - want_write = true; - } - } - - if (fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION) { - /* There's already an association. */ - if (want_read || (want_write && !got_error)) { - return port_add_event(port_ev, fde); - } - /* - * If we want to match the select behavior, we need to remove the port event - * when the caller isn't interested in events. - */ - port_del_event(port_ev, fde); - return 0; - } - - /* There's no port event attached to the fde. */ - if (want_read || (want_write && !got_error)) { - return port_add_event(port_ev, fde); - } - return 0; -} - -/* - Cope with port_get returning EPOLLHP|EPOLLERR on an association. - Return true if there's nothing else to do, false if this event - needs further handling. -*/ - -static bool port_handle_hup_or_err(struct port_event_context *port_ev, - struct tevent_fd *fde) -{ - if (fde == NULL) { - return true; - } - - fde->additional_flags |= PORT_ADDITIONAL_FD_FLAG_GOT_ERROR; - /* - * If we only wait for TEVENT_FD_WRITE, we should not tell the - * event handler about it, and remove the port association, - * as we only report error when waiting for read events, - * to match the select() behavior. - */ - if (!(fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_REPORT_ERROR)) { - /* - * Do the same as the poll backend and - * remove the writable flag. - */ - fde->flags &= ~TEVENT_FD_WRITE; - return true; - } - /* This has TEVENT_FD_READ set, we're not finished. */ - return false; -} - -/* - Event loop handling using Solaris ports. -*/ -static int port_event_loop(struct port_event_context *port_ev, struct timeval *tvalp) -{ - int ret; -#define MAXEVENTS 1 - port_event_t eventsMAXEVENTS; - uint_t nget = 1; - uint_t max_events = MAXEVENTS; - uint_t i; - int port_errno; - struct timespec ts; - struct tevent_context *ev = port_ev->ev; - - if (tvalp) { - ts.tv_sec = tvalp->tv_sec; - ts.tv_nsec = tvalp->tv_usec * 1000; - } - - if (port_ev->ev->signal_events && - tevent_common_check_signal(ev)) { - return 0; - } - - /* - * Solaris triggers sending the event to the port - * at the time the port association is done. Postpone - * associating fd's until just before we get the events, - * otherwise we can deadlock. - */ - - if (associate_all_events(port_ev) != 0) { - return -1; - } - - tevent_trace_point_callback(ev, TEVENT_TRACE_BEFORE_WAIT); - ret = port_getn(port_ev->port_fd, events, max_events, &nget, &ts); - port_errno = errno; - tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_WAIT); - - if (ret == -1 && port_errno == EINTR) { - if (ev->signal_events) { - tevent_common_check_signal(ev); - } - /* - * If no signal handlers we got an unsolicited - * signal wakeup. This can happen with epoll - * too. Just return and ignore. - */ - return 0; - } - - if (ret == -1 && port_errno == ETIME) { - /* - * If errno is set to ETIME it is possible that we still got an event. - * In that case we need to go through the processing loop so that we - * reassociate the received event with the port or the association will - * be lost so check the value of nget is 0 before returning. - */ - if (nget == 0) { - /* we don't care about a possible delay here */ - tevent_common_loop_timer_delay(ev); - return 0; - } - /* - * Set the return value to 0 since we do not actually have an error and we - * do have events that need to be processed. This keeps us from getting - * caught in the generic error test. - */ - ret = 0; - } - - if (ret == -1) { - tevent_debug(ev, TEVENT_DEBUG_ERROR, - "port_get failed (%s)\n", - strerror(errno)); - return -1; - } - - for (i = 0; i < nget; i++) { - struct tevent_fd *mpx_fde = NULL; - struct tevent_fd *fde = NULL; - uint16_t flags = 0; - struct port_associate_vals *val = talloc_get_type(eventsi.portev_user, - struct port_associate_vals); - if (val == NULL) { - tevent_debug(ev, TEVENT_DEBUG_ERROR, - "port_getn() gave bad data"); - return -1; - } - - /* Mark this event as needing to be re-associated. */ - val->associated_event = false; - - fde = val->fde; - - if (fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_HAS_MPX) { - /* - * Save off the multiplexed event in case we need - * to use it to call the handler function. - */ - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - } - - if (eventsi.portev_events & (POLLHUP|POLLERR)) { - bool handled_fde = port_handle_hup_or_err(port_ev, fde); - bool handled_mpx = port_handle_hup_or_err(port_ev, mpx_fde); - - if (handled_fde && handled_mpx) { - return port_update_event(port_ev, fde); - } - - if (!handled_mpx) { - /* - * If the mpx event was the one that needs - * further handling, it's the TEVENT_FD_READ - * event so switch over and call that handler. - */ - fde = mpx_fde; - mpx_fde = NULL; - } - flags |= TEVENT_FD_READ; - } - - if (eventsi.portev_events & POLLIN) { - flags |= TEVENT_FD_READ; - } - if (eventsi.portev_events & POLLOUT) { - flags |= TEVENT_FD_WRITE; - } - - if (flags & TEVENT_FD_WRITE) { - if (fde->flags & TEVENT_FD_WRITE) { - mpx_fde = NULL; - } - if (mpx_fde && (mpx_fde->flags & TEVENT_FD_WRITE)) { - fde = mpx_fde; - mpx_fde = NULL; - } - - if (mpx_fde) { - /* Ensure we got the right fde. */ - if ((flags & fde->flags) == 0) { - fde = mpx_fde; - mpx_fde = NULL; - } - } - } - - /* - * Make sure we only pass the flags - * the handler is expecting. - */ - flags &= fde->flags; - if (flags) { - return tevent_common_invoke_fd_handler(fde, flags, NULL); - } - } - - return 0; -} - - -/* - create a port_event_context structure. -*/ -static int port_event_context_init(struct tevent_context *ev) -{ - int ret; - struct port_event_context *port_ev; - - /* - * We might be called during tevent_re_initialise() - * which means we need to free our old additional_data. - */ - TALLOC_FREE(ev->additional_data); - - port_ev = talloc_zero(ev, struct port_event_context); - if (!port_ev) { - return -1; - } - port_ev->ev = ev; - port_ev->port_fd = -1; - port_ev->pid = (pid_t)-1; - - ret = port_init_ctx(port_ev); - if (ret != 0) { - talloc_free(port_ev); - return ret; - } - - ev->additional_data = port_ev; - return 0; -} - -/* - destroy an fd_event -*/ -static int port_event_fd_destructor(struct tevent_fd *fde) -{ - struct tevent_context *ev = fde->event_ctx; - struct port_event_context *port_ev = NULL; - struct tevent_fd *mpx_fde = NULL; - int flags = (int)fde->flags; - - if (ev == NULL) { - return tevent_common_fd_destructor(fde); - } - - port_ev = talloc_get_type_abort(ev->additional_data, - struct port_event_context); - - DLIST_REMOVE(ev->fd_events, fde); - - if (fde->additional_flags & PORT_ADDITIONAL_FD_FLAG_HAS_MPX) { - mpx_fde = talloc_get_type_abort(fde->additional_data, - struct tevent_fd); - - fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_HAS_MPX; - mpx_fde->additional_flags &= ~PORT_ADDITIONAL_FD_FLAG_HAS_MPX; - - fde->additional_data = NULL; - mpx_fde->additional_data = NULL; - - fde->additional_flags &= PORT_ADDITIONAL_FD_FLAG_HAS_ASSOCIATION; - } - - (void)port_check_reopen(port_ev); - - if (mpx_fde != NULL) { - (void)port_update_event(port_ev, mpx_fde); - } - - fde->flags = 0; - (void)port_update_event(port_ev, fde); - fde->flags = flags; - - return tevent_common_fd_destructor(fde); -} - -/* - add a fd based event - return NULL on failure (memory allocation error) -*/ -static struct tevent_fd *port_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - tevent_fd_handler_t handler, - void *private_data, - const char *handler_name, - const char *location) -{ - struct port_event_context *port_ev = - talloc_get_type_abort(ev->additional_data, - struct port_event_context); - struct tevent_fd *fde; - - fde = tevent_common_add_fd(ev, mem_ctx, fd, flags, - handler, private_data, - handler_name, location); - if (!fde) { - return NULL; - } - - talloc_set_destructor(fde, port_event_fd_destructor); - - if (port_check_reopen(port_ev) != 0) { - TALLOC_FREE(fde); - return NULL; - } - - if (port_update_event(port_ev, fde) != 0) { - TALLOC_FREE(fde); - return NULL; - } - - return fde; -} - -/* - set the fd event flags -*/ -static void port_event_set_fd_flags(struct tevent_fd *fde, uint16_t flags) -{ - struct tevent_context *ev; - struct port_event_context *port_ev; - - if (fde->flags == flags) { - return; - } - - ev = fde->event_ctx; - port_ev = talloc_get_type_abort(ev->additional_data, - struct port_event_context); - - fde->flags = flags; - - (void)port_check_reopen(port_ev); - (void)port_update_event(port_ev, fde); -} - -/* - do a single event loop using the events defined in ev -*/ -static int port_event_loop_once(struct tevent_context *ev, const char *location) -{ - struct port_event_context *port_ev = talloc_get_type(ev->additional_data, - struct port_event_context); - struct timeval tval; - - if (ev->signal_events && - tevent_common_check_signal(ev)) { - return 0; - } - - if (ev->threaded_contexts != NULL) { - tevent_common_threaded_activate_immediate(ev); - } - - if (ev->immediate_events && - tevent_common_loop_immediate(ev)) { - return 0; - } - - tval = tevent_common_loop_timer_delay(ev); - if (tevent_timeval_is_zero(&tval)) { - return 0; - } - - if (port_check_reopen(port_ev) != 0) { - errno = EINVAL; - return -1; - } - return port_event_loop(port_ev, &tval); -} - -static const struct tevent_ops port_event_ops = { - .context_init = port_event_context_init, - .add_fd = port_event_add_fd, - .set_fd_close_fn = tevent_common_fd_set_close_fn, - .get_fd_flags = tevent_common_fd_get_flags, - .set_fd_flags = port_event_set_fd_flags, - .add_timer = tevent_common_add_timer_v2, - .schedule_immediate = tevent_common_schedule_immediate, - .add_signal = tevent_common_add_signal, - .loop_once = port_event_loop_once, - .loop_wait = tevent_common_loop_wait, -}; - -_PRIVATE_ bool tevent_port_init(void) -{ - if (!tevent_register_backend("port", &port_event_ops)) { - return false; - } - tevent_set_default_backend("port"); - return true; -}
View file
_service:tar_scm:ldb-2.7.2.tar.asc
Added
@@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- + +iQEzBAABCgAdFiEEkUejOXGVGO6QEby1R5ORYRMIQCUFAmQkQQAACgkQR5ORYRMI +QCVLegf/edHMC2+MZrMuMAbmRPb/cFxzYhHzDLuDyXcW0v6M0TDhu2eRamXk1XT0 +SFR5ah/qdhC1TeYOMpXhKPTpuvEURKkCK1vLj002djaNy4hEmHUsF7aNFW9Kd2QN +2hatsIn9EhPafOppgpJ34oVEF+ta9aA07rDwcRAPiCUq4/IW6qnEieC+zCjVLlTd +2+1gfUaC2iUj7g9qkXLg21XRPRwkv8xvpUlJ+SBMphyo6uoBzVzDB+nzOGqpO4n9 +QAj6iUC0I9faLlXljgeSi+DaM1E5n/slgkl6ko2Chcba6ZtSxKLE69X3RenAu8d3 +Cf+ATsT5+Ra5CPY2PJv5Z1A2SCHd/w== +=ukNT +-----END PGP SIGNATURE-----
View file
_service:tar_scm:ldb-2.7.2.tar.gz/ABI/ldb-2.7.0.sigs
Added
@@ -0,0 +1,291 @@ +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_add_child_val: bool (struct ldb_dn *, const char *, struct ldb_val) +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_ldb_context: struct ldb_context *(struct ldb_dn *) +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_attrs: int (struct ldb_context *, const struct ldb_message *, const char * const *, struct ldb_message *) +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_get_event_context: struct tevent_context *(struct ldb_handle *) +ldb_handle_new: struct ldb_handle *(TALLOC_CTX *, struct ldb_context *) +ldb_handle_use_global_event_context: void (struct ldb_handle *) +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_redacted_string: char *(struct ldb_context *, TALLOC_CTX *, enum ldb_changetype, const struct ldb_message *) +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_message: int (struct ldb_context *, const struct ldb_message *, const struct ldb_parse_tree *, enum ldb_scope, bool *) +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_string_flags: int (struct ldb_message *, const char *, const char *, int) +ldb_msg_add_value: int (struct ldb_message *, const char *, const struct ldb_val *, struct ldb_message_element **) +ldb_msg_append_fmt: int (struct ldb_message *, int, const char *, const char *, ...) +ldb_msg_append_linearized_dn: int (struct ldb_message *, const char *, struct ldb_dn *, int) +ldb_msg_append_steal_string: int (struct ldb_message *, const char *, char *, int) +ldb_msg_append_steal_value: int (struct ldb_message *, const char *, struct ldb_val *, int) +ldb_msg_append_string: int (struct ldb_message *, const char *, const char *, int) +ldb_msg_append_value: int (struct ldb_message *, const char *, const struct ldb_val *, int) +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_add_value: int (TALLOC_CTX *, struct ldb_message_element *, const struct ldb_val *) +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_common_values: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message_element *, struct ldb_message_element *, uint32_t) +ldb_msg_find_duplicate_val: int (struct ldb_context *, TALLOC_CTX *, const struct ldb_message_element *, struct ldb_val **, uint32_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_read_lock: int (struct ldb_module *) +ldb_next_read_unlock: 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_copy: const char **(TALLOC_CTX *, const char **) +ldb_options_find: const char *(struct ldb_context *, const char **, const char *) +ldb_options_get: const char **(struct ldb_context *) +ldb_pack_data: int (struct ldb_context *, const struct ldb_message *, struct ldb_val *, uint32_t) +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_extended_match_rule: int (struct ldb_context *, const struct ldb_extended_match_rule *) +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_fill_with_syntax: int (struct ldb_context *, TALLOC_CTX *, const char *, unsigned int, const struct ldb_schema_syntax *, struct ldb_schema_attribute *) +ldb_schema_attribute_remove: void (struct ldb_context *, const char *) +ldb_schema_attribute_remove_flagged: void (struct ldb_context *, unsigned int) +ldb_schema_attribute_set_override_handler: void (struct ldb_context *, ldb_attribute_handler_override_fn_t, void *) +ldb_schema_set_override_GUID_index: void (struct ldb_context *, const char *, const char *) +ldb_schema_set_override_indexlist: void (struct ldb_context *, bool) +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_require_private_event_context: void (struct ldb_context *) +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_unpack_data_flags: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *, unsigned int) +ldb_unpack_get_format: int (const struct ldb_val *, uint32_t *) +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)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/ABI/ldb-2.7.1.sigs
Added
@@ -0,0 +1,291 @@ +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_add_child_val: bool (struct ldb_dn *, const char *, struct ldb_val) +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_ldb_context: struct ldb_context *(struct ldb_dn *) +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_attrs: int (struct ldb_context *, const struct ldb_message *, const char * const *, struct ldb_message *) +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_get_event_context: struct tevent_context *(struct ldb_handle *) +ldb_handle_new: struct ldb_handle *(TALLOC_CTX *, struct ldb_context *) +ldb_handle_use_global_event_context: void (struct ldb_handle *) +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_redacted_string: char *(struct ldb_context *, TALLOC_CTX *, enum ldb_changetype, const struct ldb_message *) +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_message: int (struct ldb_context *, const struct ldb_message *, const struct ldb_parse_tree *, enum ldb_scope, bool *) +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_string_flags: int (struct ldb_message *, const char *, const char *, int) +ldb_msg_add_value: int (struct ldb_message *, const char *, const struct ldb_val *, struct ldb_message_element **) +ldb_msg_append_fmt: int (struct ldb_message *, int, const char *, const char *, ...) +ldb_msg_append_linearized_dn: int (struct ldb_message *, const char *, struct ldb_dn *, int) +ldb_msg_append_steal_string: int (struct ldb_message *, const char *, char *, int) +ldb_msg_append_steal_value: int (struct ldb_message *, const char *, struct ldb_val *, int) +ldb_msg_append_string: int (struct ldb_message *, const char *, const char *, int) +ldb_msg_append_value: int (struct ldb_message *, const char *, const struct ldb_val *, int) +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_add_value: int (TALLOC_CTX *, struct ldb_message_element *, const struct ldb_val *) +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_common_values: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message_element *, struct ldb_message_element *, uint32_t) +ldb_msg_find_duplicate_val: int (struct ldb_context *, TALLOC_CTX *, const struct ldb_message_element *, struct ldb_val **, uint32_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_read_lock: int (struct ldb_module *) +ldb_next_read_unlock: 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_copy: const char **(TALLOC_CTX *, const char **) +ldb_options_find: const char *(struct ldb_context *, const char **, const char *) +ldb_options_get: const char **(struct ldb_context *) +ldb_pack_data: int (struct ldb_context *, const struct ldb_message *, struct ldb_val *, uint32_t) +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_extended_match_rule: int (struct ldb_context *, const struct ldb_extended_match_rule *) +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_fill_with_syntax: int (struct ldb_context *, TALLOC_CTX *, const char *, unsigned int, const struct ldb_schema_syntax *, struct ldb_schema_attribute *) +ldb_schema_attribute_remove: void (struct ldb_context *, const char *) +ldb_schema_attribute_remove_flagged: void (struct ldb_context *, unsigned int) +ldb_schema_attribute_set_override_handler: void (struct ldb_context *, ldb_attribute_handler_override_fn_t, void *) +ldb_schema_set_override_GUID_index: void (struct ldb_context *, const char *, const char *) +ldb_schema_set_override_indexlist: void (struct ldb_context *, bool) +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_require_private_event_context: void (struct ldb_context *) +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_unpack_data_flags: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *, unsigned int) +ldb_unpack_get_format: int (const struct ldb_val *, uint32_t *) +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)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/ABI/ldb-2.7.2.sigs
Added
@@ -0,0 +1,301 @@ +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_add_child_val: bool (struct ldb_dn *, const char *, struct ldb_val) +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_ldb_context: struct ldb_context *(struct ldb_dn *) +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_attrs: int (struct ldb_context *, const struct ldb_message *, const char * const *, struct ldb_message *) +ldb_filter_attrs_in_place: int (struct ldb_message *, const char * const *) +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_get_event_context: struct tevent_context *(struct ldb_handle *) +ldb_handle_new: struct ldb_handle *(TALLOC_CTX *, struct ldb_context *) +ldb_handle_use_global_event_context: void (struct ldb_handle *) +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_redacted_string: char *(struct ldb_context *, TALLOC_CTX *, enum ldb_changetype, const struct ldb_message *) +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_message: int (struct ldb_context *, const struct ldb_message *, const struct ldb_parse_tree *, enum ldb_scope, bool *) +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_match_scope: int (struct ldb_context *, struct ldb_dn *, struct ldb_dn *, enum ldb_scope) +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_distinguished_name: int (struct ldb_message *) +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_string_flags: int (struct ldb_message *, const char *, const char *, int) +ldb_msg_add_value: int (struct ldb_message *, const char *, const struct ldb_val *, struct ldb_message_element **) +ldb_msg_append_fmt: int (struct ldb_message *, int, const char *, const char *, ...) +ldb_msg_append_linearized_dn: int (struct ldb_message *, const char *, struct ldb_dn *, int) +ldb_msg_append_steal_string: int (struct ldb_message *, const char *, char *, int) +ldb_msg_append_steal_value: int (struct ldb_message *, const char *, struct ldb_val *, int) +ldb_msg_append_string: int (struct ldb_message *, const char *, const char *, int) +ldb_msg_append_value: int (struct ldb_message *, const char *, const struct ldb_val *, int) +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_add_value: int (TALLOC_CTX *, struct ldb_message_element *, const struct ldb_val *) +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_element_is_inaccessible: bool (const struct ldb_message_element *) +ldb_msg_element_mark_inaccessible: void (struct ldb_message_element *) +ldb_msg_elements_take_ownership: int (struct ldb_message *) +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_common_values: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message_element *, struct ldb_message_element *, uint32_t) +ldb_msg_find_duplicate_val: int (struct ldb_context *, TALLOC_CTX *, const struct ldb_message_element *, struct ldb_val **, uint32_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_remove_inaccessible: void (struct ldb_message *) +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_shrink_to_fit: void (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_read_lock: int (struct ldb_module *) +ldb_next_read_unlock: 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_copy: const char **(TALLOC_CTX *, const char **) +ldb_options_find: const char *(struct ldb_context *, const char **, const char *) +ldb_options_get: const char **(struct ldb_context *) +ldb_pack_data: int (struct ldb_context *, const struct ldb_message *, struct ldb_val *, uint32_t) +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_get_attr: const char *(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_extended_match_rule: int (struct ldb_context *, const struct ldb_extended_match_rule *) +ldb_register_hook: int (ldb_hook_fn) +ldb_register_module: int (const struct ldb_module_ops *) +ldb_register_redact_callback: int (struct ldb_context *, ldb_redact_fn, struct ldb_module *) +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_fill_with_syntax: int (struct ldb_context *, TALLOC_CTX *, const char *, unsigned int, const struct ldb_schema_syntax *, struct ldb_schema_attribute *) +ldb_schema_attribute_remove: void (struct ldb_context *, const char *) +ldb_schema_attribute_remove_flagged: void (struct ldb_context *, unsigned int) +ldb_schema_attribute_set_override_handler: void (struct ldb_context *, ldb_attribute_handler_override_fn_t, void *) +ldb_schema_set_override_GUID_index: void (struct ldb_context *, const char *, const char *) +ldb_schema_set_override_indexlist: void (struct ldb_context *, bool) +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_require_private_event_context: void (struct ldb_context *) +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_unpack_data_flags: int (struct ldb_context *, const struct ldb_val *, struct ldb_message *, unsigned int) +ldb_unpack_get_format: int (const struct ldb_val *, uint32_t *) +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)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/ABI/pyldb-util-2.7.0.sigs
Added
@@ -0,0 +1,3 @@ +pyldb_Dn_FromDn: PyObject *(struct ldb_dn *) +pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **) +pyldb_check_type: bool (PyObject *, const char *)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/ABI/pyldb-util-2.7.1.sigs
Added
@@ -0,0 +1,3 @@ +pyldb_Dn_FromDn: PyObject *(struct ldb_dn *) +pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **) +pyldb_check_type: bool (PyObject *, const char *)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/ABI/pyldb-util-2.7.2.sigs
Added
@@ -0,0 +1,3 @@ +pyldb_Dn_FromDn: PyObject *(struct ldb_dn *) +pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **) +pyldb_check_type: bool (PyObject *, const char *)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/buildtools/bin/waf -> _service:tar_scm:ldb-2.7.2.tar.gz/buildtools/bin/waf
Changed
@@ -32,7 +32,7 @@ import os, sys, inspect -VERSION="2.0.24" +VERSION="2.0.25" REVISION="x" GIT="x" INSTALL="x"
View file
_service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_autoconf.py -> _service:tar_scm:ldb-2.7.2.tar.gz/buildtools/wafsamba/samba_autoconf.py
Changed
@@ -146,7 +146,7 @@ @conf -def CHECK_TYPE(conf, t, alternate=None, headers=None, define=None, lib=None, msg=None): +def CHECK_TYPE(conf, t, alternate=None, headers=None, define=None, lib=None, msg=None, cflags=''): '''check for a single type''' if define is None: define = 'HAVE_' + t.upper().replace(' ', '_') @@ -158,6 +158,7 @@ headers=headers, local_include=False, msg=msg, + cflags=cflags, lib=lib, link=False) if not ret and alternate: @@ -177,14 +178,15 @@ @conf -def CHECK_TYPE_IN(conf, t, headers=None, alternate=None, define=None): +def CHECK_TYPE_IN(conf, t, headers=None, alternate=None, define=None, cflags=''): '''check for a single type with a header''' - return CHECK_TYPE(conf, t, headers=headers, alternate=alternate, define=define) + return CHECK_TYPE(conf, t, headers=headers, alternate=alternate, define=define, cflags=cflags) @conf def CHECK_VARIABLE(conf, v, define=None, always=False, - headers=None, msg=None, lib=None): + headers=None, msg=None, lib=None, + mandatory=False): '''check for a variable declaration (or define)''' if define is None: define = 'HAVE_%s' % v.upper() @@ -208,6 +210,7 @@ lib=lib, headers=headers, define=define, + mandatory=mandatory, always=always) @@ -774,6 +777,8 @@ testflags=True) conf.ADD_CFLAGS('-Werror-implicit-function-declaration', testflags=True) + conf.ADD_CFLAGS('-Werror=implicit-int', + testflags=True) conf.ADD_CFLAGS('-Werror=pointer-arith -Wpointer-arith', testflags=True) conf.ADD_CFLAGS('-Werror=declaration-after-statement -Wdeclaration-after-statement', @@ -786,6 +791,8 @@ testflags=True) conf.ADD_CFLAGS('-Werror=strict-overflow -Wstrict-overflow=2', testflags=True) + conf.ADD_CFLAGS('-Werror=old-style-definition -Wold-style-definition', + testflags=True) conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True) conf.ADD_CFLAGS('-Wno-format-zero-length', testflags=True)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_conftests.py -> _service:tar_scm:ldb-2.7.2.tar.gz/buildtools/wafsamba/samba_conftests.py
Changed
@@ -126,7 +126,7 @@ @conf -def CHECK_C_PROTOTYPE(conf, function, prototype, define, headers=None, msg=None): +def CHECK_C_PROTOTYPE(conf, function, prototype, define, headers=None, msg=None, lib=None): '''verify that a C prototype matches the one on the current system''' if not conf.CHECK_DECLS(function, headers=headers): return False @@ -138,7 +138,8 @@ headers=headers, link=False, execute=False, - msg=msg) + msg=msg, + lib=lib) @conf
View file
_service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_third_party.py -> _service:tar_scm:ldb-2.7.2.tar.gz/buildtools/wafsamba/samba_third_party.py
Changed
@@ -29,12 +29,12 @@ @conf def CHECK_NSS_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.12') + return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.13') Build.BuildContext.CHECK_NSS_WRAPPER = CHECK_NSS_WRAPPER @conf def CHECK_RESOLV_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('resolv_wrapper', minversion='1.1.7') + return conf.CHECK_BUNDLED_SYSTEM_PKG('resolv_wrapper', minversion='1.1.8') Build.BuildContext.CHECK_RESOLV_WRAPPER = CHECK_RESOLV_WRAPPER @conf
View file
_service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_waf18.py -> _service:tar_scm:ldb-2.7.2.tar.gz/buildtools/wafsamba/samba_waf18.py
Changed
@@ -209,7 +209,8 @@ lib_node.parent.mkdir() lib_node.write('int lib_func(void) { return 42; }\n', 'w') main_node = bld.srcnode.make_node('main.c') - main_node.write('int main(void) {return !(lib_func() == 42);}', 'w') + main_node.write('int lib_func(void);\n' + 'int main(void) {return !(lib_func() == 42);}', 'w') linkflags = if version_script: script = bld.srcnode.make_node('ldscript')
View file
_service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/wafsamba.py -> _service:tar_scm:ldb-2.7.2.tar.gz/buildtools/wafsamba/wafsamba.py
Changed
@@ -38,7 +38,7 @@ os.environ'PYTHONUNBUFFERED' = '1' -if Context.HEXVERSION not in (0x2001800,): +if Context.HEXVERSION not in (0x2001900,): Logs.error(''' Please use the version of waf that comes with Samba, not a system installed version. See http://wiki.samba.org/index.php/Waf
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/attrib_handlers.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/attrib_handlers.c
Changed
@@ -1,4 +1,4 @@ -/* +/* ldb database library Copyright (C) Andrew Tridgell 2005 @@ -7,7 +7,7 @@ ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -309,7 +309,7 @@ compare two case insensitive strings, ignoring multiple whitespaces and leading and trailing whitespaces see rfc2252 section 8.1 - + try to optimize for the ascii case, but if we find out an utf8 codepoint revert to slower but correct function */ @@ -321,6 +321,7 @@ char *b1, *b2; const char *u1, *u2; int ret; + while (n1 && *s1 == ' ') { s1++; n1--; }; while (n2 && *s2 == ' ') { s2++; n2--; }; @@ -345,24 +346,28 @@ * "domainUpdates" */ if (n1 && *s1 == ' ' && (!n2 || !*s2)) { - while (n1 && *s1 == ' ') { s1++; n1--; } + while (n1 && *s1 == ' ') { s1++; n1--; } } if (n2 && *s2 == ' ' && (!n1 || !*s1)) { - while (n2 && *s2 == ' ') { s2++; n2--; } + while (n2 && *s2 == ' ') { s2++; n2--; } } if (n1 == 0 && n2 != 0) { - return -(int)toupper(*s2); + return -(int)ldb_ascii_toupper(*s2); } if (n2 == 0 && n1 != 0) { - return (int)toupper(*s1); + return (int)ldb_ascii_toupper(*s1); } if (n1 == 0 && n2 == 0) { return 0; } - return (int)toupper(*s1) - (int)toupper(*s2); + return (int)ldb_ascii_toupper(*s1) - (int)ldb_ascii_toupper(*s2); utf8str: - /* no need to recheck from the start, just from the first utf8 char found */ + /* + * No need to recheck from the start, just from the first utf8 charu + * found. Note that the callback of ldb_casefold() needs to be ascii + * compatible. + */ b1 = ldb_casefold(ldb, mem_ctx, s1, n1); b2 = ldb_casefold(ldb, mem_ctx, s2, n2); @@ -375,9 +380,9 @@ if (ret == 0) { if (n1 == n2) return 0; if (n1 > n2) { - return (int)toupper(s1n2); + return (int)ldb_ascii_toupper(s1n2); } else { - return -(int)toupper(s2n1); + return -(int)ldb_ascii_toupper(s2n1); } } return ret; @@ -403,7 +408,7 @@ talloc_free(b1); talloc_free(b2); - + return ret; } @@ -455,7 +460,7 @@ if ( ! ldb_dn_validate(dn2)) { talloc_free(dn1); return -1; - } + } ret = ldb_dn_compare(dn1, dn2); @@ -523,7 +528,7 @@ table of standard attribute handlers */ static const struct ldb_schema_syntax ldb_standard_syntaxes = { - { + { .name = LDB_SYNTAX_INTEGER, .ldif_read_fn = ldb_handler_copy, .ldif_write_fn = ldb_handler_copy, @@ -545,35 +550,35 @@ .canonicalise_fn = ldb_handler_copy, .comparison_fn = ldb_comparison_binary }, - { + { .name = LDB_SYNTAX_DIRECTORY_STRING, .ldif_read_fn = ldb_handler_copy, .ldif_write_fn = ldb_handler_copy, .canonicalise_fn = ldb_handler_fold, .comparison_fn = ldb_comparison_fold }, - { + { .name = LDB_SYNTAX_DN, .ldif_read_fn = ldb_handler_copy, .ldif_write_fn = ldb_handler_copy, .canonicalise_fn = ldb_canonicalise_dn, .comparison_fn = ldb_comparison_dn }, - { + { .name = LDB_SYNTAX_OBJECTCLASS, .ldif_read_fn = ldb_handler_copy, .ldif_write_fn = ldb_handler_copy, .canonicalise_fn = ldb_handler_fold, .comparison_fn = ldb_comparison_fold }, - { + { .name = LDB_SYNTAX_UTC_TIME, .ldif_read_fn = ldb_handler_copy, .ldif_write_fn = ldb_handler_copy, .canonicalise_fn = ldb_canonicalise_utctime, .comparison_fn = ldb_comparison_utctime }, - { + { .name = LDB_SYNTAX_GENERALIZED_TIME, .ldif_read_fn = ldb_handler_copy, .ldif_write_fn = ldb_handler_copy, @@ -607,8 +612,8 @@ return NULL; } -int ldb_any_comparison(struct ldb_context *ldb, void *mem_ctx, - ldb_attr_handler_t canonicalise_fn, +int ldb_any_comparison(struct ldb_context *ldb, void *mem_ctx, + ldb_attr_handler_t canonicalise_fn, const struct ldb_val *v1, const struct ldb_val *v2) { @@ -619,7 +624,7 @@ /* I could try and bail if tmp_ctx was NULL, but what return * value would I use? * - * It seems easier to continue on the NULL context + * It seems easier to continue on the NULL context */ ret1 = canonicalise_fn(ldb, tmp_ctx, v1, &v1_canon); ret2 = canonicalise_fn(ldb, tmp_ctx, v2, &v2_canon);
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb.c
Changed
@@ -1467,6 +1467,10 @@ req->operation = LDB_SEARCH; if (base == NULL) { req->op.search.base = ldb_dn_new(req, ldb, NULL); + if (req->op.search.base == NULL) { + ldb_oom(ldb); + return LDB_ERR_OPERATIONS_ERROR; + } } else { req->op.search.base = base; }
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_dn.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb_dn.c
Changed
@@ -877,21 +877,17 @@ (int)val.length, val.data); } else { - p = talloc_asprintf_append_buffer(p, ";<%s=%.*s>", - name, - (int)val.length, - val.data); + talloc_asprintf_addbuf(&p, ";<%s=%.*s>", + name, + (int)val.length, + val.data); } talloc_free(val.data); - - if (!p) { - return NULL; - } } if (dn->ext_comp_num && *linearized) { - p = talloc_asprintf_append_buffer(p, ";%s", linearized); + talloc_asprintf_addbuf(&p, ";%s", linearized); } if (!p) { @@ -1056,7 +1052,7 @@ if (( ! base->valid_case) || ( ! dn->valid_case)) { if (base->linearized && dn->linearized && dn->special == base->special) { /* try with a normal compare first, if we are lucky - * we will avoid exploding and casfolding */ + * we will avoid exploding and casefolding */ int dif; dif = strlen(dn->linearized) - strlen(base->linearized); if (dif < 0) { @@ -1144,7 +1140,7 @@ if (( ! dn0->valid_case) || ( ! dn1->valid_case)) { if (dn0->linearized && dn1->linearized) { /* try with a normal compare first, if we are lucky - * we will avoid exploding and casfolding */ + * we will avoid exploding and casefolding */ if (strcmp(dn0->linearized, dn1->linearized) == 0) { return 0; }
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_match.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb_match.c
Changed
@@ -34,14 +34,15 @@ #include "ldb_private.h" #include "dlinklist.h" +#include "ldb_handlers.h" /* check if the scope matches in a search result */ -static int ldb_match_scope(struct ldb_context *ldb, - struct ldb_dn *base, - struct ldb_dn *dn, - enum ldb_scope scope) +int ldb_match_scope(struct ldb_context *ldb, + struct ldb_dn *base, + struct ldb_dn *dn, + enum ldb_scope scope) { int ret = 0; @@ -259,20 +260,42 @@ return LDB_SUCCESS; } - if (a->syntax->canonicalise_fn(ldb, ldb, &value, &val) != 0) { - return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; + /* No need to just copy this value for a binary match */ + if (a->syntax->canonicalise_fn != ldb_handler_copy) { + if (a->syntax->canonicalise_fn(ldb, ldb, &value, &val) != 0) { + return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; + } + + /* + * Only set save_p if we allocate (call + * a->syntax->canonicalise_fn()), as we + * talloc_free(save_p) below to clean up + */ + save_p = val.data; + } else { + val = value; } - save_p = val.data; cnk.data = NULL; if ( ! tree->u.substring.start_with_wildcard ) { + uint8_t *cnk_to_free = NULL; chunk = tree->u.substring.chunksc; - if (a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto mismatch; + /* No need to just copy this value for a binary match */ + if (a->syntax->canonicalise_fn != ldb_handler_copy) { + if (a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) { + goto mismatch; + } + + cnk_to_free = cnk.data; + } else { + cnk = *chunk; + } /* This deals with wildcard prefix searches on binary attributes (eg objectGUID) */ if (cnk.length > val.length) { + TALLOC_FREE(cnk_to_free); goto mismatch; } /* @@ -280,32 +303,47 @@ * we can cope with this. */ if (cnk.length == 0) { + TALLOC_FREE(cnk_to_free); + goto mismatch; + } + + if (memcmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) { + TALLOC_FREE(cnk_to_free); goto mismatch; } - if (memcmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) goto mismatch; val.length -= cnk.length; val.data += cnk.length; c++; - talloc_free(cnk.data); + TALLOC_FREE(cnk_to_free); cnk.data = NULL; } while (tree->u.substring.chunksc) { uint8_t *p; + uint8_t *cnk_to_free = NULL; chunk = tree->u.substring.chunksc; - if(a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) { - goto mismatch; + /* No need to just copy this value for a binary match */ + if (a->syntax->canonicalise_fn != ldb_handler_copy) { + if (a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) { + goto mismatch; + } + + cnk_to_free = cnk.data; + } else { + cnk = *chunk; } /* * Empty strings are returned as length 0. Ensure * we can cope with this. */ if (cnk.length == 0) { + TALLOC_FREE(cnk_to_free); goto mismatch; } if (cnk.length > val.length) { + TALLOC_FREE(cnk_to_free); goto mismatch; } @@ -320,6 +358,8 @@ cmp = memcmp(p, cnk.data, cnk.length); + TALLOC_FREE(cnk_to_free); + if (cmp != 0) { goto mismatch; } @@ -331,15 +371,16 @@ p = memmem((const void *)val.data, val.length, (const void *)cnk.data, cnk.length); if (p == NULL) { + TALLOC_FREE(cnk_to_free); goto mismatch; } /* move val to the end of the match */ p += cnk.length; val.length -= (p - val.data); val.data = p; + TALLOC_FREE(cnk_to_free); } c++; - TALLOC_FREE(cnk.data); } talloc_free(save_p); @@ -349,7 +390,6 @@ mismatch: *matched = false; talloc_free(save_p); - talloc_free(cnk.data); return LDB_SUCCESS; } @@ -531,6 +571,26 @@ &tree->u.extended.value, matched); } +static bool ldb_must_suppress_match(const struct ldb_message *msg, + const struct ldb_parse_tree *tree) +{ + const char *attr = NULL; + struct ldb_message_element *el = NULL; + + attr = ldb_parse_tree_get_attr(tree); + if (attr == NULL) { + return false; + } + + /* find the message element */ + el = ldb_msg_find_element(msg, attr); + if (el == NULL) { + return false; + } + + return ldb_msg_element_is_inaccessible(el); +} + /* Check if a particular message will match the given filter @@ -555,6 +615,17 @@ return LDB_SUCCESS; } + /* + * Suppress matches on confidential attributes (handled + * manually in extended matches as these can do custom things + * like read other parts of the DB or other attributes). + */ + if (tree->operation != LDB_OP_EXTENDED) { + if (ldb_must_suppress_match(msg, tree)) { + return LDB_SUCCESS; + } + } + switch (tree->operation) { case LDB_OP_AND: for (i=0;i<tree->u.list.num_elements;i++) { @@ -741,3 +812,15 @@ return LDB_SUCCESS; } +int ldb_register_redact_callback(struct ldb_context *ldb, + ldb_redact_fn redact_fn, + struct ldb_module *module) +{ + if (ldb->redact.callback != NULL) { + return LDB_ERR_ENTRY_ALREADY_EXISTS; + } + + ldb->redact.callback = redact_fn; + ldb->redact.module = module; + return LDB_SUCCESS; +}
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_modules.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb_modules.c
Changed
@@ -1193,13 +1193,8 @@ } while (req && req->handle) { - char *s = talloc_asprintf_append_buffer(ret, "req%u %p : %s\n", - i++, req, ldb_req_location(req)); - if (s == NULL) { - talloc_free(ret); - return NULL; - } - ret = s; + talloc_asprintf_addbuf(&ret, "req%u %p : %s\n", + i++, req, ldb_req_location(req)); req = req->handle->parent; } return ret;
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_msg.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb_msg.c
Changed
@@ -795,6 +795,32 @@ return ldb_attr_cmp(el1->name, el2->name); } +void ldb_msg_element_mark_inaccessible(struct ldb_message_element *el) +{ + el->flags |= LDB_FLAG_INTERNAL_INACCESSIBLE_ATTRIBUTE; +} + +bool ldb_msg_element_is_inaccessible(const struct ldb_message_element *el) +{ + return (el->flags & LDB_FLAG_INTERNAL_INACCESSIBLE_ATTRIBUTE) != 0; +} + +void ldb_msg_remove_inaccessible(struct ldb_message *msg) +{ + unsigned i; + unsigned num_del = 0; + + for (i = 0; i < msg->num_elements; ++i) { + if (ldb_msg_element_is_inaccessible(&msg->elementsi)) { + ++num_del; + } else if (num_del) { + msg->elementsi - num_del = msg->elementsi; + } + } + + msg->num_elements -= num_del; +} + /* convenience functions to return common types from a message these return the first value if the attribute is multi-valued @@ -1471,6 +1497,22 @@ } } +/* Reallocate elements to drop any excess capacity. */ +void ldb_msg_shrink_to_fit(struct ldb_message *msg) +{ + if (msg->num_elements > 0) { + struct ldb_message_element *elements = talloc_realloc(msg, + msg->elements, + struct ldb_message_element, + msg->num_elements); + if (elements != NULL) { + msg->elements = elements; + } + } else { + TALLOC_FREE(msg->elements); + } +} + /* return a LDAP formatted GeneralizedTime string */
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_pack.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb_pack.c
Changed
@@ -690,6 +690,7 @@ element->values = NULL; if ((flags & LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC) && element->num_values == 1) { element->values = &ldb_val_single_arraynelem; + element->flags |= LDB_FLAG_INTERNAL_SHARED_VALUES; } else if (element->num_values != 0) { element->values = talloc_array(message->elements, struct ldb_val, @@ -932,6 +933,7 @@ if ((flags & LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC) && element->num_values == 1) { element->values = &ldb_val_single_arraynelem; + element->flags |= LDB_FLAG_INTERNAL_SHARED_VALUES; } else if (element->num_values != 0) { element->values = talloc_array(message->elements, struct ldb_val, @@ -1096,7 +1098,7 @@ /* add the special distinguishedName element */ -static int msg_add_distinguished_name(struct ldb_message *msg) +int ldb_msg_add_distinguished_name(struct ldb_message *msg) { const char *dn_attr = "distinguishedName"; char *dn = NULL; @@ -1156,7 +1158,7 @@ /* Shortcuts for the simple cases */ } else if (add_dn && i == 1) { - if (msg_add_distinguished_name(filtered_msg) != 0) { + if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { goto failed; } return 0; @@ -1236,7 +1238,7 @@ filtered_msg->num_elements = num_elements; if (add_dn) { - if (msg_add_distinguished_name(filtered_msg) != 0) { + if (ldb_msg_add_distinguished_name(filtered_msg) != 0) { goto failed; } } @@ -1259,3 +1261,100 @@ TALLOC_FREE(filtered_msg->elements); return -1; } + +/* + * filter the specified list of attributes from msg, + * adding requested attributes, and perhaps all for *. + * Unlike ldb_filter_attrs(), the DN will not be added + * if it is missing. + */ +int ldb_filter_attrs_in_place(struct ldb_message *msg, + const char *const *attrs) +{ + unsigned int i = 0; + bool keep_all = false; + unsigned int num_del = 0; + + if (attrs) { + /* check for special attrs */ + for (i = 0; attrsi; i++) { + int cmp = strcmp(attrsi, "*"); + if (cmp == 0) { + keep_all = true; + break; + } + } + if (!keep_all && i == 0) { + msg->num_elements = 0; + return LDB_SUCCESS; + } + } else { + keep_all = true; + } + + for (i = 0; i < msg->num_elements; i++) { + bool found = false; + unsigned int j; + + if (keep_all) { + found = true; + } else { + for (j = 0; attrsj; j++) { + int cmp = ldb_attr_cmp(msg->elementsi.name, attrsj); + if (cmp == 0) { + found = true; + break; + } + } + } + + if (!found) { + ++num_del; + } else if (num_del != 0) { + msg->elementsi - num_del = msg->elementsi; + } + } + + msg->num_elements -= num_del; + + return LDB_SUCCESS; +} + +/* Have an unpacked ldb message take talloc ownership of its elements. */ +int ldb_msg_elements_take_ownership(struct ldb_message *msg) +{ + unsigned int i = 0; + + for (i = 0; i < msg->num_elements; i++) { + struct ldb_message_element *el = &msg->elementsi; + const char *name; + unsigned int j; + + name = talloc_strdup(msg->elements, + el->name); + if (name == NULL) { + return -1; + } + el->name = name; + + if (el->flags & LDB_FLAG_INTERNAL_SHARED_VALUES) { + struct ldb_val *values = talloc_memdup(msg->elements, el->values, + sizeof(struct ldb_val) * el->num_values); + if (values == NULL) { + return -1; + } + el->values = values; + el->flags &= ~LDB_FLAG_INTERNAL_SHARED_VALUES; + } + + for (j = 0; j < el->num_values; j++) { + struct ldb_val val = ldb_val_dup(el->values, &el->valuesj); + if (val.data == NULL && el->valuesj.length != 0) { + return -1; + } + el->valuesj = val; + } + } + + return LDB_SUCCESS; +}
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_parse.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb_parse.c
Changed
@@ -997,3 +997,28 @@ return nt; } + +/* Get the attribute (if any) associated with the top node of a parse tree. */ +const char *ldb_parse_tree_get_attr(const struct ldb_parse_tree *tree) +{ + switch (tree->operation) { + case LDB_OP_AND: + case LDB_OP_OR: + case LDB_OP_NOT: + return NULL; + case LDB_OP_EQUALITY: + return tree->u.equality.attr; + case LDB_OP_SUBSTRING: + return tree->u.substring.attr; + case LDB_OP_GREATER: + case LDB_OP_LESS: + case LDB_OP_APPROX: + return tree->u.comparison.attr; + case LDB_OP_PRESENT: + return tree->u.present.attr; + case LDB_OP_EXTENDED: + return tree->u.extended.attr; + } + + return NULL; +}
View file
_service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_utf8.c -> _service:tar_scm:ldb-2.7.2.tar.gz/common/ldb_utf8.c
Changed
@@ -1,4 +1,4 @@ -/* +/* ldb database library Copyright (C) Andrew Tridgell 2004 @@ -6,7 +6,7 @@ ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -62,7 +62,7 @@ return NULL; } for (i=0;reti;i++) { - reti = toupper((unsigned char)reti); + reti = ldb_ascii_toupper((unsigned char)reti); } return ret; } @@ -118,7 +118,7 @@ return NULL; } for (i = 0; reti; i++) { - reti = toupper((unsigned char)reti); + reti = ldb_ascii_toupper((unsigned char)reti); } return ret; } @@ -134,3 +134,7 @@ } return -1; } + +_PRIVATE_ char ldb_ascii_toupper(char c) { + return ('a' <= c && c <= 'z') ? c ^ 0x20 : toupper(c); +}
View file
_service:tar_scm:ldb-2.6.1.tar.gz/include/ldb.h -> _service:tar_scm:ldb-2.7.2.tar.gz/include/ldb.h
Changed
@@ -1551,7 +1551,11 @@ void ldb_set_utf8_default(struct ldb_context *ldb); /** - Casefold a string + \brief Casefold a string + + Note that the callback needs to be ASCII compatible. So first ASCII needs + to be handle before any UTF-8. This is needed to avoid issues with dottet + languages. \param ldb the ldb context \param mem_ctx the memory context to allocate the result string @@ -1745,7 +1749,7 @@ \return the string containing the LDIF, or NULL on error - \sa ldb_ldif_message_redacted_string for a safer version of this + \sa ldb_ldif_message_redacted_string for a safer version of this function */ char *ldb_ldif_message_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, @@ -1763,7 +1767,7 @@ \return the string containing the LDIF, or NULL on error, but with secret attributes redacted - \note The secret attributes are specified in a + \note The secret attributes are specified in a 'const char * const *' within the LDB_SECRET_ATTRIBUTE_LIST opaque set on the ldb @@ -1857,7 +1861,7 @@ \param mem_ctx TALLOC context to return resulting ldb_dn structure on \param new_fms The new DN as a format string (plus arguments) - \note The DN will not be parsed at this time. Use ldb_dn_validate to tell if the DN is syntacticly correct + \note The DN will not be parsed at this time. Use ldb_dn_validate to tell if the DN is syntactically correct */ struct ldb_dn *ldb_dn_new_fmt(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, const char *new_fmt, ...) PRINTF_ATTRIBUTE(3,4); @@ -1949,7 +1953,7 @@ /** Find an element within an message */ -struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, +struct ldb_message_element *ldb_msg_find_element(const struct ldb_message *msg, const char *attr_name); /** @@ -1970,7 +1974,7 @@ \note This search is case sensitive */ -struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, +struct ldb_val *ldb_msg_find_val(const struct ldb_message_element *el, struct ldb_val *val); /** @@ -2186,7 +2190,9 @@ void *context); /** - this allows the user to set custom utf8 function for error reporting + this allows the user to set custom utf8 function for error reporting. make + sure it is able to handle ASCII first, so it prevents issues with dottet + languages. */ void ldb_set_utf8_fns(struct ldb_context *ldb, void *context, @@ -2296,7 +2302,9 @@ do { \ if (numel > 1) { \ ldb_qsort(base, numel, sizeof((base)0), discard_const(opaque), (ldb_qsort_cmp_fn_t)comparison); \ - comparison(&((base)0), &((base)1), opaque); \ + if (0) { \ + comparison(&((base)0), &((base)1), opaque); \ + } \ } \ } while (0) @@ -2306,7 +2314,9 @@ do { \ if (numel > 1) { \ qsort(base, numel, sizeof((base)0), (int (*)(const void *, const void *))comparison); \ - comparison(&((base)0), &((base)1)); \ + if (0) { \ + comparison(&((base)0), &((base)1)); \ + } \ } \ } while (0) #endif
View file
_service:tar_scm:ldb-2.6.1.tar.gz/include/ldb_module.h -> _service:tar_scm:ldb-2.7.2.tar.gz/include/ldb_module.h
Changed
@@ -102,6 +102,12 @@ */ #define LDB_FLAG_INTERNAL_SHARED_VALUES 0x200 +/* + * this attribute has been access checked. We know the user has the right to + * view it. Used internally in Samba aclread module. + */ +#define LDB_FLAG_INTERNAL_ACCESS_CHECKED 0x400 + /* an extended match rule that always fails to match */ #define SAMBA_LDAP_MATCH_ALWAYS_FALSE "1.3.6.1.4.1.7165.4.5.1" @@ -490,6 +496,9 @@ */ bool ldb_dn_replace_components(struct ldb_dn *dn, struct ldb_dn *new_dn); +/* Get the attribute (if any) associated with the top node of a parse tree. */ +const char *ldb_parse_tree_get_attr(const struct ldb_parse_tree *tree); + /* walk a parse tree, calling the provided callback on each node */ @@ -513,6 +522,15 @@ int ldb_register_extended_match_rule(struct ldb_context *ldb, const struct ldb_extended_match_rule *rule); +void ldb_msg_element_mark_inaccessible(struct ldb_message_element *el); +bool ldb_msg_element_is_inaccessible(const struct ldb_message_element *el); +void ldb_msg_remove_inaccessible(struct ldb_message *msg); + +typedef int (*ldb_redact_fn)(struct ldb_module *, struct ldb_request *, struct ldb_message *); +int ldb_register_redact_callback(struct ldb_context *ldb, + ldb_redact_fn redact_fn, + struct ldb_module *module); + /* * these pack/unpack functions are exposed in the library for use by * ldb tools like ldbdump and for use in tests, @@ -538,6 +556,19 @@ const struct ldb_message *msg, const char *const *attrs, struct ldb_message *filtered_msg); + +/* + * filter the specified list of attributes from msg, + * adding requested attributes, and perhaps all for *. + * Unlike ldb_filter_attrs(), the DN will not be added + * if it is missing. + */ +int ldb_filter_attrs_in_place(struct ldb_message *msg, + const char *const *attrs); + +/* Have an unpacked ldb message take talloc ownership of its elements. */ +int ldb_msg_elements_take_ownership(struct ldb_message *msg); + /* * Unpack a ldb message from a linear buffer in ldb_val *
View file
_service:tar_scm:ldb-2.6.1.tar.gz/include/ldb_private.h -> _service:tar_scm:ldb-2.7.2.tar.gz/include/ldb_private.h
Changed
@@ -1,4 +1,4 @@ -/* +/* ldb database library Copyright (C) Andrew Tridgell 2004 @@ -8,7 +8,7 @@ ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -84,7 +84,7 @@ struct ldb_schema { void *attribute_handler_override_private; ldb_attribute_handler_override_fn_t attribute_handler_override; - + /* attribute handling table */ unsigned num_attributes; struct ldb_schema_attribute *attributes; @@ -119,6 +119,11 @@ struct ldb_extended_match_entry *prev, *next; } *extended_match_rules; + struct { + struct ldb_module *module; + ldb_redact_fn callback; + } redact; + /* custom utf8 functions */ struct ldb_utf8_fns utf8_fns; @@ -233,10 +238,10 @@ size_t line_no; }; -struct ldb_ldif *ldb_ldif_read_file_state(struct ldb_context *ldb, +struct ldb_ldif *ldb_ldif_read_file_state(struct ldb_context *ldb, struct ldif_read_file_state *state); -char *ldb_ldif_write_redacted_trace_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, +char *ldb_ldif_write_redacted_trace_string(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, const struct ldb_ldif *ldif); /* @@ -317,4 +322,33 @@ const struct ldb_parse_tree *tree, enum ldb_scope scope, bool *matched); +/* + check if the scope matches in a search result +*/ +int ldb_match_scope(struct ldb_context *ldb, + struct ldb_dn *base, + struct ldb_dn *dn, + enum ldb_scope scope); + +/* Reallocate elements to drop any excess capacity. */ +void ldb_msg_shrink_to_fit(struct ldb_message *msg); + +/* + add the special distinguishedName element +*/ +int ldb_msg_add_distinguished_name(struct ldb_message *msg); + +/** + * @brief Convert a character to uppercase with ASCII precedence. + * + * This will convert a character to uppercase. If the character is an ASCII + * character it will convert it to uppercase ASCII first and then fallback to + * localized toupper() from libc. + * + * @param c The character to convert. + * + * @return The converted character or c if the conversion was not possible. + */ +char ldb_ascii_toupper(char c); + #endif
View file
_service:tar_scm:ldb-2.6.1.tar.gz/ldb_key_value/ldb_kv.h -> _service:tar_scm:ldb-2.7.2.tar.gz/ldb_key_value/ldb_kv.h
Changed
@@ -301,10 +301,8 @@ const struct ldb_val ldb_key, struct ldb_message *msg, unsigned int unpack_flags); -int ldb_kv_filter_attrs(struct ldb_context *ldb, - const struct ldb_message *msg, - const char *const *attrs, - struct ldb_message *filtered_msg); +int ldb_kv_filter_attrs_in_place(struct ldb_message *msg, + const char *const *attrs); int ldb_kv_search(struct ldb_kv_context *ctx); /*
View file
_service:tar_scm:ldb-2.6.1.tar.gz/ldb_key_value/ldb_kv_index.c -> _service:tar_scm:ldb-2.7.2.tar.gz/ldb_key_value/ldb_kv_index.c
Changed
@@ -2264,7 +2264,6 @@ { struct ldb_context *ldb = ldb_module_get_ctx(ac->module); struct ldb_message *msg; - struct ldb_message *filtered_msg; unsigned int i; unsigned int num_keys = 0; uint8_t previous_guid_keyLDB_KV_GUID_KEY_SIZE = {0}; @@ -2435,17 +2434,31 @@ * * LDB_SCOPE_BASE is not passed in by our only caller. */ - if (ac->scope == LDB_SCOPE_ONELEVEL && - ldb_kv->cache->one_level_indexes && - scope_one_truncation == KEY_NOT_TRUNCATED) { - ret = ldb_match_message(ldb, msg, ac->tree, - ac->scope, &matched); - } else { - ret = ldb_match_msg_error(ldb, msg, - ac->tree, ac->base, - ac->scope, &matched); + if (ac->scope != LDB_SCOPE_ONELEVEL || + !ldb_kv->cache->one_level_indexes || + scope_one_truncation != KEY_NOT_TRUNCATED) + { + /* + * The redaction callback may be expensive to call if it + * fetches a security descriptor. Check the DN early and + * bail out if it doesn't match the base. + */ + if (!ldb_match_scope(ldb, ac->base, msg->dn, ac->scope)) { + talloc_free(msg); + continue; + } } + if (ldb->redact.callback != NULL) { + ret = ldb->redact.callback(ldb->redact.module, ac->req, msg); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + return ret; + } + } + + ret = ldb_match_message(ldb, msg, ac->tree, + ac->scope, &matched); if (ret != LDB_SUCCESS) { talloc_free(keys); talloc_free(msg); @@ -2456,27 +2469,31 @@ continue; } - filtered_msg = ldb_msg_new(ac); - if (filtered_msg == NULL) { - TALLOC_FREE(keys); - TALLOC_FREE(msg); + ret = ldb_msg_add_distinguished_name(msg); + if (ret == -1) { + talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } - filtered_msg->dn = talloc_steal(filtered_msg, msg->dn); - /* filter the attributes that the user wants */ - ret = ldb_kv_filter_attrs(ldb, msg, ac->attrs, filtered_msg); + ret = ldb_kv_filter_attrs_in_place(msg, ac->attrs); + if (ret != LDB_SUCCESS) { + talloc_free(keys); + talloc_free(msg); + return LDB_ERR_OPERATIONS_ERROR; + } - talloc_free(msg); + ldb_msg_shrink_to_fit(msg); - if (ret == -1) { - TALLOC_FREE(filtered_msg); + /* Ensure the message elements are all talloc'd. */ + ret = ldb_msg_elements_take_ownership(msg); + if (ret != LDB_SUCCESS) { talloc_free(keys); + talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } - ret = ldb_module_send_entry(ac->req, filtered_msg, NULL); + ret = ldb_module_send_entry(ac->req, msg, NULL); if (ret != LDB_SUCCESS) { /* Regardless of success or failure, the msg * is the callbacks responsiblity, and should
View file
_service:tar_scm:ldb-2.6.1.tar.gz/ldb_key_value/ldb_kv_search.c -> _service:tar_scm:ldb-2.7.2.tar.gz/ldb_key_value/ldb_kv_search.c
Changed
@@ -292,15 +292,13 @@ /* * filter the specified list of attributes from msg, - * adding requested attributes, and perhaps all for *, - * but not the DN to filtered_msg. + * adding requested attributes, and perhaps all for *. + * The DN will not be added if it is missing. */ -int ldb_kv_filter_attrs(struct ldb_context *ldb, - const struct ldb_message *msg, - const char *const *attrs, - struct ldb_message *filtered_msg) +int ldb_kv_filter_attrs_in_place(struct ldb_message *msg, + const char *const *attrs) { - return ldb_filter_attrs(ldb, msg, attrs, filtered_msg); + return ldb_filter_attrs_in_place(msg, attrs); } /* @@ -313,7 +311,7 @@ { struct ldb_context *ldb; struct ldb_kv_context *ac; - struct ldb_message *msg, *filtered_msg; + struct ldb_message *msg; struct timeval now; int ret, timeval_cmp; bool matched; @@ -397,9 +395,27 @@ } } + /* + * The redaction callback may be expensive to call if it fetches a + * security descriptor. Check the DN early and bail out if it doesn't + * match the base. + */ + if (!ldb_match_scope(ldb, ac->base, msg->dn, ac->scope)) { + talloc_free(msg); + return 0; + } + + if (ldb->redact.callback != NULL) { + ret = ldb->redact.callback(ldb->redact.module, ac->req, msg); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + return ret; + } + } + /* see if it matches the given expression */ - ret = ldb_match_msg_error(ldb, msg, - ac->tree, ac->base, ac->scope, &matched); + ret = ldb_match_message(ldb, msg, + ac->tree, ac->scope, &matched); if (ret != LDB_SUCCESS) { talloc_free(msg); ac->error = LDB_ERR_OPERATIONS_ERROR; @@ -410,25 +426,31 @@ return 0; } - filtered_msg = ldb_msg_new(ac); - if (filtered_msg == NULL) { - TALLOC_FREE(msg); + ret = ldb_msg_add_distinguished_name(msg); + if (ret == -1) { + talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; } - filtered_msg->dn = talloc_steal(filtered_msg, msg->dn); - /* filter the attributes that the user wants */ - ret = ldb_kv_filter_attrs(ldb, msg, ac->attrs, filtered_msg); - talloc_free(msg); + ret = ldb_kv_filter_attrs_in_place(msg, ac->attrs); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + ac->error = LDB_ERR_OPERATIONS_ERROR; + return -1; + } - if (ret == -1) { - TALLOC_FREE(filtered_msg); + ldb_msg_shrink_to_fit(msg); + + /* Ensure the message elements are all talloc'd. */ + ret = ldb_msg_elements_take_ownership(msg); + if (ret != LDB_SUCCESS) { + talloc_free(msg); ac->error = LDB_ERR_OPERATIONS_ERROR; return -1; } - ret = ldb_module_send_entry(ac->req, filtered_msg, NULL); + ret = ldb_module_send_entry(ac->req, msg, NULL); if (ret != LDB_SUCCESS) { ac->request_terminated = true; /* the callback failed, abort the operation */ @@ -491,7 +513,7 @@ static int ldb_kv_search_and_return_base(struct ldb_kv_private *ldb_kv, struct ldb_kv_context *ctx) { - struct ldb_message *msg, *filtered_msg; + struct ldb_message *msg; struct ldb_context *ldb = ldb_module_get_ctx(ctx->module); const char *dn_linearized; const char *msg_dn_linearized; @@ -526,6 +548,13 @@ return ret; } + if (ldb->redact.callback != NULL) { + ret = ldb->redact.callback(ldb->redact.module, ctx->req, msg); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + return ret; + } + } /* * We use this, not ldb_match_msg_error() as we know @@ -549,12 +578,6 @@ dn_linearized = ldb_dn_get_linearized(ctx->base); msg_dn_linearized = ldb_dn_get_linearized(msg->dn); - filtered_msg = ldb_msg_new(ctx); - if (filtered_msg == NULL) { - talloc_free(msg); - return LDB_ERR_OPERATIONS_ERROR; - } - if (strcmp(dn_linearized, msg_dn_linearized) == 0) { /* * If the DN is exactly the same string, then @@ -562,36 +585,42 @@ * returned result, as it has already been * casefolded */ - filtered_msg->dn = ldb_dn_copy(filtered_msg, ctx->base); + struct ldb_dn *dn = ldb_dn_copy(msg, ctx->base); + if (dn != NULL) { + msg->dn = dn; + } } - /* - * If the ldb_dn_copy() failed, or if we did not choose that - * optimisation (filtered_msg is zeroed at allocation), - * steal the one from the unpack - */ - if (filtered_msg->dn == NULL) { - filtered_msg->dn = talloc_steal(filtered_msg, msg->dn); + ret = ldb_msg_add_distinguished_name(msg); + if (ret == -1) { + talloc_free(msg); + return LDB_ERR_OPERATIONS_ERROR; } /* * filter the attributes that the user wants. */ - ret = ldb_kv_filter_attrs(ldb, msg, ctx->attrs, filtered_msg); - if (ret == -1) { + ret = ldb_kv_filter_attrs_in_place(msg, ctx->attrs); + if (ret != LDB_SUCCESS) { + talloc_free(msg); + return LDB_ERR_OPERATIONS_ERROR; + } + + ldb_msg_shrink_to_fit(msg); + + /* Ensure the message elements are all talloc'd. */ + ret = ldb_msg_elements_take_ownership(msg); + if (ret != LDB_SUCCESS) { talloc_free(msg); - filtered_msg = NULL; return LDB_ERR_OPERATIONS_ERROR; } /* - * Remove any extended components possibly copied in from - * msg->dn, we just want the casefold components + * Remove any extended components, we just want the casefold components */ - ldb_dn_remove_extended_components(filtered_msg->dn); - talloc_free(msg); + ldb_dn_remove_extended_components(msg->dn); - ret = ldb_module_send_entry(ctx->req, filtered_msg, NULL); + ret = ldb_module_send_entry(ctx->req, msg, NULL); if (ret != LDB_SUCCESS) { /* Regardless of success or failure, the msg * is the callbacks responsiblity, and should
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/replace.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/replace.c
Changed
@@ -33,6 +33,10 @@ #include "system/locale.h" #include "system/wait.h" +#ifdef HAVE_SYS_SYSCALL_H +#include <sys/syscall.h> +#endif + #ifdef _WIN32 #define mkdir(d,m) _mkdir(d) #endif @@ -1058,9 +1062,6 @@ #endif /* HAVE_GETPROGNAME */ #ifndef HAVE_COPY_FILE_RANGE -# ifdef HAVE_SYSCALL_COPY_FILE_RANGE -# include <sys/syscall.h> -# endif ssize_t rep_copy_file_range(int fd_in, loff_t *off_in, int fd_out, @@ -1081,3 +1082,64 @@ return -1; } #endif /* HAVE_COPY_FILE_RANGE */ + +#ifndef HAVE_OPENAT2 + +/* fallback known wellknown __NR_openat2 values */ +#ifndef __NR_openat2 +# if defined(LINUX) && defined(HAVE_SYS_SYSCALL_H) +# if defined(__i386__) +# define __NR_openat2 437 +# elif defined(__x86_64__) && defined(__LP64__) +# define __NR_openat2 437 /* 437 0x1B5 */ +# elif defined(__x86_64__) && defined(__ILP32__) +# define __NR_openat2 1073742261 /* 1073742261 0x400001B5 */ +# elif defined(__aarch64__) +# define __NR_openat2 437 +# elif defined(__arm__) +# define __NR_openat2 437 +# elif defined(__sparc__) +# define __NR_openat2 437 +# endif +# endif /* defined(LINUX) && defined(HAVE_SYS_SYSCALL_H) */ +#endif /* !__NR_openat2 */ + +#ifdef DISABLE_OPATH +/* + * systems without O_PATH also don't have openat2, + * so make sure we at a realistic combination. + */ +#undef __NR_openat2 +#endif /* DISABLE_OPATH */ + +long rep_openat2(int dirfd, const char *pathname, + struct open_how *how, size_t size) +{ +#ifdef __NR_openat2 +#if _FILE_OFFSET_BITS == 64 && SIZE_MAX == 0xffffffffUL && defined(O_LARGEFILE) + struct open_how __how; + +#if defined(O_PATH) && ! defined(DISABLE_OPATH) + if ((how->flags & O_PATH) == 0) +#endif + { + if (sizeof(__how) == size) { + __how = *how; + + __how.flags |= O_LARGEFILE; + how = &__how; + } + } +#endif + + return syscall(__NR_openat2, + dirfd, + pathname, + how, + size); +#else + errno = ENOSYS; + return -1; +#endif +} +#endif /* !HAVE_OPENAT2 */
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/replace.h -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/replace.h
Changed
@@ -699,13 +699,9 @@ #include <stdbool.h> #endif -#if !defined(HAVE_BOOL) -#ifdef HAVE__Bool -#define bool _Bool -#else +#ifndef HAVE_BOOL #error Need a real boolean type #endif -#endif #if !defined(HAVE_INTPTR_T) typedef long long intptr_t ; @@ -847,6 +843,35 @@ #define ZERO_ARRAY_LEN(x, l) memset_s((char *)(x), (l), 0, (l)) /** + * Explicitly zero data from memory. This is guaranteed to be not optimized + * away. + */ +#define BURN_DATA(x) memset_s((char *)&(x), sizeof(x), 0, sizeof(x)) + +/** + * Explicitly zero data from memory. This is guaranteed to be not optimized + * away. + */ +#define BURN_DATA_SIZE(x, s) memset_s((char *)&(x), (s), 0, (s)) + +/** + * Explicitly zero data from memory. This is guaranteed to be not optimized + * away. + */ +#define BURN_PTR_SIZE(x, s) memset_s((x), (s), 0, (s)) + +/** + * Explicitly zero data in string. This is guaranteed to be not optimized + * away. + */ +#define BURN_STR(x) do { \ + if ((x) != NULL) { \ + size_t s = strlen(x); \ + memset_s((x), s, 0, s); \ + } \ + } while(0) + +/** * Work out how many elements there are in a static array. */ #ifdef ARRAY_SIZE @@ -1057,4 +1082,16 @@ #include <sys/atomic.h> #endif +/* + * This handles the case of missing pthread support and ensures code can use + * __thread unconditionally, such that when built on a platform without pthread + * support, the __thread qualifier is an empty define. + */ +#ifndef HAVE___THREAD +# ifdef HAVE_PTHREAD +# error Configure failed to detect pthread library with missing TLS support +# endif +#define HAVE___THREAD +#endif + #endif /* _LIBREPLACE_REPLACE_H */
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/snprintf.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/snprintf.c
Changed
@@ -751,6 +751,8 @@ while (chunks) { cnk = chunks->next; + if (chunks->min_star) free(chunks->min_star); + if (chunks->max_star) free(chunks->max_star); free(chunks); chunks = cnk; }
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/system/filesys.h -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/system/filesys.h
Changed
@@ -36,7 +36,8 @@ #include <sys/param.h> #endif -#ifdef HAVE_SYS_MOUNT_H +/* This include is required on UNIX (*BSD, AIX, ...) for statfs() */ +#if !defined(LINUX) && defined(HAVE_SYS_MOUNT_H) #include <sys/mount.h> #endif @@ -44,6 +45,7 @@ #include <mntent.h> #endif +/* This include is required on Linux for statfs() */ #ifdef HAVE_SYS_VFS_H #include <sys/vfs.h> #endif @@ -241,4 +243,39 @@ #endif /* !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS) */ +#ifdef HAVE_LINUX_OPENAT2_H +#include <linux/openat2.h> +#else /* ! HAVE_LINUX_OPENAT2_H */ +/* how->resolve flags for openat2(2). */ +#define RESOLVE_NO_XDEV 0x01 /* Block mount-point crossings + (includes bind-mounts). */ +#define RESOLVE_NO_MAGICLINKS 0x02 /* Block traversal through procfs-style + "magic-links". */ +#define RESOLVE_NO_SYMLINKS 0x04 /* Block traversal through all symlinks + (implies OEXT_NO_MAGICLINKS) */ +#define RESOLVE_BENEATH 0x08 /* Block "lexical" trickery like + "..", symlinks, and absolute + paths which escape the dirfd. */ +#define RESOLVE_IN_ROOT 0x10 /* Make all jumps to "/" and ".." + be scoped inside the dirfd + (similar to chroot(2)). */ +#define RESOLVE_CACHED 0x20 /* Only complete if resolution can be + completed through cached lookup. May + return -EAGAIN if that's not + possible. */ +struct __rep_open_how { + uint64_t flags; + uint64_t mode; + uint64_t resolve; +}; +#define open_how __rep_open_how +#endif /* ! HAVE_LINUX_OPENAT2_H */ + +#ifndef HAVE_OPENAT2 +long rep_openat2(int dirfd, const char *pathname, + struct open_how *how, size_t size); +#define openat2(dirfd, pathname, how, size) \ + rep_openat2(dirfd, pathname, how, size) +#endif /* !HAVE_OPENAT2 */ + #endif
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/system/network.h -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/system/network.h
Changed
@@ -91,6 +91,8 @@ #include <stropts.h> #endif +#include <limits.h> + #ifndef HAVE_SOCKLEN_T #define HAVE_SOCKLEN_T typedef int socklen_t; @@ -342,6 +344,16 @@ # endif #endif +#ifndef PIPE_BUF +# ifdef __GNU__ + /* + * GNU/Hurd does not have such hardcoded limitations. But it has to support + * the minimum POSIX value anyway. + */ +# define PIPE_BUF 512 +# endif +#endif + #ifndef HAVE_STRUCT_ADDRINFO #define HAVE_STRUCT_ADDRINFO struct addrinfo {
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/system/select.h -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/system/select.h
Changed
@@ -34,10 +34,6 @@ #include <sys/epoll.h> #endif -#ifdef HAVE_SOLARIS_PORTS -#include <port.h> -#endif - #ifndef SELECT_CAST #define SELECT_CAST #endif
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/wscript -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/wscript
Changed
@@ -31,6 +31,9 @@ conf.env.standalone_replace = conf.IN_LAUNCH_DIR() + if sys.platform.rfind('linux') > -1: + conf.DEFINE('LINUX', '1') + conf.DEFINE('BOOL_DEFINED', 1) conf.DEFINE('HAVE_LIBREPLACE', 1) conf.DEFINE('LIBREPLACE_NETWORK_CHECKS', 1) @@ -41,7 +44,6 @@ conf.CHECK_HEADERS('locale.h ndir.h pwd.h') conf.CHECK_HEADERS('shadow.h sys/acl.h') conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h') - conf.CHECK_HEADERS('port.h') conf.CHECK_HEADERS('sys/fcntl.h sys/filio.h sys/filsys.h sys/fs/s5param.h') conf.CHECK_HEADERS('sys/id.h sys/ioctl.h sys/ipc.h sys/mman.h sys/mode.h sys/ndir.h sys/priv.h') conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h') @@ -63,6 +65,7 @@ conf.CHECK_HEADERS('errno.h') conf.CHECK_HEADERS('getopt.h iconv.h') conf.CHECK_HEADERS('memory.h nss.h sasl/sasl.h') + conf.CHECK_HEADERS('linux/openat2.h') conf.CHECK_FUNCS_IN('inotify_init', 'inotify', checklibc=True, headers='sys/inotify.h') @@ -156,8 +159,7 @@ msg='Checking for O_DIRECT flag to open(2)') conf.CHECK_TYPES('"long long" intptr_t uintptr_t ptrdiff_t comparison_fn_t') - if not conf.CHECK_TYPE('bool', define='HAVE_BOOL'): - if not conf.CHECK_TYPE('_Bool', define='HAVE__Bool'): + if not conf.CHECK_TYPE('bool', define='HAVE_BOOL', headers='stdbool.h'): raise Errors.WafError('Samba requires a genuine boolean type') conf.CHECK_TYPE('int8_t', 'char') @@ -479,7 +481,6 @@ conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups syscall setsid') conf.CHECK_FUNCS('getgrent_r getgrgid_r getgrnam_r getgrouplist getpagesize') conf.CHECK_FUNCS('getpwent_r getpwnam_r getpwuid_r epoll_create') - conf.CHECK_FUNCS('port_create') conf.CHECK_FUNCS('getprogname') if not conf.CHECK_FUNCS('copy_file_range'): conf.CHECK_CODE(''' @@ -670,7 +671,8 @@ conf.CONFIG_SET('HAVE_PTHREAD_MUTEX_CONSISTENT_NP'))): conf.DEFINE('HAVE_ROBUST_MUTEXES', 1) - # __thread is available since 2002 in gcc. + # __thread is available in Solaris Studio, IBM XL, + # gcc, Clang and Intel C Compiler conf.CHECK_CODE(''' __thread int tls; @@ -682,6 +684,9 @@ addmain=False, msg='Checking for __thread local storage') + if conf.CONFIG_SET('HAVE_PTHREAD') and not conf.CONFIG_SET('HAVE___THREAD'): + conf.fatal('Missing required TLS support in pthread library') + conf.CHECK_FUNCS_IN('crypt', 'crypt', checklibc=True) conf.CHECK_FUNCS_IN('crypt_r', 'crypt', checklibc=True) conf.CHECK_FUNCS_IN('crypt_rn', 'crypt', checklibc=True) @@ -701,9 +706,6 @@ if conf.CONFIG_SET('HAVE_EPOLL_CREATE') and conf.CONFIG_SET('HAVE_SYS_EPOLL_H'): conf.DEFINE('HAVE_EPOLL', 1) - if conf.CONFIG_SET('HAVE_PORT_CREATE') and conf.CONFIG_SET('HAVE_PORT_H'): - conf.DEFINE('HAVE_SOLARIS_PORTS', 1) - if conf.CHECK_FUNCS('eventfd', headers='sys/eventfd.h'): conf.DEFINE('HAVE_EVENTFD', 1) @@ -930,9 +932,9 @@ bld.SAMBA_LIBRARY('replace', source=REPLACE_SOURCE, group='base_libraries', - # FIXME: Ideally symbols should be hidden here so they - # don't appear in the global namespace when Samba - # libraries are loaded, but this doesn't appear to work + # FIXME: Ideally symbols should be hidden here so they + # don't appear in the global namespace when Samba + # libraries are loaded, but this doesn't appear to work # at the moment: # hide_symbols=bld.BUILTIN_LIBRARY('replace'), private_library=True,
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/xattr.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/replace/xattr.c
Changed
@@ -210,7 +210,8 @@ static ssize_t bsd_attr_list (int type, extattr_arg arg, char *list, size_t size) { ssize_t list_size, total_size = 0; - int i, t, len; + int i, len; + size_t t; char *buf; /* Iterate through extattr(2) namespaces */ for(t = 0; t < ARRAY_SIZE(extattr); t++) { @@ -266,6 +267,18 @@ for(i = 0; i < list_size; i += len + 1) { len = bufi; + + /* + * If for some reason we receive a truncated + * return from call to list xattrs the pascal + * string lengths will not be changed and + * therefore we must check that we're not + * reading garbage data or off end of array + */ + if (len + i >= list_size) { + errno = ERANGE; + return -1; + } strncpy(list, extattrt.name, extattrt.len + 1); list += extattrt.len; strncpy(list, buf + i + 1, len);
View file
_service:tar_scm:ldb-2.7.2.tar.gz/lib/talloc/ABI/pytalloc-util-2.3.5.sigs
Added
@@ -0,0 +1,16 @@ +_pytalloc_check_type: int (PyObject *, const char *) +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_name: const char *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_Check: int (PyObject *) +pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/lib/talloc/ABI/pytalloc-util-2.4.0.sigs
Added
@@ -0,0 +1,16 @@ +_pytalloc_check_type: int (PyObject *, const char *) +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_name: const char *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_Check: int (PyObject *) +pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/lib/talloc/ABI/talloc-2.3.5.sigs
Added
@@ -0,0 +1,66 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_addbuf: void (char **, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/lib/talloc/ABI/talloc-2.4.0.sigs
Added
@@ -0,0 +1,66 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_addbuf: void (char **, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/talloc/talloc.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/talloc/talloc.c
Changed
@@ -831,7 +831,7 @@ static inline void *_talloc_pool(const void *context, size_t size) { - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; struct talloc_pool_hdr *pool_hdr; void *result; @@ -977,7 +977,7 @@ static inline void *_talloc_named_const(const void *context, size_t size, const char *name) { void *ptr; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) { @@ -1537,7 +1537,7 @@ va_list ap; void *ptr; const char *name; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) return NULL; @@ -1633,7 +1633,7 @@ va_list ap; void *ptr; const char *name; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ptr = __talloc(NULL, 0, &tc); if (unlikely(ptr == NULL)) return NULL; @@ -2449,7 +2449,7 @@ static inline char *__talloc_strlendup(const void *t, const char *p, size_t len) { char *ret; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ret = (char *)__talloc(t, len + 1, &tc); if (unlikely(!ret)) return NULL; @@ -2595,7 +2595,7 @@ size_t len; char *ret; va_list ap2; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; char buf1024; /* this call looks strange, but it makes it work on older solaris boxes */ @@ -2752,6 +2752,29 @@ return s; } +_PUBLIC_ void talloc_asprintf_addbuf(char **ps, const char *fmt, ...) +{ + va_list ap; + char *s = *ps; + char *t = NULL; + + if (s == NULL) { + return; + } + + va_start(ap, fmt); + t = talloc_vasprintf_append_buffer(s, fmt, ap); + va_end(ap); + + if (t == NULL) { + /* signal failure to the next caller */ + TALLOC_FREE(s); + *ps = NULL; + } else { + *ps = t; + } +} + /* alloc an array, checking for integer overflow in the array size */
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/talloc/talloc.h -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/talloc/talloc.h
Changed
@@ -56,7 +56,7 @@ */ #define TALLOC_VERSION_MAJOR 2 -#define TALLOC_VERSION_MINOR 3 +#define TALLOC_VERSION_MINOR 4 _PUBLIC_ int talloc_version_major(void); _PUBLIC_ int talloc_version_minor(void); @@ -1579,6 +1579,20 @@ _PUBLIC_ char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); /** + * @brief Build up a string buffer, handle allocation failure + * + * @paramin ps Pointer to the talloc'ed string to be extended + * @paramin fmt The format string + * @paramin ... The parameters used to fill fmt. + * + * This does nothing if *ps is NULL and sets *ps to NULL if the + * intermediate reallocation fails. Useful when building up a string + * step by step, no intermediate NULL checks are required. + */ +_PUBLIC_ void talloc_asprintf_addbuf(char **ps, const char *fmt, ...) \ + PRINTF_ATTRIBUTE(2,3); + +/** * @brief Format a string. * * This function is the talloc equivalent of the C library function asprintf(3).
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/talloc/wscript -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/talloc/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.3.4' +VERSION = '2.4.0' import os import sys
View file
_service:tar_scm:ldb-2.7.2.tar.gz/lib/tdb/ABI/tdb-1.4.8.sigs
Added
@@ -0,0 +1,73 @@ +tdb_add_flags: void (struct tdb_context *, unsigned int) +tdb_append: int (struct tdb_context *, TDB_DATA, TDB_DATA) +tdb_chainlock: int (struct tdb_context *, TDB_DATA) +tdb_chainlock_mark: int (struct tdb_context *, TDB_DATA) +tdb_chainlock_nonblock: int (struct tdb_context *, TDB_DATA) +tdb_chainlock_read: int (struct tdb_context *, TDB_DATA) +tdb_chainlock_read_nonblock: int (struct tdb_context *, TDB_DATA) +tdb_chainlock_unmark: int (struct tdb_context *, TDB_DATA) +tdb_chainunlock: int (struct tdb_context *, TDB_DATA) +tdb_chainunlock_read: int (struct tdb_context *, TDB_DATA) +tdb_check: int (struct tdb_context *, int (*)(TDB_DATA, TDB_DATA, void *), void *) +tdb_close: int (struct tdb_context *) +tdb_delete: int (struct tdb_context *, TDB_DATA) +tdb_dump_all: void (struct tdb_context *) +tdb_enable_seqnum: void (struct tdb_context *) +tdb_error: enum TDB_ERROR (struct tdb_context *) +tdb_errorstr: const char *(struct tdb_context *) +tdb_exists: int (struct tdb_context *, TDB_DATA) +tdb_fd: int (struct tdb_context *) +tdb_fetch: TDB_DATA (struct tdb_context *, TDB_DATA) +tdb_firstkey: TDB_DATA (struct tdb_context *) +tdb_freelist_size: int (struct tdb_context *) +tdb_get_flags: int (struct tdb_context *) +tdb_get_logging_private: void *(struct tdb_context *) +tdb_get_seqnum: int (struct tdb_context *) +tdb_hash_size: int (struct tdb_context *) +tdb_increment_seqnum_nonblock: void (struct tdb_context *) +tdb_jenkins_hash: unsigned int (TDB_DATA *) +tdb_lock_nonblock: int (struct tdb_context *, int, int) +tdb_lockall: int (struct tdb_context *) +tdb_lockall_mark: int (struct tdb_context *) +tdb_lockall_nonblock: int (struct tdb_context *) +tdb_lockall_read: int (struct tdb_context *) +tdb_lockall_read_nonblock: int (struct tdb_context *) +tdb_lockall_unmark: int (struct tdb_context *) +tdb_log_fn: tdb_log_func (struct tdb_context *) +tdb_map_size: size_t (struct tdb_context *) +tdb_name: const char *(struct tdb_context *) +tdb_nextkey: TDB_DATA (struct tdb_context *, TDB_DATA) +tdb_null: dptr = 0xXXXX, dsize = 0 +tdb_open: struct tdb_context *(const char *, int, int, int, mode_t) +tdb_open_ex: struct tdb_context *(const char *, int, int, int, mode_t, const struct tdb_logging_context *, tdb_hash_func) +tdb_parse_record: int (struct tdb_context *, TDB_DATA, int (*)(TDB_DATA, TDB_DATA, void *), void *) +tdb_printfreelist: int (struct tdb_context *) +tdb_remove_flags: void (struct tdb_context *, unsigned int) +tdb_reopen: int (struct tdb_context *) +tdb_reopen_all: int (int) +tdb_repack: int (struct tdb_context *) +tdb_rescue: int (struct tdb_context *, void (*)(TDB_DATA, TDB_DATA, void *), void *) +tdb_runtime_check_for_robust_mutexes: bool (void) +tdb_set_logging_function: void (struct tdb_context *, const struct tdb_logging_context *) +tdb_set_max_dead: void (struct tdb_context *, int) +tdb_setalarm_sigptr: void (struct tdb_context *, volatile sig_atomic_t *) +tdb_store: int (struct tdb_context *, TDB_DATA, TDB_DATA, int) +tdb_storev: int (struct tdb_context *, TDB_DATA, const TDB_DATA *, int, int) +tdb_summary: char *(struct tdb_context *) +tdb_transaction_active: bool (struct tdb_context *) +tdb_transaction_cancel: int (struct tdb_context *) +tdb_transaction_commit: int (struct tdb_context *) +tdb_transaction_prepare_commit: int (struct tdb_context *) +tdb_transaction_start: int (struct tdb_context *) +tdb_transaction_start_nonblock: int (struct tdb_context *) +tdb_transaction_write_lock_mark: int (struct tdb_context *) +tdb_transaction_write_lock_unmark: int (struct tdb_context *) +tdb_traverse: int (struct tdb_context *, tdb_traverse_func, void *) +tdb_traverse_chain: int (struct tdb_context *, unsigned int, tdb_traverse_func, void *) +tdb_traverse_key_chain: int (struct tdb_context *, TDB_DATA, tdb_traverse_func, void *) +tdb_traverse_read: int (struct tdb_context *, tdb_traverse_func, void *) +tdb_unlock: int (struct tdb_context *, int, int) +tdb_unlockall: int (struct tdb_context *) +tdb_unlockall_read: int (struct tdb_context *) +tdb_validate_freelist: int (struct tdb_context *, int *) +tdb_wipe_all: int (struct tdb_context *)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/common/error.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tdb/common/error.c
Changed
@@ -32,26 +32,43 @@ return tdb->ecode; } -static struct tdb_errname { - enum TDB_ERROR ecode; const char *estring; -} emap = { {TDB_SUCCESS, "Success"}, - {TDB_ERR_CORRUPT, "Corrupt database"}, - {TDB_ERR_IO, "IO Error"}, - {TDB_ERR_LOCK, "Locking error"}, - {TDB_ERR_OOM, "Out of memory"}, - {TDB_ERR_EXISTS, "Record exists"}, - {TDB_ERR_NOLOCK, "Lock exists on other keys"}, - {TDB_ERR_EINVAL, "Invalid parameter"}, - {TDB_ERR_NOEXIST, "Record does not exist"}, - {TDB_ERR_RDONLY, "write not permitted"} }; - -/* Error string for the last tdb error */ _PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb) { - uint32_t i; - for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++) - if (tdb->ecode == emapi.ecode) - return emapi.estring; + switch (tdb->ecode) { + case TDB_SUCCESS: + return "Success"; + break; + case TDB_ERR_CORRUPT: + return "Corrupt database"; + break; + case TDB_ERR_IO: + return "IO Error"; + break; + case TDB_ERR_LOCK: + return "Locking error"; + break; + case TDB_ERR_OOM: + return "Out of memory"; + break; + case TDB_ERR_EXISTS: + return "Record exists"; + break; + case TDB_ERR_NOLOCK: + return "Lock exists on other keys"; + break; + case TDB_ERR_EINVAL: + return "Invalid parameter"; + break; + case TDB_ERR_NOEXIST: + return "Record does not exist"; + break; + case TDB_ERR_RDONLY: + return "write not permitted"; + break; + default: + break; + } + return "Invalid error code"; }
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/wscript -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tdb/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tdb' -VERSION = '1.4.7' +VERSION = '1.4.8' import sys, os
View file
_service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/ABI/tevent-0.14.0.sigs
Added
@@ -0,0 +1,157 @@ +_tevent_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +_tevent_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +_tevent_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +_tevent_context_pop_use: void (struct tevent_context *, const char *) +_tevent_context_push_use: bool (struct tevent_context *, const char *) +_tevent_context_wrapper_create: struct tevent_context *(struct tevent_context *, TALLOC_CTX *, const struct tevent_wrapper_ops *, void *, size_t, const char *, const char *) +_tevent_create_immediate: struct tevent_immediate *(TALLOC_CTX *, const char *) +_tevent_loop_once: int (struct tevent_context *, const char *) +_tevent_loop_until: int (struct tevent_context *, bool (*)(void *), void *, const char *) +_tevent_loop_wait: int (struct tevent_context *, const char *) +_tevent_queue_create: struct tevent_queue *(TALLOC_CTX *, const char *, const char *) +_tevent_req_callback_data: void *(struct tevent_req *) +_tevent_req_cancel: bool (struct tevent_req *, const char *) +_tevent_req_create: struct tevent_req *(TALLOC_CTX *, void *, size_t, const char *, const char *) +_tevent_req_data: void *(struct tevent_req *) +_tevent_req_done: void (struct tevent_req *, const char *) +_tevent_req_error: bool (struct tevent_req *, uint64_t, const char *) +_tevent_req_nomem: bool (const void *, struct tevent_req *, const char *) +_tevent_req_notify_callback: void (struct tevent_req *, const char *) +_tevent_req_oom: void (struct tevent_req *, const char *) +_tevent_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +_tevent_threaded_schedule_immediate: void (struct tevent_threaded_context *, struct tevent_immediate *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_abort: void (struct tevent_context *, const char *) +tevent_backend_list: const char **(TALLOC_CTX *) +tevent_cached_getpid: pid_t (void) +tevent_cleanup_pending_signal_handlers: void (struct tevent_signal *) +tevent_common_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +tevent_common_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +tevent_common_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_add_timer_v2: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_check_double_free: void (TALLOC_CTX *, const char *) +tevent_common_check_signal: int (struct tevent_context *) +tevent_common_context_destructor: int (struct tevent_context *) +tevent_common_fd_destructor: int (struct tevent_fd *) +tevent_common_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_common_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_common_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_common_have_events: bool (struct tevent_context *) +tevent_common_invoke_fd_handler: int (struct tevent_fd *, uint16_t, bool *) +tevent_common_invoke_immediate_handler: int (struct tevent_immediate *, bool *) +tevent_common_invoke_signal_handler: int (struct tevent_signal *, int, int, void *, bool *) +tevent_common_invoke_timer_handler: int (struct tevent_timer *, struct timeval, bool *) +tevent_common_loop_immediate: bool (struct tevent_context *) +tevent_common_loop_timer_delay: struct timeval (struct tevent_context *) +tevent_common_loop_wait: int (struct tevent_context *, const char *) +tevent_common_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_common_threaded_activate_immediate: void (struct tevent_context *) +tevent_common_wakeup: int (struct tevent_context *) +tevent_common_wakeup_fd: int (int) +tevent_common_wakeup_init: int (struct tevent_context *) +tevent_context_init: struct tevent_context *(TALLOC_CTX *) +tevent_context_init_byname: struct tevent_context *(TALLOC_CTX *, const char *) +tevent_context_init_ops: struct tevent_context *(TALLOC_CTX *, const struct tevent_ops *, void *) +tevent_context_is_wrapper: bool (struct tevent_context *) +tevent_context_same_loop: bool (struct tevent_context *, struct tevent_context *) +tevent_debug: void (struct tevent_context *, enum tevent_debug_level, const char *, ...) +tevent_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_fd_get_tag: uint64_t (const struct tevent_fd *) +tevent_fd_set_auto_close: void (struct tevent_fd *) +tevent_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_fd_set_tag: void (struct tevent_fd *, uint64_t) +tevent_find_ops_byname: const struct tevent_ops *(const char *) +tevent_get_trace_callback: void (struct tevent_context *, tevent_trace_callback_t *, void *) +tevent_get_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t *, void *) +tevent_get_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t *, void *) +tevent_get_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t *, void *) +tevent_get_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t *, void *) +tevent_get_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t *, void *) +tevent_immediate_get_tag: uint64_t (const struct tevent_immediate *) +tevent_immediate_set_tag: void (struct tevent_immediate *, uint64_t) +tevent_loop_allow_nesting: void (struct tevent_context *) +tevent_loop_set_nesting_hook: void (struct tevent_context *, tevent_nesting_hook, void *) +tevent_num_signals: size_t (void) +tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_entry_get_tag: uint64_t (const struct tevent_queue_entry *) +tevent_queue_entry_set_tag: void (struct tevent_queue_entry *, uint64_t) +tevent_queue_entry_untrigger: void (struct tevent_queue_entry *) +tevent_queue_length: size_t (struct tevent_queue *) +tevent_queue_running: bool (struct tevent_queue *) +tevent_queue_start: void (struct tevent_queue *) +tevent_queue_stop: void (struct tevent_queue *) +tevent_queue_wait_recv: bool (struct tevent_req *) +tevent_queue_wait_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct tevent_queue *) +tevent_re_initialise: int (struct tevent_context *) +tevent_register_backend: bool (const char *, const struct tevent_ops *) +tevent_req_default_print: char *(struct tevent_req *, TALLOC_CTX *) +tevent_req_defer_callback: void (struct tevent_req *, struct tevent_context *) +tevent_req_get_profile: const struct tevent_req_profile *(struct tevent_req *) +tevent_req_is_error: bool (struct tevent_req *, enum tevent_req_state *, uint64_t *) +tevent_req_is_in_progress: bool (struct tevent_req *) +tevent_req_move_profile: struct tevent_req_profile *(struct tevent_req *, TALLOC_CTX *) +tevent_req_poll: bool (struct tevent_req *, struct tevent_context *) +tevent_req_post: struct tevent_req *(struct tevent_req *, struct tevent_context *) +tevent_req_print: char *(TALLOC_CTX *, struct tevent_req *) +tevent_req_profile_append_sub: void (struct tevent_req_profile *, struct tevent_req_profile **) +tevent_req_profile_create: struct tevent_req_profile *(TALLOC_CTX *) +tevent_req_profile_get_name: void (const struct tevent_req_profile *, const char **) +tevent_req_profile_get_start: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_status: void (const struct tevent_req_profile *, pid_t *, enum tevent_req_state *, uint64_t *) +tevent_req_profile_get_stop: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_subprofiles: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_next: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_set_name: bool (struct tevent_req_profile *, const char *) +tevent_req_profile_set_start: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_profile_set_status: void (struct tevent_req_profile *, pid_t, enum tevent_req_state, uint64_t) +tevent_req_profile_set_stop: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_received: void (struct tevent_req *) +tevent_req_reset_endtime: void (struct tevent_req *) +tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, void *) +tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn) +tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn) +tevent_req_set_endtime: bool (struct tevent_req *, struct tevent_context *, struct timeval) +tevent_req_set_print_fn: void (struct tevent_req *, tevent_req_print_fn) +tevent_req_set_profile: bool (struct tevent_req *) +tevent_sa_info_queue_count: size_t (void) +tevent_set_abort_fn: void (void (*)(const char *)) +tevent_set_debug: int (struct tevent_context *, void (*)(void *, enum tevent_debug_level, const char *, va_list), void *) +tevent_set_debug_stderr: int (struct tevent_context *) +tevent_set_default_backend: void (const char *) +tevent_set_trace_callback: void (struct tevent_context *, tevent_trace_callback_t, void *) +tevent_set_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t, void *) +tevent_set_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t, void *) +tevent_set_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t, void *) +tevent_set_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t, void *) +tevent_set_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t, void *) +tevent_signal_get_tag: uint64_t (const struct tevent_signal *) +tevent_signal_set_tag: void (struct tevent_signal *, uint64_t) +tevent_signal_support: bool (struct tevent_context *) +tevent_thread_call_depth_activate: void (size_t *) +tevent_thread_call_depth_deactivate: void (void) +tevent_thread_call_depth_reset_from_req: void (struct tevent_req *) +tevent_thread_call_depth_start: void (struct tevent_req *) +tevent_thread_proxy_create: struct tevent_thread_proxy *(struct tevent_context *) +tevent_thread_proxy_schedule: void (struct tevent_thread_proxy *, struct tevent_immediate **, tevent_immediate_handler_t, void *) +tevent_threaded_context_create: struct tevent_threaded_context *(TALLOC_CTX *, struct tevent_context *) +tevent_timer_get_tag: uint64_t (const struct tevent_timer *) +tevent_timer_set_tag: void (struct tevent_timer *, uint64_t) +tevent_timeval_add: struct timeval (const struct timeval *, uint32_t, uint32_t) +tevent_timeval_compare: int (const struct timeval *, const struct timeval *) +tevent_timeval_current: struct timeval (void) +tevent_timeval_current_ofs: struct timeval (uint32_t, uint32_t) +tevent_timeval_is_zero: bool (const struct timeval *) +tevent_timeval_set: struct timeval (uint32_t, uint32_t) +tevent_timeval_until: struct timeval (const struct timeval *, const struct timeval *) +tevent_timeval_zero: struct timeval (void) +tevent_trace_fd_callback: void (struct tevent_context *, struct tevent_fd *, enum tevent_event_trace_point) +tevent_trace_immediate_callback: void (struct tevent_context *, struct tevent_immediate *, enum tevent_event_trace_point) +tevent_trace_point_callback: void (struct tevent_context *, enum tevent_trace_point) +tevent_trace_queue_callback: void (struct tevent_context *, struct tevent_queue_entry *, enum tevent_event_trace_point) +tevent_trace_signal_callback: void (struct tevent_context *, struct tevent_signal *, enum tevent_event_trace_point) +tevent_trace_timer_callback: void (struct tevent_context *, struct tevent_timer *, enum tevent_event_trace_point) +tevent_update_timer: void (struct tevent_timer *, struct timeval) +tevent_wakeup_recv: bool (struct tevent_req *) +tevent_wakeup_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct timeval)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/ABI/tevent-0.14.1.sigs
Added
@@ -0,0 +1,157 @@ +_tevent_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +_tevent_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +_tevent_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +_tevent_context_pop_use: void (struct tevent_context *, const char *) +_tevent_context_push_use: bool (struct tevent_context *, const char *) +_tevent_context_wrapper_create: struct tevent_context *(struct tevent_context *, TALLOC_CTX *, const struct tevent_wrapper_ops *, void *, size_t, const char *, const char *) +_tevent_create_immediate: struct tevent_immediate *(TALLOC_CTX *, const char *) +_tevent_loop_once: int (struct tevent_context *, const char *) +_tevent_loop_until: int (struct tevent_context *, bool (*)(void *), void *, const char *) +_tevent_loop_wait: int (struct tevent_context *, const char *) +_tevent_queue_create: struct tevent_queue *(TALLOC_CTX *, const char *, const char *) +_tevent_req_callback_data: void *(struct tevent_req *) +_tevent_req_cancel: bool (struct tevent_req *, const char *) +_tevent_req_create: struct tevent_req *(TALLOC_CTX *, void *, size_t, const char *, const char *) +_tevent_req_data: void *(struct tevent_req *) +_tevent_req_done: void (struct tevent_req *, const char *) +_tevent_req_error: bool (struct tevent_req *, uint64_t, const char *) +_tevent_req_nomem: bool (const void *, struct tevent_req *, const char *) +_tevent_req_notify_callback: void (struct tevent_req *, const char *) +_tevent_req_oom: void (struct tevent_req *, const char *) +_tevent_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +_tevent_threaded_schedule_immediate: void (struct tevent_threaded_context *, struct tevent_immediate *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_abort: void (struct tevent_context *, const char *) +tevent_backend_list: const char **(TALLOC_CTX *) +tevent_cached_getpid: pid_t (void) +tevent_cleanup_pending_signal_handlers: void (struct tevent_signal *) +tevent_common_add_fd: struct tevent_fd *(struct tevent_context *, TALLOC_CTX *, int, uint16_t, tevent_fd_handler_t, void *, const char *, const char *) +tevent_common_add_signal: struct tevent_signal *(struct tevent_context *, TALLOC_CTX *, int, int, tevent_signal_handler_t, void *, const char *, const char *) +tevent_common_add_timer: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_add_timer_v2: struct tevent_timer *(struct tevent_context *, TALLOC_CTX *, struct timeval, tevent_timer_handler_t, void *, const char *, const char *) +tevent_common_check_double_free: void (TALLOC_CTX *, const char *) +tevent_common_check_signal: int (struct tevent_context *) +tevent_common_context_destructor: int (struct tevent_context *) +tevent_common_fd_destructor: int (struct tevent_fd *) +tevent_common_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_common_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_common_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_common_have_events: bool (struct tevent_context *) +tevent_common_invoke_fd_handler: int (struct tevent_fd *, uint16_t, bool *) +tevent_common_invoke_immediate_handler: int (struct tevent_immediate *, bool *) +tevent_common_invoke_signal_handler: int (struct tevent_signal *, int, int, void *, bool *) +tevent_common_invoke_timer_handler: int (struct tevent_timer *, struct timeval, bool *) +tevent_common_loop_immediate: bool (struct tevent_context *) +tevent_common_loop_timer_delay: struct timeval (struct tevent_context *) +tevent_common_loop_wait: int (struct tevent_context *, const char *) +tevent_common_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *) +tevent_common_threaded_activate_immediate: void (struct tevent_context *) +tevent_common_wakeup: int (struct tevent_context *) +tevent_common_wakeup_fd: int (int) +tevent_common_wakeup_init: int (struct tevent_context *) +tevent_context_init: struct tevent_context *(TALLOC_CTX *) +tevent_context_init_byname: struct tevent_context *(TALLOC_CTX *, const char *) +tevent_context_init_ops: struct tevent_context *(TALLOC_CTX *, const struct tevent_ops *, void *) +tevent_context_is_wrapper: bool (struct tevent_context *) +tevent_context_same_loop: bool (struct tevent_context *, struct tevent_context *) +tevent_debug: void (struct tevent_context *, enum tevent_debug_level, const char *, ...) +tevent_fd_get_flags: uint16_t (struct tevent_fd *) +tevent_fd_get_tag: uint64_t (const struct tevent_fd *) +tevent_fd_set_auto_close: void (struct tevent_fd *) +tevent_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t) +tevent_fd_set_flags: void (struct tevent_fd *, uint16_t) +tevent_fd_set_tag: void (struct tevent_fd *, uint64_t) +tevent_find_ops_byname: const struct tevent_ops *(const char *) +tevent_get_trace_callback: void (struct tevent_context *, tevent_trace_callback_t *, void *) +tevent_get_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t *, void *) +tevent_get_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t *, void *) +tevent_get_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t *, void *) +tevent_get_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t *, void *) +tevent_get_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t *, void *) +tevent_immediate_get_tag: uint64_t (const struct tevent_immediate *) +tevent_immediate_set_tag: void (struct tevent_immediate *, uint64_t) +tevent_loop_allow_nesting: void (struct tevent_context *) +tevent_loop_set_nesting_hook: void (struct tevent_context *, tevent_nesting_hook, void *) +tevent_num_signals: size_t (void) +tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_entry: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_add_optimize_empty: struct tevent_queue_entry *(struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *) +tevent_queue_entry_get_tag: uint64_t (const struct tevent_queue_entry *) +tevent_queue_entry_set_tag: void (struct tevent_queue_entry *, uint64_t) +tevent_queue_entry_untrigger: void (struct tevent_queue_entry *) +tevent_queue_length: size_t (struct tevent_queue *) +tevent_queue_running: bool (struct tevent_queue *) +tevent_queue_start: void (struct tevent_queue *) +tevent_queue_stop: void (struct tevent_queue *) +tevent_queue_wait_recv: bool (struct tevent_req *) +tevent_queue_wait_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct tevent_queue *) +tevent_re_initialise: int (struct tevent_context *) +tevent_register_backend: bool (const char *, const struct tevent_ops *) +tevent_req_default_print: char *(struct tevent_req *, TALLOC_CTX *) +tevent_req_defer_callback: void (struct tevent_req *, struct tevent_context *) +tevent_req_get_profile: const struct tevent_req_profile *(struct tevent_req *) +tevent_req_is_error: bool (struct tevent_req *, enum tevent_req_state *, uint64_t *) +tevent_req_is_in_progress: bool (struct tevent_req *) +tevent_req_move_profile: struct tevent_req_profile *(struct tevent_req *, TALLOC_CTX *) +tevent_req_poll: bool (struct tevent_req *, struct tevent_context *) +tevent_req_post: struct tevent_req *(struct tevent_req *, struct tevent_context *) +tevent_req_print: char *(TALLOC_CTX *, struct tevent_req *) +tevent_req_profile_append_sub: void (struct tevent_req_profile *, struct tevent_req_profile **) +tevent_req_profile_create: struct tevent_req_profile *(TALLOC_CTX *) +tevent_req_profile_get_name: void (const struct tevent_req_profile *, const char **) +tevent_req_profile_get_start: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_status: void (const struct tevent_req_profile *, pid_t *, enum tevent_req_state *, uint64_t *) +tevent_req_profile_get_stop: void (const struct tevent_req_profile *, const char **, struct timeval *) +tevent_req_profile_get_subprofiles: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_next: const struct tevent_req_profile *(const struct tevent_req_profile *) +tevent_req_profile_set_name: bool (struct tevent_req_profile *, const char *) +tevent_req_profile_set_start: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_profile_set_status: void (struct tevent_req_profile *, pid_t, enum tevent_req_state, uint64_t) +tevent_req_profile_set_stop: bool (struct tevent_req_profile *, const char *, struct timeval) +tevent_req_received: void (struct tevent_req *) +tevent_req_reset_endtime: void (struct tevent_req *) +tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, void *) +tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn) +tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn) +tevent_req_set_endtime: bool (struct tevent_req *, struct tevent_context *, struct timeval) +tevent_req_set_print_fn: void (struct tevent_req *, tevent_req_print_fn) +tevent_req_set_profile: bool (struct tevent_req *) +tevent_sa_info_queue_count: size_t (void) +tevent_set_abort_fn: void (void (*)(const char *)) +tevent_set_debug: int (struct tevent_context *, void (*)(void *, enum tevent_debug_level, const char *, va_list), void *) +tevent_set_debug_stderr: int (struct tevent_context *) +tevent_set_default_backend: void (const char *) +tevent_set_trace_callback: void (struct tevent_context *, tevent_trace_callback_t, void *) +tevent_set_trace_fd_callback: void (struct tevent_context *, tevent_trace_fd_callback_t, void *) +tevent_set_trace_immediate_callback: void (struct tevent_context *, tevent_trace_immediate_callback_t, void *) +tevent_set_trace_queue_callback: void (struct tevent_context *, tevent_trace_queue_callback_t, void *) +tevent_set_trace_signal_callback: void (struct tevent_context *, tevent_trace_signal_callback_t, void *) +tevent_set_trace_timer_callback: void (struct tevent_context *, tevent_trace_timer_callback_t, void *) +tevent_signal_get_tag: uint64_t (const struct tevent_signal *) +tevent_signal_set_tag: void (struct tevent_signal *, uint64_t) +tevent_signal_support: bool (struct tevent_context *) +tevent_thread_call_depth_activate: void (size_t *) +tevent_thread_call_depth_deactivate: void (void) +tevent_thread_call_depth_reset_from_req: void (struct tevent_req *) +tevent_thread_call_depth_start: void (struct tevent_req *) +tevent_thread_proxy_create: struct tevent_thread_proxy *(struct tevent_context *) +tevent_thread_proxy_schedule: void (struct tevent_thread_proxy *, struct tevent_immediate **, tevent_immediate_handler_t, void *) +tevent_threaded_context_create: struct tevent_threaded_context *(TALLOC_CTX *, struct tevent_context *) +tevent_timer_get_tag: uint64_t (const struct tevent_timer *) +tevent_timer_set_tag: void (struct tevent_timer *, uint64_t) +tevent_timeval_add: struct timeval (const struct timeval *, uint32_t, uint32_t) +tevent_timeval_compare: int (const struct timeval *, const struct timeval *) +tevent_timeval_current: struct timeval (void) +tevent_timeval_current_ofs: struct timeval (uint32_t, uint32_t) +tevent_timeval_is_zero: bool (const struct timeval *) +tevent_timeval_set: struct timeval (uint32_t, uint32_t) +tevent_timeval_until: struct timeval (const struct timeval *, const struct timeval *) +tevent_timeval_zero: struct timeval (void) +tevent_trace_fd_callback: void (struct tevent_context *, struct tevent_fd *, enum tevent_event_trace_point) +tevent_trace_immediate_callback: void (struct tevent_context *, struct tevent_immediate *, enum tevent_event_trace_point) +tevent_trace_point_callback: void (struct tevent_context *, enum tevent_trace_point) +tevent_trace_queue_callback: void (struct tevent_context *, struct tevent_queue_entry *, enum tevent_event_trace_point) +tevent_trace_signal_callback: void (struct tevent_context *, struct tevent_signal *, enum tevent_event_trace_point) +tevent_trace_timer_callback: void (struct tevent_context *, struct tevent_timer *, enum tevent_event_trace_point) +tevent_update_timer: void (struct tevent_timer *, struct timeval) +tevent_wakeup_recv: bool (struct tevent_req *) +tevent_wakeup_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct timeval)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/pytevent.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/pytevent.c
Changed
@@ -73,134 +73,6 @@ static PyTypeObject TeventTimer_Type; static PyTypeObject TeventFd_Type; -static int py_context_init(struct tevent_context *ev) -{ - /* FIXME */ - return 0; -} - -static struct tevent_fd *py_add_fd(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - tevent_fd_handler_t handler, - void *private_data, - const char *handler_name, - const char *location) -{ - /* FIXME */ - return NULL; -} - -static void py_set_fd_close_fn(struct tevent_fd *fde, - tevent_fd_close_fn_t close_fn) -{ - /* FIXME */ -} - -static uint16_t py_get_fd_flags(struct tevent_fd *fde) -{ - /* FIXME */ - return 0; -} - -static void py_set_fd_flags(struct tevent_fd *fde, uint16_t flags) -{ - /* FIXME */ -} - -/* timed_event functions */ -static struct tevent_timer *py_add_timer(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - struct timeval next_event, - tevent_timer_handler_t handler, - void *private_data, - const char *handler_name, - const char *location) -{ - /* FIXME */ - return NULL; -} - -/* immediate event functions */ -static void py_schedule_immediate(struct tevent_immediate *im, - struct tevent_context *ev, - tevent_immediate_handler_t handler, - void *private_data, - const char *handler_name, - const char *location) -{ - /* FIXME */ -} - -/* signal functions */ -static struct tevent_signal *py_add_signal(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - int signum, int sa_flags, - tevent_signal_handler_t handler, - void *private_data, - const char *handler_name, - const char *location) -{ - /* FIXME */ - return NULL; -} - -/* loop functions */ -static int py_loop_once(struct tevent_context *ev, const char *location) -{ - /* FIXME */ - return 0; -} - -static int py_loop_wait(struct tevent_context *ev, const char *location) -{ - /* FIXME */ - return 0; -} - -const static struct tevent_ops py_tevent_ops = { - .context_init = py_context_init, - .add_fd = py_add_fd, - .set_fd_close_fn = py_set_fd_close_fn, - .get_fd_flags = py_get_fd_flags, - .set_fd_flags = py_set_fd_flags, - .add_timer = py_add_timer, - .schedule_immediate = py_schedule_immediate, - .add_signal = py_add_signal, - .loop_wait = py_loop_wait, - .loop_once = py_loop_once, -}; - -static PyObject *py_register_backend(PyObject *self, PyObject *args) -{ - PyObject *name, *py_backend; - - if (!PyArg_ParseTuple(args, "O", &py_backend)) - return NULL; - - name = PyObject_GetAttrString(py_backend, "name"); - if (name == NULL) { - PyErr_SetNone(PyExc_AttributeError); - return NULL; - } - - if (!PyUnicode_Check(name)) { - PyErr_SetNone(PyExc_TypeError); - Py_DECREF(name); - return NULL; - } - - if (!tevent_register_backend(PyUnicode_AsUTF8(name), &py_tevent_ops)) { /* FIXME: What to do with backend */ - PyErr_SetNone(PyExc_RuntimeError); - Py_DECREF(name); - return NULL; - } - - Py_DECREF(name); - - Py_RETURN_NONE; -} - static PyObject *py_tevent_context_reinitialise(TeventContext_Object *self, PyObject *Py_UNUSED(ignored)) { @@ -855,8 +727,6 @@ } static PyMethodDef tevent_methods = { - { "register_backend", (PyCFunction)py_register_backend, METH_VARARGS, - "register_backend(backend)" }, { "set_default_backend", (PyCFunction)py_set_default_backend, METH_VARARGS, "set_default_backend(backend)" }, { "backend_list", (PyCFunction)py_backend_list,
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/testsuite.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/testsuite.c
Changed
@@ -37,6 +37,32 @@ #include <assert.h> #endif +static struct tevent_context * +test_tevent_context_init(TALLOC_CTX *mem_ctx) +{ + struct tevent_context *ev = NULL; + + ev = tevent_context_init(mem_ctx); + if (ev != NULL) { + samba_tevent_set_debug(ev, "<default>"); + } + + return ev; +} + +static struct tevent_context * +test_tevent_context_init_byname(TALLOC_CTX *mem_ctx, const char *name) +{ + struct tevent_context *ev = NULL; + + ev = tevent_context_init_byname(mem_ctx, name); + if (ev != NULL) { + samba_tevent_set_debug(ev, name); + } + + return ev; +} + static int fde_count; static void do_read(int fd, void *buf, size_t count) @@ -143,7 +169,7 @@ struct timeval t; int ret; - ev_ctx = tevent_context_init_byname(test, backend); + ev_ctx = test_tevent_context_init_byname(test, backend); if (ev_ctx == NULL) { torture_comment(test, "event backend '%s' not supported\n", backend); return true; @@ -383,7 +409,7 @@ state.tctx = tctx; state.backend = (const char *)test_data; - state.ev = tevent_context_init_byname(tctx, state.backend); + state.ev = test_tevent_context_init_byname(tctx, state.backend); if (state.ev == NULL) { torture_skip(tctx, talloc_asprintf(tctx, "event backend '%s' not supported\n", @@ -391,7 +417,6 @@ return true; } - tevent_set_debug_stderr(state.ev); torture_comment(tctx, "backend '%s' - %s\n", state.backend, __FUNCTION__); @@ -623,7 +648,7 @@ state.tctx = tctx; state.backend = (const char *)test_data; - state.ev = tevent_context_init_byname(tctx, state.backend); + state.ev = test_tevent_context_init_byname(tctx, state.backend); if (state.ev == NULL) { torture_skip(tctx, talloc_asprintf(tctx, "event backend '%s' not supported\n", @@ -631,7 +656,6 @@ return true; } - tevent_set_debug_stderr(state.ev); torture_comment(tctx, "backend '%s' - %s\n", state.backend, __FUNCTION__); @@ -956,7 +980,7 @@ bool ok = false; bool ret2; - ev = tevent_context_init_byname(tctx, backend); + ev = test_tevent_context_init_byname(tctx, backend); if (ev == NULL) { torture_skip(tctx, talloc_asprintf(tctx, "event backend '%s' not supported\n", @@ -964,7 +988,6 @@ return true; } - tevent_set_debug_stderr(ev); torture_comment(tctx, "tevent backend '%s'\n", backend); wrap_ev = tevent_context_wrapper_create( @@ -1130,7 +1153,7 @@ int ret; bool ok = false; - ev = tevent_context_init_byname(frame, backend); + ev = test_tevent_context_init_byname(frame, backend); if (ev == NULL) { torture_skip(tctx, talloc_asprintf(tctx, "event backend '%s' not supported\n", @@ -1138,7 +1161,6 @@ return true; } - tevent_set_debug_stderr(ev); torture_comment(tctx, "tevent backend '%s'\n", backend); wrap_ev = tevent_context_wrapper_create( @@ -1294,7 +1316,7 @@ int ret; char c = 0; - ev = tevent_context_init_byname(test, "poll_mt"); + ev = test_tevent_context_init_byname(test, "poll_mt"); torture_assert(test, ev != NULL, "poll_mt not supported"); tevent_set_trace_callback(ev, test_event_threaded_trace, NULL); @@ -1411,11 +1433,10 @@ thread_test_ctx = test; thread_counter = 0; - master_ev = tevent_context_init(NULL); + master_ev = test_tevent_context_init(NULL); if (master_ev == NULL) { return false; } - tevent_set_debug_stderr(master_ev); tp = tevent_thread_proxy_create(master_ev); if (tp == NULL) { @@ -1612,11 +1633,10 @@ thread_test_ctx = test; thread_counter = 0; - master_ev = tevent_context_init(NULL); + master_ev = test_tevent_context_init(NULL); if (master_ev == NULL) { return false; } - tevent_set_debug_stderr(master_ev); master_tp = tevent_thread_proxy_create(master_ev); if (master_tp == NULL) { @@ -1714,7 +1734,7 @@ thread_test_ctx = test; thread_counter = 0; - ev = tevent_context_init(test); + ev = test_tevent_context_init(test); torture_assert(test, ev != NULL, "tevent_context_init failed"); /*
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/tevent.c
Changed
@@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. main select loop and event handling Copyright (C) Andrew Tridgell 2003 @@ -130,14 +130,12 @@ tevent_poll_mt_init(); #if defined(HAVE_EPOLL) tevent_epoll_init(); -#elif defined(HAVE_SOLARIS_PORTS) - tevent_port_init(); #endif tevent_standard_init(); } -_PRIVATE_ const struct tevent_ops *tevent_find_ops_byname(const char *name) +const struct tevent_ops *tevent_find_ops_byname(const char *name) { struct tevent_ops_list *e; @@ -763,7 +761,7 @@ tevent_nesting_hook hook, void *private_data) { - if (ev->nesting.hook_fn && + if (ev->nesting.hook_fn && (ev->nesting.hook_fn != hook || ev->nesting.hook_private != private_data)) { /* the way the nesting hook code is currently written @@ -789,7 +787,7 @@ } /* - do a single event loop using the events defined in ev + do a single event loop using the events defined in ev */ int _tevent_loop_once(struct tevent_context *ev, const char *location) { @@ -825,6 +823,9 @@ ret = ev->ops->loop_once(ev, location); tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_LOOP_ONCE); + /* New event (and request) will always start with call depth 0. */ + tevent_thread_call_depth_set(0); + if (ev->nesting.level > 0) { if (ev->nesting.hook_fn) { int ret2; @@ -971,7 +972,7 @@ /* re-initialise a tevent context. This leaves you with the same event context, but all events are wiped and the structure is - re-initialised. This is most useful after a fork() + re-initialised. This is most useful after a fork() zero is returned on success, non-zero on failure */
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent.h -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/tevent.h
Changed
@@ -1929,6 +1929,169 @@ /** + * @defgroup tevent_thread_call_depth The tevent call depth tracking functions + * @ingroup tevent + * + * + * The call depth tracking consists of two parts. + * + * Part 1 - storing the depth inside each tevent request. + * + * Each instance of 'struct tevent_req' internally stores the value of the + * current depth. If a new subrequest is created via tevent_req_create(), the + * newly created subrequest gets the value from the parent incremented by 1. + * + * Part 2 - updating external variable with the call depth of the currently + * processed tevent request. + * + * The intended use of call depth is for the trace indentation. This is done + * by registering the address of an external size_t variable via + * tevent_thread_call_depth_activate(). And the tracing code just reads it's + * value. + * + * The updates happen during: + * + * tevent_req_create() + * - external variable is set to the value of the newly created request (i.e. + * value of the parent incremented by 1) + * + * tevent_req_notify_callback() + * - external variable is set to the value of the parent tevent request, which + * is just about to be processed + * + * tevent_queue_immediate_trigger() + * - external variable is set to the value of the request coming from the queue + * + * + * While 'Part 1' maintains the call depth value inside each teven request + * precisely, the value of the external variable depends on the call flow and + * can be changed after return from a function call, so it no longer matches + * the value of the request being processed in the current function. + * + * @code + * struct tevent_req *foo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev) + * { + * struct tevent_req *req, *subreq; + * struct foo_state *state; + * + * // External variable has value 'X', which is the value in parent code + * // It is ok, since tracing starts often only after tevent_req_create() + * req = tevent_req_create(mem_ctx, &state, struct foo_state); + * + * // External variable has now value 'X + 1' + * D_DEBUG("foo_send(): the external variable has the expected value\n"); + * + * subreq = bar_send(state, ev, ...); + * tevent_req_set_callback(subreq, foo_done, req); + * + * // External variable has value 'X + 1 + n', where n > 0 and n is the + * // depth reached in bar_send(). + * // We want to reset it via tevent_thread_call_depth_reset_from_req(), + * // since we want the following D_DEBUG() to have the right trace + * //indentation. + * + * tevent_thread_call_depth_reset_from_req(req); + * // External variable has again value 'X + 1' taken from req. + * D_DEBUG("foo_send(): the external variable has the expected value\n"); + * return req; + * } + * + * static void foo_done(struct tevent_req *subreq) + * { + * struct tevent_req *req = + * tevent_req_callback_data(subreq, + * struct tevent_req); + * struct foo_state *state = + * tevent_req_data(req, + * struct foo_state); + * + * // external variable has value 'X + 1' + * + * D_DEBUG("foo_done(): the external variable has the expected value\n"); + * status = bar_recv(subreq, state, ...) + * tevent_req_done(req); + * } + * + * NTSTATUS foo_recv(struct tevent_req *req) + * { + * struct foo_state *state = tevent_req_data( req, struct foo_state); + * + * // external variable has value 'X' (not 'X + 1') + * // which is ok, if we consider _recv() to be an access function + * // called from the parent context + * + * D_DEBUG("foo_recv(): external variable has the value from parent\n"); + * return NT_STATUS_OK; + * } + * @endcode + * + * Interface has 3 parts: + * + * Part 1: activation/deactivation + * + * tevent_thread_call_depth_activate(), tevent_thread_call_depth_deactivate() + * + * Activating registers external size_t variable that will be maintained with + * the current call depth. + * + * Part 2: Mark the request (and its subrequests) to be tracked + * + * tevent_thread_call_depth_start(struct tevent_req *req) + * + * By default, all newly created requests have call depth set to 0. + * tevent_thread_call_depth_start() should be called shortly after + * tevent_req_create(). It sets the call depth to 1. + * Subrequest will have call depth 2 and so on. + * + * Part 3: reset the external variable using value from tevent request + * + * tevent_thread_call_depth_reset_from_req(struct tevent_req *req) + * + * If the call depth is used for trace indentation, it might be usefull to + * reset the external variable to the call depth of currently processed tevent + * request, since the ext. variable can be changed after return from a function + * call that has created subrequests. + * + * THREADING + * + * The state is thread specific, i.e. each thread can activate it and register + * its own external variable. + * + * @{ + */ + +/** + * Activate call depth tracking and register external variable that will + * be updated to the call epth of currenty processed tevent request. + * + * @paramin ptr Address of external variable + */ +void tevent_thread_call_depth_activate(size_t *ptr); + +/** + * Deactivate call depth tracking. Can be used in the child process, + * after fork. + */ +void tevent_thread_call_depth_deactivate(void); + +/** + * This request will have call depth set to 1, its subrequest will get 2 and so + * on. All other requests will have call depth 0. + */ +void tevent_thread_call_depth_start(struct tevent_req *req); + +/** + * Set the external variable to the call depth of the request req. + * + * @paramin req Request from which the call depth is assigned to ext. + * variable. + */ +void tevent_thread_call_depth_reset_from_req(struct tevent_req *req); + +/* @} */ + + +/** * @defgroup tevent_queue The tevent queue functions * @ingroup tevent * @@ -2442,6 +2605,7 @@ }; bool tevent_register_backend(const char *name, const struct tevent_ops *ops); +const struct tevent_ops *tevent_find_ops_byname(const char *name); /* @} */
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_debug.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/tevent_debug.c
Changed
@@ -292,3 +292,41 @@ ev->tracing.qe.callback(qe, tp, ev->tracing.qe.private_data); } } + +static __thread size_t *tevent_thread_call_depth_ptr = NULL; + +void tevent_thread_call_depth_activate(size_t *ptr) +{ + tevent_thread_call_depth_ptr = ptr; + *tevent_thread_call_depth_ptr = 0; +} + +void tevent_thread_call_depth_deactivate(void) +{ + /* Reset the previous storage */ + if (tevent_thread_call_depth_ptr != NULL) { + *tevent_thread_call_depth_ptr = 0; + } + tevent_thread_call_depth_ptr = NULL; +} + +void tevent_thread_call_depth_start(struct tevent_req *req) +{ + if (tevent_thread_call_depth_ptr != NULL) { + *tevent_thread_call_depth_ptr = req->internal.call_depth = 1; + } +} + +void tevent_thread_call_depth_reset_from_req(struct tevent_req *req) +{ + if (tevent_thread_call_depth_ptr != NULL) { + *tevent_thread_call_depth_ptr = req->internal.call_depth; + } +} + +_PRIVATE_ void tevent_thread_call_depth_set(size_t depth) +{ + if (tevent_thread_call_depth_ptr != NULL) { + *tevent_thread_call_depth_ptr = depth; + } +}
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_internal.h -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/tevent_internal.h
Changed
@@ -169,6 +169,8 @@ * @brief The place where profiling data is kept */ struct tevent_req_profile *profile; + + size_t call_depth; } internal; }; @@ -397,8 +399,6 @@ #endif }; -const struct tevent_ops *tevent_find_ops_byname(const char *name); - int tevent_common_context_destructor(struct tevent_context *ev); int tevent_common_loop_wait(struct tevent_context *ev, const char *location); @@ -498,10 +498,8 @@ bool (*panic_fallback)(struct tevent_context *ev, bool replay)); #endif -#ifdef HAVE_SOLARIS_PORTS -bool tevent_port_init(void); -#endif +void tevent_thread_call_depth_set(size_t depth); void tevent_trace_point_callback(struct tevent_context *ev, enum tevent_trace_point);
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_queue.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/tevent_queue.c
Changed
@@ -149,6 +149,8 @@ tevent_trace_queue_callback(ev, q->list, TEVENT_EVENT_TRACE_BEFORE_HANDLER); + /* Set the call depth of the request coming from the queue. */ + tevent_thread_call_depth_set(q->list->req->internal.call_depth); q->list->triggered = true; q->list->trigger(q->list->req, q->list->private_data); }
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_req.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/tevent_req.c
Changed
@@ -120,6 +120,13 @@ } *ppdata = data; + + /* Initially, talloc_zero_size() sets internal.call_depth to 0 */ + if (parent != NULL && parent->internal.call_depth > 0) { + req->internal.call_depth = parent->internal.call_depth + 1; + tevent_thread_call_depth_set(req->internal.call_depth); + } + return req; } @@ -138,6 +145,9 @@ return; } if (req->async.fn != NULL) { + /* Calling back the parent code, decrement the call depth. */ + tevent_thread_call_depth_set(req->internal.call_depth > 0 ? + req->internal.call_depth - 1 : 0); req->async.fn(req); } }
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_standard.c -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/tevent_standard.c
Changed
@@ -166,7 +166,7 @@ * pointers. */ - if (ev->ops == &std_event_ops) { + if (ev->ops->loop_once == NULL) { glue = talloc_zero(ev, struct std_event_glue); if (glue == NULL) { return -1;
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/wscript -> _service:tar_scm:ldb-2.7.2.tar.gz/lib/tevent/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tevent' -VERSION = '0.13.0' +VERSION = '0.14.1' import sys, os @@ -93,9 +93,6 @@ if bld.CONFIG_SET('HAVE_EPOLL'): SRC += ' tevent_epoll.c' - if bld.CONFIG_SET('HAVE_SOLARIS_PORTS'): - SRC += ' tevent_port.c' - if bld.env.standalone_tevent: bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig' private_library = False
View file
_service:tar_scm:ldb-2.6.1.tar.gz/modules/rdn_name.c -> _service:tar_scm:ldb-2.7.2.tar.gz/modules/rdn_name.c
Changed
@@ -1,4 +1,4 @@ -/* +/* ldb database library Copyright (C) Andrew Bartlett 2005-2009 @@ -7,7 +7,7 @@ ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -116,7 +116,7 @@ if (rdn_name == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - + rdn_val_p = ldb_dn_get_rdn_val(msg->dn); if (rdn_val_p == NULL) { return LDB_ERR_OPERATIONS_ERROR; @@ -176,13 +176,13 @@ } if (i == attribute->num_values) { char *rdn_errstring = talloc_asprintf(ac, - "RDN mismatch on %s: %s (%.*s) should match one of:", - ldb_dn_get_linearized(msg->dn), rdn_name, + "RDN mismatch on %s: %s (%.*s) should match one of:", + ldb_dn_get_linearized(msg->dn), rdn_name, (int)rdn_val.length, (const char *)rdn_val.data); for (i = 0; i < attribute->num_values; i++) { - rdn_errstring = talloc_asprintf_append( - rdn_errstring, " (%.*s)", - (int)attribute->valuesi.length, + talloc_asprintf_addbuf( + &rdn_errstring, " (%.*s)", + (int)attribute->valuesi.length, (const char *)attribute->valuesi.data); } ldb_set_errstring(ldb, rdn_errstring);
View file
_service:tar_scm:ldb-2.6.1.tar.gz/pyldb.c -> _service:tar_scm:ldb-2.7.2.tar.gz/pyldb.c
Changed
@@ -639,6 +639,7 @@ { PyObject *py_other; struct ldb_dn *dn, *other; + bool ok; if (!PyArg_ParseTuple(args, "O", &py_other)) return NULL; @@ -647,13 +648,20 @@ if (!pyldb_Object_AsDn(NULL, py_other, ldb_dn_get_ldb_context(dn), &other)) return NULL; - return PyBool_FromLong(ldb_dn_add_child(dn, other)); + ok = ldb_dn_add_child(dn, other); + if (!ok) { + PyErr_SetLdbError(PyExc_LdbError, LDB_ERR_OPERATIONS_ERROR, NULL); + return NULL; + } + + Py_RETURN_TRUE; } static PyObject *py_ldb_dn_add_base(PyLdbDnObject *self, PyObject *args) { PyObject *py_other; struct ldb_dn *other, *dn; + bool ok; if (!PyArg_ParseTuple(args, "O", &py_other)) return NULL; @@ -662,19 +670,32 @@ if (!pyldb_Object_AsDn(NULL, py_other, ldb_dn_get_ldb_context(dn), &other)) return NULL; - return PyBool_FromLong(ldb_dn_add_base(dn, other)); + ok = ldb_dn_add_base(dn, other); + if (!ok) { + PyErr_SetLdbError(PyExc_LdbError, LDB_ERR_OPERATIONS_ERROR, NULL); + return NULL; + } + + Py_RETURN_TRUE; } static PyObject *py_ldb_dn_remove_base_components(PyLdbDnObject *self, PyObject *args) { struct ldb_dn *dn; int i; + bool ok; if (!PyArg_ParseTuple(args, "i", &i)) return NULL; dn = pyldb_Dn_AS_DN((PyObject *)self); - return PyBool_FromLong(ldb_dn_remove_base_components(dn, i)); + ok = ldb_dn_remove_base_components(dn, i); + if (!ok) { + PyErr_SetLdbError(PyExc_LdbError, LDB_ERR_OPERATIONS_ERROR, NULL); + return NULL; + } + + Py_RETURN_TRUE; } static PyObject *py_ldb_dn_is_child_of(PyLdbDnObject *self, PyObject *args) @@ -819,10 +840,10 @@ "S.parent() -> dn\n" "Get the parent for this DN." }, { "add_child", (PyCFunction)py_ldb_dn_add_child, METH_VARARGS, - "S.add_child(dn) -> None\n" + "S.add_child(dn) -> bool\n" "Add a child DN to this DN." }, { "add_base", (PyCFunction)py_ldb_dn_add_base, METH_VARARGS, - "S.add_base(dn) -> None\n" + "S.add_base(dn) -> bool\n" "Add a base DN to this DN." }, { "remove_base_components", (PyCFunction)py_ldb_dn_remove_base_components, METH_VARARGS, "S.remove_base_components(int) -> bool\n"
View file
_service:tar_scm:ldb-2.7.2.tar.gz/tests/ldb_filter_attrs_in_place_test.c
Added
@@ -0,0 +1,940 @@ +/* + * Tests exercising ldb_filter_attrs_in_place(). + * + * + * Copyright (C) Catalyst.NET Ltd 2017 + * Copyright (C) Andrew Bartlett <abartlet@samba.org> 2019 + * + * 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 <http://www.gnu.org/licenses/>. + * + */ + +/* + * from cmocka.c: + * These headers or their equivalents should be included prior to + * including + * this header file. + * + * #include <stdarg.h> + * #include <stddef.h> + * #include <setjmp.h> + * + * This allows test applications to use custom definitions of C standard + * library functions and types. + */ +#include <stdarg.h> +#include <stddef.h> +#include <stdint.h> +#include <string.h> +#include <setjmp.h> +#include <cmocka.h> + +#include "../include/ldb.h" +#include "../include/ldb_module.h" + +struct ldbtest_ctx { + struct tevent_context *ev; + struct ldb_context *ldb; +}; + +/* + * NOTE WELL: + * + * This test checks the current behaviour of the function, however + * this is not in a public ABI and many of the tested behaviours are + * not ideal. If the behaviour is deliberatly improved, this test + * should be updated without worry to the new better behaviour. + * + * In particular the test is particularly to ensure the current + * behaviour is memory-safe. + */ + +static int setup(void **state) +{ + struct ldbtest_ctx *test_ctx; + + test_ctx = talloc_zero(NULL, struct ldbtest_ctx); + assert_non_null(test_ctx); + + test_ctx->ev = tevent_context_init(test_ctx); + assert_non_null(test_ctx->ev); + + test_ctx->ldb = ldb_init(test_ctx, test_ctx->ev); + assert_non_null(test_ctx->ldb); + + *state = test_ctx; + return 0; +} + +static int teardown(void **state) +{ + talloc_free(*state); + return 0; +} + +static void msg_add_dn(struct ldb_message *msg) +{ + const char *dn_attr = "distinguishedName"; + char *dn = NULL; + int ret; + + assert_null(ldb_msg_find_element(msg, dn_attr)); + + assert_non_null(msg->dn); + dn = ldb_dn_alloc_linearized(msg, msg->dn); + assert_non_null(dn); + + /* + * The message's elements must be talloc allocated to call + * ldb_msg_add_steal_string(). + */ + msg->elements = talloc_memdup(msg, + msg->elements, + msg->num_elements * sizeof(msg->elements0)); + assert_non_null(msg->elements); + + ret = ldb_msg_add_steal_string(msg, dn_attr, dn); + assert_int_equal(ret, LDB_SUCCESS); +} + +/* + * Test against a record with only one attribute, matching the one in + * the list + */ +static void test_filter_attrs_in_place_one_attr_matched(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"foo", NULL}; + + char value = "The value.......end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value, + .length = strlen(value) + }; + struct ldb_message_element element_1 = { + .name = "foo", + .num_values = 1, + .values = &value_1 + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 1; + msg->elements = &element_1; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + + assert_non_null(msg->dn); + assert_int_equal(msg->num_elements, 1); + assert_string_equal(msg->elements0.name, "foo"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value)); + assert_memory_equal(msg->elements0.values0.data, + value, strlen(value)); +} + +/* + * Test against a record with only one attribute, matching the one of + * the multiple attributes in the list + */ +static void test_filter_attrs_in_place_one_attr_matched_of_many(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"foo", "bar", "baz", NULL}; + + char value = "The value.......end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value, + .length = strlen(value) + }; + struct ldb_message_element element_1 = { + .name = "foo", + .num_values = 1, + .values = &value_1 + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 1; + msg->elements = &element_1; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + + assert_non_null(msg->dn); + assert_int_equal(msg->num_elements, 1); + assert_string_equal(msg->elements0.name, "foo"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value)); + assert_memory_equal(msg->elements0.values0.data, + value, strlen(value)); +} + +/* + * Test against a record with only one attribute, matching both + * attributes in the list + */ +static void test_filter_attrs_in_place_two_attr_matched_attrs(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + /* deliberatly the other order */ + const char *attrs = {"bar", "foo", NULL}; + + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value1, + .length = strlen(value1) + }; + struct ldb_val value_2 = { + .data = (uint8_t *)value2, + .length = strlen(value2) + }; + + /* foo and bar are the other order to in attrs */ + struct ldb_message_element elements = { + { + .name = "foo", + .num_values = 1, + .values = &value_1 + }, + { + .name = "bar", + .num_values = 1, + .values = &value_2 + } + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 2; + msg->elements = elements; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 2); + + assert_non_null(msg->dn); + + /* Assert that DB order is preserved */ + assert_string_equal(msg->elements0.name, "foo"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value1)); + assert_memory_equal(msg->elements0.values0.data, + value1, strlen(value1)); + assert_string_equal(msg->elements1.name, "bar"); + assert_int_equal(msg->elements1.num_values, 1); + assert_int_equal(msg->elements1.values0.length, + strlen(value2)); + assert_memory_equal(msg->elements1.values0.data, + value2, strlen(value2)); +} + +/* + * Test against a record with two attributes, only of which is in + * the list + */ +static void test_filter_attrs_in_place_two_attr_matched_one_attr(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"bar", NULL}; + + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value1, + .length = strlen(value1) + }; + struct ldb_val value_2 = { + .data = (uint8_t *)value2, + .length = strlen(value2) + }; + + struct ldb_message_element elements = { + { + .name = "foo", + .num_values = 1, + .values = &value_1 + }, + { + .name = "bar", + .num_values = 1, + .values = &value_2 + } + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 2; + msg->elements = elements; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 1); + + assert_non_null(msg->dn); + + /* Assert that DB order is preserved */ + assert_string_equal(msg->elements0.name, "bar"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value2)); + assert_memory_equal(msg->elements0.values0.data, + value2, strlen(value2)); +} + +/* + * Test against a record with two attributes, both matching the one + * specified attribute in the list (a corrupt record) + */ +static void test_filter_attrs_in_place_two_dup_attr_matched_one_attr(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"bar", NULL}; + + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value1, + .length = strlen(value1) + }; + struct ldb_val value_2 = { + .data = (uint8_t *)value2, + .length = strlen(value2) + }; + + struct ldb_message_element elements = { + { + .name = "bar", + .num_values = 1, + .values = &value_1 + }, + { + .name = "bar", + .num_values = 1, + .values = &value_2 + } + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 2; + msg->elements = elements; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + + /* Both elements match the filter */ + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 2); + + assert_non_null(msg->dn); + + /* Assert that DB order is preserved */ + assert_string_equal(msg->elements0.name, "bar"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value1)); + assert_memory_equal(msg->elements0.values0.data, + value1, strlen(value1)); + + assert_string_equal(msg->elements1.name, "bar"); + assert_int_equal(msg->elements1.num_values, 1); + assert_int_equal(msg->elements1.values0.length, + strlen(value2)); + assert_memory_equal(msg->elements1.values0.data, + value2, strlen(value2)); +} + +/* + * Test against a record with two attributes, both matching the one + * specified attribute in the list (a corrupt record) + */ +static void test_filter_attrs_in_place_two_dup_attr_matched_dup(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"bar", "bar", NULL}; + + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value1, + .length = strlen(value1) + }; + struct ldb_val value_2 = { + .data = (uint8_t *)value2, + .length = strlen(value2) + }; + + struct ldb_message_element elements = { + { + .name = "bar", + .num_values = 1, + .values = &value_1 + }, + { + .name = "bar", + .num_values = 1, + .values = &value_2 + } + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 2; + msg->elements = elements; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + + /* This does not fail the pidgenhole test */ + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 2); + + /* Assert that DB order is preserved */ + assert_string_equal(msg->elements0.name, "bar"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value1)); + assert_memory_equal(msg->elements0.values0.data, + value1, strlen(value1)); + assert_string_equal(msg->elements1.name, "bar"); + assert_int_equal(msg->elements1.num_values, 1); + assert_int_equal(msg->elements1.values0.length, + strlen(value2)); + assert_memory_equal(msg->elements1.values0.data, + value2, strlen(value2)); +} + +/* + * Test against a record with two attributes, both matching one of the + * specified attributes in the list (a corrupt record) + */ +static void test_filter_attrs_in_place_two_dup_attr_matched_one_of_two(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"bar", "foo", NULL}; + + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value1, + .length = strlen(value1) + }; + struct ldb_val value_2 = { + .data = (uint8_t *)value2, + .length = strlen(value2) + }; + + struct ldb_message_element elements = { + { + .name = "bar", + .num_values = 1, + .values = &value_1 + }, + { + .name = "bar", + .num_values = 1, + .values = &value_2 + } + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 2; + msg->elements = elements; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + + /* This does not fail the pidgenhole test */ + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 2); + + /* Assert that DB order is preserved */ + assert_string_equal(msg->elements0.name, "bar"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value1)); + assert_memory_equal(msg->elements0.values0.data, + value1, strlen(value1)); + assert_string_equal(msg->elements1.name, "bar"); + assert_int_equal(msg->elements1.num_values, 1); + assert_int_equal(msg->elements1.values0.length, + strlen(value2)); + assert_memory_equal(msg->elements1.values0.data, + value2, strlen(value2)); +} + +/* + * Test against a record with two attributes against * (but not the + * other named attribute) (a corrupt record) + */ +static void test_filter_attrs_in_place_two_dup_attr_matched_star(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"*", "foo", NULL}; + + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value1, + .length = strlen(value1) + }; + struct ldb_val value_2 = { + .data = (uint8_t *)value2, + .length = strlen(value2) + }; + + struct ldb_message_element elements = { + { + .name = "bar", + .num_values = 1, + .values = &value_1 + }, + { + .name = "bar", + .num_values = 1, + .values = &value_2 + } + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 2; + msg->elements = elements; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + + /* This does not fail the pidgenhole test */ + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 3); + + /* Assert that DB order is preserved */ + assert_string_equal(msg->elements0.name, "bar"); + assert_int_equal(msg->elements0.num_values, 1); + assert_int_equal(msg->elements0.values0.length, + strlen(value1)); + assert_memory_equal(msg->elements0.values0.data, + value1, strlen(value1)); + assert_string_equal(msg->elements1.name, "bar"); + assert_int_equal(msg->elements1.num_values, 1); + assert_int_equal(msg->elements1.values0.length, + strlen(value2)); + assert_memory_equal(msg->elements1.values0.data, + value2, strlen(value2)); + + assert_non_null(msg->dn); + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "distinguishedName", + NULL), + ldb_dn_get_linearized(msg->dn)); +} + +/* + * Test against a record with only one attribute, matching the * in + * the list + */ +static void test_filter_attrs_in_place_one_attr_matched_star(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"*", NULL}; + + char value = "The value.......end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value, + .length = strlen(value) + }; + struct ldb_message_element element_1 = { + .name = "foo", + .num_values = 1, + .values = &value_1 + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 1; + msg->elements = &element_1; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 2); + + assert_non_null(msg->dn); + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "distinguishedName", + NULL), + ldb_dn_get_linearized(msg->dn)); + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "foo", + NULL), + value); +} + +/* + * Test against a record with two attributes, matching the * in + * the list + */ +static void test_filter_attrs_in_place_two_attr_matched_star(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"*", NULL}; + + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value1, + .length = strlen(value1) + }; + struct ldb_val value_2 = { + .data = (uint8_t *)value2, + .length = strlen(value2) + }; + struct ldb_message_element elements = { + { + .name = "foo", + .num_values = 1, + .values = &value_1 + }, + { + .name = "bar", + .num_values = 1, + .values = &value_2 + } + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 2; + msg->elements = elements; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 3); + + assert_non_null(msg->dn); + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "distinguishedName", + NULL), + ldb_dn_get_linearized(msg->dn)); + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "foo", + NULL), + value1); + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "bar", + NULL), + value2); +} + +/* + * Test against a record with only one attribute, matching the * in + * the list, but without the DN being pre-filled. Succeeds, but the + * distinguishedName is not added. + */ +static void test_filter_attrs_in_place_one_attr_matched_star_no_dn(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"*", NULL}; + + char value = "The value.......end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value, + .length = strlen(value) + }; + struct ldb_message_element element_1 = { + .name = "foo", + .num_values = 1, + .values = &value_1 + }; + + assert_non_null(msg); + msg->dn = NULL; + msg->num_elements = 1; + msg->elements = &element_1; + + assert_null(msg->dn); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 1); +} + +/* + * Test against a record with only one attribute, matching the * in + * the list plus requsesting distinguishedName + */ +static void test_filter_attrs_in_place_one_attr_matched_star_dn(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"*", "distinguishedName", NULL}; + + char value = "The value.......end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value, + .length = strlen(value) + }; + struct ldb_message_element element_1 = { + .name = "foo", + .num_values = 1, + .values = &value_1 + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 1; + msg->elements = &element_1; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 2); + + assert_non_null(msg->dn); + + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "distinguishedName", + NULL), + ldb_dn_get_linearized(msg->dn)); + assert_string_equal(ldb_msg_find_attr_as_string(msg, + "foo", + NULL), + value); +} + +/* + * Test against a record with only one attribute, but returning + * distinguishedName from the list (only) + */ +static void test_filter_attrs_in_place_one_attr_matched_dn(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {"distinguishedName", NULL}; + + char value = "The value.......end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value, + .length = strlen(value) + }; + struct ldb_message_element element_1 = { + .name = "foo", + .num_values = 1, + .values = &value_1 + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 1; + msg->elements = &element_1; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 1); + + assert_non_null(msg->dn); + assert_string_equal(msg->elements0.name, "distinguishedName"); + assert_int_equal(msg->elements0.num_values, 1); + assert_string_equal(msg->elements0.values0.data, + ldb_dn_get_linearized(msg->dn)); +} + +/* + * Test against a record with only one attribute, not matching the + * empty attribute list + */ +static void test_filter_attrs_in_place_one_attr_empty_list(void **state) +{ + struct ldbtest_ctx *ctx = *state; + int ret; + + struct ldb_message *msg = ldb_msg_new(ctx); + + const char *attrs = {NULL}; + + char value = "The value.......end"; + struct ldb_val value_1 = { + .data = (uint8_t *)value, + .length = strlen(value) + }; + struct ldb_message_element element_1 = { + .name = "foo", + .num_values = 1, + .values = &value_1 + }; + + assert_non_null(msg); + msg->dn = ldb_dn_new(ctx, ctx->ldb, "dc=samba,dc=org"); + msg->num_elements = 1; + msg->elements = &element_1; + + assert_non_null(msg->dn); + msg_add_dn(msg); + + ret = ldb_filter_attrs_in_place(msg, attrs); + assert_int_equal(ret, LDB_SUCCESS); + assert_int_equal(msg->num_elements, 0); + assert_non_null(msg->dn); +} + +int main(int argc, const char **argv) +{ + const struct CMUnitTest tests = { + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_one_attr_matched, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_one_attr_matched_of_many, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_two_attr_matched_attrs, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_two_attr_matched_one_attr, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_two_dup_attr_matched_one_attr, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_two_dup_attr_matched_dup, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_two_dup_attr_matched_one_of_two, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_two_dup_attr_matched_star, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_one_attr_matched_star, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_two_attr_matched_star, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_one_attr_matched_star_no_dn, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_one_attr_matched_star_dn, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_one_attr_matched_dn, + setup, + teardown), + cmocka_unit_test_setup_teardown( + test_filter_attrs_in_place_one_attr_empty_list, + setup, + teardown), + }; + + return cmocka_run_group_tests(tests, NULL, NULL); +}
View file
_service:tar_scm:ldb-2.6.1.tar.gz/tests/ldb_filter_attrs_test.c -> _service:tar_scm:ldb-2.7.2.tar.gz/tests/ldb_filter_attrs_test.c
Changed
@@ -36,6 +36,7 @@ #include <stdarg.h> #include <stddef.h> #include <stdint.h> +#include <string.h> #include <setjmp.h> #include <cmocka.h> @@ -96,10 +97,10 @@ const char *attrs = {"foo", NULL}; - uint8_t value = "The value.......end"; + char value = "The value.......end"; struct ldb_val value_1 = { - .data = value, - .length = (sizeof(value)) + .data = (uint8_t *)value, + .length = strlen(value) }; struct ldb_message_element element_1 = { .name = "foo", @@ -130,9 +131,9 @@ assert_string_equal(filtered_msg->elements0.name, "foo"); assert_int_equal(filtered_msg->elements0.num_values, 1); assert_int_equal(filtered_msg->elements0.values0.length, - sizeof(value)); + strlen(value)); assert_memory_equal(filtered_msg->elements0.values0.data, - value, sizeof(value)); + value, strlen(value)); } /* @@ -148,10 +149,10 @@ const char *attrs = {"foo", "bar", "baz", NULL}; - uint8_t value = "The value.......end"; + char value = "The value.......end"; struct ldb_val value_1 = { - .data = value, - .length = (sizeof(value)) + .data = (uint8_t *)value, + .length = strlen(value) }; struct ldb_message_element element_1 = { .name = "foo", @@ -182,9 +183,9 @@ assert_string_equal(filtered_msg->elements0.name, "foo"); assert_int_equal(filtered_msg->elements0.num_values, 1); assert_int_equal(filtered_msg->elements0.values0.length, - sizeof(value)); + strlen(value)); assert_memory_equal(filtered_msg->elements0.values0.data, - value, sizeof(value)); + value, strlen(value)); } /* @@ -201,15 +202,15 @@ /* deliberatly the other order */ const char *attrs = {"bar", "foo", NULL}; - uint8_t value1 = "The value.......end"; - uint8_t value2 = "The value..MUST.end"; + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; struct ldb_val value_1 = { - .data = value1, - .length = (sizeof(value1)) + .data = (uint8_t *)value1, + .length = strlen(value1) }; struct ldb_val value_2 = { - .data = value2, - .length = (sizeof(value2)) + .data = (uint8_t *)value2, + .length = strlen(value2) }; /* foo and bar are the other order to in attrs */ @@ -251,15 +252,15 @@ assert_string_equal(filtered_msg->elements0.name, "foo"); assert_int_equal(filtered_msg->elements0.num_values, 1); assert_int_equal(filtered_msg->elements0.values0.length, - sizeof(value1)); + strlen(value1)); assert_memory_equal(filtered_msg->elements0.values0.data, - value1, sizeof(value1)); + value1, strlen(value1)); assert_string_equal(filtered_msg->elements1.name, "bar"); assert_int_equal(filtered_msg->elements1.num_values, 1); assert_int_equal(filtered_msg->elements1.values0.length, - sizeof(value2)); + strlen(value2)); assert_memory_equal(filtered_msg->elements1.values0.data, - value2, sizeof(value2)); + value2, strlen(value2)); } /* @@ -276,15 +277,15 @@ /* deliberatly the other order */ const char *attrs = {"bar", NULL}; - uint8_t value1 = "The value.......end"; - uint8_t value2 = "The value..MUST.end"; + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; struct ldb_val value_1 = { - .data = value1, - .length = (sizeof(value1)) + .data = (uint8_t *)value1, + .length = strlen(value1) }; struct ldb_val value_2 = { - .data = value2, - .length = (sizeof(value2)) + .data = (uint8_t *)value2, + .length = strlen(value2) }; /* foo and bar are the other order to in attrs */ @@ -326,9 +327,9 @@ assert_string_equal(filtered_msg->elements0.name, "bar"); assert_int_equal(filtered_msg->elements0.num_values, 1); assert_int_equal(filtered_msg->elements0.values0.length, - sizeof(value2)); + strlen(value2)); assert_memory_equal(filtered_msg->elements0.values0.data, - value2, sizeof(value2)); + value2, strlen(value2)); } /* @@ -345,15 +346,15 @@ /* deliberatly the other order */ const char *attrs = {"bar", NULL}; - uint8_t value1 = "The value.......end"; - uint8_t value2 = "The value..MUST.end"; + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; struct ldb_val value_1 = { - .data = value1, - .length = (sizeof(value1)) + .data = (uint8_t *)value1, + .length = strlen(value1) }; struct ldb_val value_2 = { - .data = value2, - .length = (sizeof(value2)) + .data = (uint8_t *)value2, + .length = strlen(value2) }; /* foo and bar are the other order to in attrs */ @@ -400,15 +401,15 @@ const char *attrs = {"bar", "bar", NULL}; - uint8_t value1 = "The value.......end"; - uint8_t value2 = "The value..MUST.end"; + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; struct ldb_val value_1 = { - .data = value1, - .length = (sizeof(value1)) + .data = (uint8_t *)value1, + .length = strlen(value1) }; struct ldb_val value_2 = { - .data = value2, - .length = (sizeof(value2)) + .data = (uint8_t *)value2, + .length = strlen(value2) }; /* foo and bar are the other order to in attrs */ @@ -445,15 +446,15 @@ assert_string_equal(filtered_msg->elements0.name, "bar"); assert_int_equal(filtered_msg->elements0.num_values, 1); assert_int_equal(filtered_msg->elements0.values0.length, - sizeof(value1)); + strlen(value1)); assert_memory_equal(filtered_msg->elements0.values0.data, - value1, sizeof(value1)); + value1, strlen(value1)); assert_string_equal(filtered_msg->elements1.name, "bar"); assert_int_equal(filtered_msg->elements1.num_values, 1); assert_int_equal(filtered_msg->elements1.values0.length, - sizeof(value2)); + strlen(value2)); assert_memory_equal(filtered_msg->elements1.values0.data, - value2, sizeof(value2)); + value2, strlen(value2)); } /* @@ -469,15 +470,15 @@ const char *attrs = {"bar", "foo", NULL}; - uint8_t value1 = "The value.......end"; - uint8_t value2 = "The value..MUST.end"; + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; struct ldb_val value_1 = { - .data = value1, - .length = (sizeof(value1)) + .data = (uint8_t *)value1, + .length = strlen(value1) }; struct ldb_val value_2 = { - .data = value2, - .length = (sizeof(value2)) + .data = (uint8_t *)value2, + .length = strlen(value2) }; /* foo and bar are the other order to in attrs */ @@ -514,15 +515,15 @@ assert_string_equal(filtered_msg->elements0.name, "bar"); assert_int_equal(filtered_msg->elements0.num_values, 1); assert_int_equal(filtered_msg->elements0.values0.length, - sizeof(value1)); + strlen(value1)); assert_memory_equal(filtered_msg->elements0.values0.data, - value1, sizeof(value1)); + value1, strlen(value1)); assert_string_equal(filtered_msg->elements1.name, "bar"); assert_int_equal(filtered_msg->elements1.num_values, 1); assert_int_equal(filtered_msg->elements1.values0.length, - sizeof(value2)); + strlen(value2)); assert_memory_equal(filtered_msg->elements1.values0.data, - value2, sizeof(value2)); + value2, strlen(value2)); } /* @@ -538,15 +539,15 @@ const char *attrs = {"*", "foo", NULL}; - uint8_t value1 = "The value.......end"; - uint8_t value2 = "The value..MUST.end"; + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; struct ldb_val value_1 = { - .data = value1, - .length = (sizeof(value1)) + .data = (uint8_t *)value1, + .length = strlen(value1) }; struct ldb_val value_2 = { - .data = value2, - .length = (sizeof(value2)) + .data = (uint8_t *)value2, + .length = strlen(value2) }; /* foo and bar are the other order to in attrs */ @@ -586,15 +587,15 @@ assert_string_equal(filtered_msg->elements0.name, "bar"); assert_int_equal(filtered_msg->elements0.num_values, 1); assert_int_equal(filtered_msg->elements0.values0.length, - sizeof(value1)); + strlen(value1)); assert_memory_equal(filtered_msg->elements0.values0.data, - value1, sizeof(value1)); + value1, strlen(value1)); assert_string_equal(filtered_msg->elements1.name, "bar"); assert_int_equal(filtered_msg->elements1.num_values, 1); assert_int_equal(filtered_msg->elements1.values0.length, - sizeof(value2)); + strlen(value2)); assert_memory_equal(filtered_msg->elements1.values0.data, - value2, sizeof(value2)); + value2, strlen(value2)); /* * assert the ldb_filter_attrs does not modify filtered_msg.dn * in this case @@ -619,10 +620,10 @@ const char *attrs = {"*", NULL}; - uint8_t value = "The value.......end"; + char value = "The value.......end"; struct ldb_val value_1 = { - .data = value, - .length = (sizeof(value)) + .data = (uint8_t *)value, + .length = strlen(value) }; struct ldb_message_element element_1 = { .name = "foo", @@ -676,15 +677,15 @@ const char *attrs = {"*", NULL}; - uint8_t value1 = "The value.......end"; - uint8_t value2 = "The value..MUST.end"; + char value1 = "The value.......end"; + char value2 = "The value..MUST.end"; struct ldb_val value_1 = { - .data = value1, - .length = (sizeof(value1)) + .data = (uint8_t *)value1, + .length = strlen(value1) }; struct ldb_val value_2 = { - .data = value2, - .length = (sizeof(value2)) + .data = (uint8_t *)value2, + .length = strlen(value2) }; struct ldb_message_element elements = { { @@ -750,10 +751,10 @@ const char *attrs = {"*", NULL}; - uint8_t value = "The value.......end"; + char value = "The value.......end"; struct ldb_val value_1 = { - .data = value, - .length = (sizeof(value)) + .data = (uint8_t *)value, + .length = strlen(value) }; struct ldb_message_element element_1 = { .name = "foo", @@ -789,10 +790,10 @@ const char *attrs = {"*", "distinguishedName", NULL}; - uint8_t value = "The value.......end"; + char value = "The value.......end"; struct ldb_val value_1 = { - .data = value, - .length = (sizeof(value)) + .data = (uint8_t *)value, + .length = strlen(value) }; struct ldb_message_element element_1 = { .name = "foo", @@ -844,10 +845,10 @@ const char *attrs = {"distinguishedName", NULL}; - uint8_t value = "The value.......end"; + char value = "The value.......end"; struct ldb_val value_1 = { - .data = value, - .length = (sizeof(value)) + .data = (uint8_t *)value, + .length = strlen(value) }; struct ldb_message_element element_1 = { .name = "foo", @@ -894,10 +895,10 @@ const char *attrs = {NULL}; - uint8_t value = "The value.......end"; + char value = "The value.......end"; struct ldb_val value_1 = { - .data = value, - .length = (sizeof(value)) + .data = (uint8_t *)value, + .length = strlen(value) }; struct ldb_message_element element_1 = { .name = "foo",
View file
_service:tar_scm:ldb-2.6.1.tar.gz/tests/python/api.py -> _service:tar_scm:ldb-2.7.2.tar.gz/tests/python/api.py
Changed
@@ -1261,14 +1261,6 @@ def test_subtree_unique_elsewhere2(self): """Testing a search""" - res11 = self.l.search(base="DC=EXAMPLE,DC=COM", - scope=ldb.SCOPE_SUBTREE, - expression="(ou=ou10)") - self.assertEqual(len(res11), 0) - - def test_subtree_unique_elsewhere2(self): - """Testing a search""" - res11 = self.l.search(base="DC=EXAMPLE,DC=NET", scope=ldb.SCOPE_SUBTREE, expression="(ou=unique)") @@ -1306,20 +1298,20 @@ expression="(ou=unique)") self.assertEqual(len(res11), 0) - def test_subtree_unique_here(self): + def test_subtree_unique_elsewhere7(self): """Testing a search""" - res11 = self.l.search(base="OU=UNIQUE,DC=EXAMPLE,DC=NET", + res11 = self.l.search(base="DC=EXAMPLE,DC=COM", scope=ldb.SCOPE_SUBTREE, - expression="(ou=unique)") - self.assertEqual(len(res11), 1) + expression="(ou=ou10)") + self.assertEqual(len(res11), 0) - def test_subtree_unique(self): + def test_subtree_unique_here(self): """Testing a search""" - res11 = self.l.search(base="DC=SAMBA,DC=ORG", + res11 = self.l.search(base="OU=UNIQUE,DC=EXAMPLE,DC=NET", scope=ldb.SCOPE_SUBTREE, - expression="(ou=ou10)") + expression="(ou=unique)") self.assertEqual(len(res11), 1) def test_subtree_and_none(self): @@ -1454,14 +1446,6 @@ self.assertEqual(len(res11), 0) def test_onelevel_unique_elsewhere2(self): - """Testing a search""" - - res11 = self.l.search(base="DC=EXAMPLE,DC=COM", - scope=ldb.SCOPE_ONELEVEL, - expression="(ou=ou10)") - self.assertEqual(len(res11), 0) - - def test_onelevel_unique_elsewhere2(self): """Testing a search (showing that onelevel is not subtree)""" res11 = self.l.search(base="DC=EXAMPLE,DC=NET", @@ -1493,6 +1477,14 @@ expression="(ou=unique)") self.assertEqual(len(res11), 0) + def test_onelevel_unique_elsewhere6(self): + """Testing a search""" + + res11 = self.l.search(base="DC=EXAMPLE,DC=COM", + scope=ldb.SCOPE_ONELEVEL, + expression="(ou=ou10)") + self.assertEqual(len(res11), 0) + def test_onelevel_unique_here(self): """Testing a search"""
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/update.sh -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/update.sh
Changed
@@ -1,8 +1,8 @@ #!/bin/bash if $# -lt 1 ; then - echo "Usage: update.sh VERSION" - exit 1 + echo "Usage: update.sh VERSION" + exit 1 fi WAF_VERSION="${1}" @@ -16,19 +16,21 @@ echo "WAF SAMBA DIR: ${WAF_SAMBA_DIR}" echo "WAF TMP DIR: ${WAF_TMPDIR}" -cleanup_tmpdir() { - popd 2>/dev/null || true - rm -rf "$WAF_TMPDIR" +cleanup_tmpdir() +{ + popd 2>/dev/null || true + rm -rf "$WAF_TMPDIR" } trap cleanup_tmpdir SIGINT -cleanup_and_exit() { - cleanup_tmpdir - if test "$1" = 0 -o -z "$1" ; then - exit 0 - else - exit "$1" - fi +cleanup_and_exit() +{ + cleanup_tmpdir + if test "$1" = 0 -o -z "$1"; then + exit 0 + else + exit "$1" + fi } # Checkout the git tree @@ -38,17 +40,16 @@ git clone "${WAF_GIT}" ret=$? if $ret -ne 0 ; then - echo "ERROR: Failed to clone repository" - cleanup_and_exit 1 + echo "ERROR: Failed to clone repository" + cleanup_and_exit 1 fi - pushd waf || cleanup_and_exit 1 git checkout -b "waf-${WAF_VERSION}" "waf-${WAF_VERSION}" ret=$? if $ret -ne 0 ; then - echo "ERROR: Failed to checkout waf-${WAF_VERSION} repository" - cleanup_and_exit 1 + echo "ERROR: Failed to checkout waf-${WAF_VERSION} repository" + cleanup_and_exit 1 fi popd || cleanup_and_exit 1 @@ -62,8 +63,8 @@ rsync -av "${WAF_TMPDIR}/waf/waflib" . ret=$? if $ret -ne 0 ; then - echo "ERROR: Failed copy waflib" - cleanup_and_exit 1 + echo "ERROR: Failed copy waflib" + cleanup_and_exit 1 fi chmod -x waflib/Context.py
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Configure.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/Configure.py
Changed
@@ -439,7 +439,7 @@ var = kw.get('var', '') if not var: - var = re.sub(r'-.', '_', filename0.upper()) + var = re.sub(r'\W', '_', filename0.upper()) path_list = kw.get('path_list', '') if path_list:
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Context.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/Context.py
Changed
@@ -18,13 +18,13 @@ import imp # the following 3 constants are updated on each new release (do not touch) -HEXVERSION=0x2001800 +HEXVERSION=0x2001900 """Constant updated on new releases""" -WAFVERSION="2.0.24" +WAFVERSION="2.0.25" """Constant updated on new releases""" -WAFREVISION="1af97c71f5a6756abf36d0f78ed8fd551596d7cb" +WAFREVISION="2db0b41b2805cd5db3b55476c06b23c1e46d319f" """Git revision when the waf version is updated""" WAFNAME="waf"
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/TaskGen.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/TaskGen.py
Changed
@@ -400,7 +400,7 @@ Decorator that registers a task generator method that will be executed when the object attribute ``feature`` contains the corresponding key(s):: - from waflib.Task import feature + from waflib.TaskGen import feature @feature('myfeature') def myfunction(self): print('that is my feature!')
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/msvc.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/Tools/msvc.py
Changed
@@ -111,7 +111,7 @@ class MSVCVersion(object): def __init__(self, ver): - m = re.search('^(.*)\s+(\d+.\d+)', ver) + m = re.search(r'^(.*)\s+(\d+.\d+)', ver) if m: self.name = m.group(1) self.number = float(m.group(2))
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/python.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/Tools/python.py
Changed
@@ -53,7 +53,17 @@ Piece of Python code used in :py:class:`waflib.Tools.python.pyo` and :py:class:`waflib.Tools.python.pyc` for byte-compiling python files """ -DISTUTILS_IMP = 'from distutils.sysconfig import get_config_var, get_python_lib' +DISTUTILS_IMP = """ +try: + from distutils.sysconfig import get_config_var, get_python_lib +except ImportError: + from sysconfig import get_config_var, get_path + def get_python_lib(*k, **kw): + keyword='platlib' if kw.get('plat_specific') else 'purelib' + if 'prefix' in kw: + return get_path(keyword, vars={'installed_base': kw'prefix', 'platbase': kw'prefix'}) + return get_path(keyword) +""".splitlines() @before_method('process_source') @feature('py') @@ -219,7 +229,7 @@ try: out = self.cmd_and_log(self.env.PYTHON + '-c', '\n'.join(program), env=os_env) except Errors.WafError: - self.fatal('The distutils module is unusable: install "python-devel"?') + self.fatal('Could not run %r' % self.env.PYTHON) self.to_log(out) return_values = for s in out.splitlines(): @@ -291,7 +301,8 @@ @conf def check_python_headers(conf, features='pyembed pyext'): """ - Check for headers and libraries necessary to extend or embed python by using the module *distutils*. + Check for headers and libraries necessary to extend or embed python. + It may use the module *distutils* or sysconfig in newer Python versions. On success the environment variables xxx_PYEXT and xxx_PYEMBED are added: * PYEXT: for compiling python extensions @@ -439,7 +450,7 @@ env.LIBPATH_PYEXT = env.LIBPATH_PYEMBED env.LIB_PYEXT = env.LIB_PYEMBED - conf.to_log("Include path for Python extensions (found via distutils module): %r\n" % (dct'INCLUDEPY',)) + conf.to_log("Found an include path for Python extensions: %r\n" % (dct'INCLUDEPY',)) env.INCLUDES_PYEXT = dct'INCLUDEPY' env.INCLUDES_PYEMBED = dct'INCLUDEPY' @@ -452,15 +463,21 @@ env.append_unique('CXXFLAGS_PYEXT', '-fno-strict-aliasing') if env.CC_NAME == "msvc": - from distutils.msvccompiler import MSVCCompiler - dist_compiler = MSVCCompiler() - dist_compiler.initialize() - env.append_value('CFLAGS_PYEXT', dist_compiler.compile_options) - env.append_value('CXXFLAGS_PYEXT', dist_compiler.compile_options) - env.append_value('LINKFLAGS_PYEXT', dist_compiler.ldflags_shared) + try: + from distutils.msvccompiler import MSVCCompiler + except ImportError: + # From https://github.com/python/cpython/blob/main/Lib/distutils/msvccompiler.py + env.append_value('CFLAGS_PYEXT', '/nologo', '/Ox', '/MD', '/W3', '/GX', '/DNDEBUG') + env.append_value('CXXFLAGS_PYEXT', '/nologo', '/Ox', '/MD', '/W3', '/GX', '/DNDEBUG') + env.append_value('LINKFLAGS_PYEXT', '/DLL', '/nologo', '/INCREMENTAL:NO') + else: + dist_compiler = MSVCCompiler() + dist_compiler.initialize() + env.append_value('CFLAGS_PYEXT', dist_compiler.compile_options) + env.append_value('CXXFLAGS_PYEXT', dist_compiler.compile_options) + env.append_value('LINKFLAGS_PYEXT', dist_compiler.ldflags_shared) - # See if it compiles - conf.check(header_name='Python.h', define_name='HAVE_PYTHON_H', uselib='PYEMBED', fragment=FRAG, errmsg='Distutils not installed? Broken python installation? Get python-config now!') + conf.check(header_name='Python.h', define_name='HAVE_PYTHON_H', uselib='PYEMBED', fragment=FRAG, errmsg='Could not build a Python embedded interpreter') @conf def check_python_version(conf, minver=None): @@ -506,17 +523,9 @@ else: # Finally, try to guess if Utils.is_win32: - (python_LIBDEST, pydir) = conf.get_python_variables( - "get_config_var('LIBDEST') or ''", - "get_python_lib(standard_lib=0) or ''") + (pydir,) = conf.get_python_variables("get_python_lib(standard_lib=0) or ''") else: - python_LIBDEST = None - (pydir,) = conf.get_python_variables( "get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX) - if python_LIBDEST is None: - if conf.env.LIBDIR: - python_LIBDEST = os.path.join(conf.env.LIBDIR, 'python' + pyver) - else: - python_LIBDEST = os.path.join(conf.env.PREFIX, 'lib', 'python' + pyver) + (pydir,) = conf.get_python_variables("get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX) if 'PYTHONARCHDIR' in conf.env: # Check if --pythonarchdir was specified @@ -526,7 +535,7 @@ pyarchdir = conf.environ'PYTHONARCHDIR' else: # Finally, try to guess - (pyarchdir, ) = conf.get_python_variables( "get_python_lib(plat_specific=1, standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX) + (pyarchdir, ) = conf.get_python_variables("get_python_lib(plat_specific=1, standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX) if not pyarchdir: pyarchdir = pydir @@ -585,13 +594,12 @@ if ret == 'unknown version': conf.fatal('Could not check the %s version' % module_name) - from distutils.version import LooseVersion def num(*k): if isinstance(k0, int): - return LooseVersion('.'.join(str(x) for x in k)) + return Utils.loose_version('.'.join(str(x) for x in k)) else: - return LooseVersion(k0) - d = {'num': num, 'ver': LooseVersion(ret)} + return Utils.loose_version(k0) + d = {'num': num, 'ver': Utils.loose_version(ret)} ev = eval(condition, {}, d) if not ev: conf.fatal('The %s version does not satisfy the requirements' % module_name)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Utils.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/Utils.py
Changed
@@ -452,6 +452,8 @@ pass else: if codepage: + if 65001 == codepage and sys.version_info < (3, 3): + return 'utf-8' return 'cp%d' % codepage return sys.stdout.encoding or ('cp1252' if is_win32 else 'latin-1') @@ -868,6 +870,19 @@ return '64' return '' +def loose_version(ver_str): + # private for the time being! + # see #2402 + lst = re.split(r'(.|\\d+|a-zA-Z)', ver_str) + ver = + for i, val in enumerate(lst): + try: + ver.append(int(val)) + except ValueError: + if val != '.': + ver.append(val) + return ver + def sane_path(p): # private function for the time being! return os.path.abspath(os.path.expanduser(p))
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/cpplint.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/extras/cpplint.py
Changed
@@ -169,7 +169,7 @@ global critical_errors with cpplint_wrapper(get_cpplint_logger(self.env.CPPLINT_OUTPUT), self.env.CPPLINT_BREAK, self.env.CPPLINT_OUTPUT): params = {key: str(self.envkey) for key in self.env if 'CPPLINT_' in key} - if params'CPPLINT_OUTPUT' is 'waf': + if params'CPPLINT_OUTPUT' == 'waf': params'CPPLINT_OUTPUT' = 'emacs' params'CPPLINT' = self.env.get_flat('CPPLINT') cmd = Utils.subst_vars(CPPLINT_STR, params)
View file
_service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/extras/fc_fujitsu.py
Added
@@ -0,0 +1,52 @@ +#! /usr/bin/env python +# encoding: utf-8 +# Detection of the Fujitsu Fortran compiler for ARM64FX + +import re +from waflib.Tools import fc,fc_config,fc_scan +from waflib.Configure import conf +from waflib.Tools.compiler_fc import fc_compiler +fc_compiler'linux'.append('fc_fujitsu') + +@conf +def find_fujitsu(conf): + fc=conf.find_program('frtpx',var='FC') + conf.get_fujitsu_version(fc) + conf.env.FC_NAME='FUJITSU' + conf.env.FC_MOD_CAPITALIZATION='lower' + +@conf +def fujitsu_flags(conf): + v=conf.env + v'_FCMODOUTFLAGS'= + v'FCFLAGS_DEBUG'= + v'FCFLAGS_fcshlib'= + v'LINKFLAGS_fcshlib'= + v'FCSTLIB_MARKER'='' + v'FCSHLIB_MARKER'='' + +@conf +def get_fujitsu_version(conf,fc): + version_re=re.compile(r"frtpx\s*\(FRT\)\s*(?P<major>\d+)\.(?P<minor>\d+)\.",re.I).search + cmd=fc+'--version' + out,err=fc_config.getoutput(conf,cmd,stdin=False) + if out: + match=version_re(out) + else: + match=version_re(err) + if not match: + return(False) + conf.fatal('Could not determine the Fujitsu FRT Fortran compiler version.') + else: + k=match.groupdict() + conf.env'FC_VERSION'=(k'major',k'minor') + +def configure(conf): + conf.find_fujitsu() + conf.find_program('ar',var='AR') + conf.add_os_flags('ARFLAGS') + if not conf.env.ARFLAGS: + conf.env.ARFLAGS='rcs' + conf.fc_flags() + conf.fc_add_flags() + conf.fujitsu_flags()
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/gccdeps.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/extras/gccdeps.py
Changed
@@ -17,7 +17,7 @@ import os, re, threading from waflib import Task, Logs, Utils, Errors -from waflib.Tools import c_preproc +from waflib.Tools import asm, c, c_preproc, cxx from waflib.TaskGen import before_method, feature lock = threading.Lock()
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/pyqt5.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/extras/pyqt5.py
Changed
@@ -1,6 +1,6 @@ #!/usr/bin/env python # encoding: utf-8 -# Federico Pellegrin, 2016-2019 (fedepell) adapted for Python +# Federico Pellegrin, 2016-2022 (fedepell) adapted for Python """ This tool helps with finding Python Qt5 tools and libraries, @@ -137,7 +137,7 @@ Processes ``.qrc`` files """ color = 'BLUE' - run_str = '${QT_PYRCC} ${SRC} -o ${TGT}' + run_str = '${QT_PYRCC} ${QT_PYRCC_FLAGS} ${SRC} -o ${TGT}' ext_out = '.py' def rcname(self): @@ -175,7 +175,7 @@ Processes ``.ui`` files for python """ color = 'BLUE' - run_str = '${QT_PYUIC} ${SRC} -o ${TGT}' + run_str = '${QT_PYUIC} ${QT_PYUIC_FLAGS} ${SRC} -o ${TGT}' ext_out = '.py' class ts2qm(Task.Task): @@ -216,17 +216,17 @@ self.find_program('pyrcc5', var='QT_PYRCC') self.find_program('pylupdate5', var='QT_PYLUPDATE') elif getattr(Options.options, 'want_pyside2', True): - self.find_program('pyside2-uic', var='QT_PYUIC') - self.find_program('pyside2-rcc', var='QT_PYRCC') - self.find_program('pyside2-lupdate', var='QT_PYLUPDATE') + self.find_program('pyside2-uic','uic-qt5', var='QT_PYUIC') + self.find_program('pyside2-rcc','rcc-qt5', var='QT_PYRCC') + self.find_program('pyside2-lupdate','lupdate-qt5', var='QT_PYLUPDATE') elif getattr(Options.options, 'want_pyqt4', True): self.find_program('pyuic4', var='QT_PYUIC') self.find_program('pyrcc4', var='QT_PYRCC') self.find_program('pylupdate4', var='QT_PYLUPDATE') else: - self.find_program('pyuic5','pyside2-uic','pyuic4', var='QT_PYUIC') - self.find_program('pyrcc5','pyside2-rcc','pyrcc4', var='QT_PYRCC') - self.find_program('pylupdate5', 'pyside2-lupdate','pylupdate4', var='QT_PYLUPDATE') + self.find_program('pyuic5','pyside2-uic','pyuic4','uic-qt5', var='QT_PYUIC') + self.find_program('pyrcc5','pyside2-rcc','pyrcc4','rcc-qt5', var='QT_PYRCC') + self.find_program('pylupdate5', 'pyside2-lupdate','pylupdate4','lupdate-qt5', var='QT_PYLUPDATE') if not env.QT_PYUIC: self.fatal('cannot find the uic compiler for python for qt5')
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/sphinx.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/extras/sphinx.py
Changed
@@ -1,7 +1,15 @@ """Support for Sphinx documentation -This is a wrapper for sphinx-build program. Please note that sphinx-build supports only one output format which can -passed to build via sphinx_output_format attribute. The default output format is html. +This is a wrapper for sphinx-build program. Please note that sphinx-build supports only +one output format at a time, but the tool can create multiple tasks to handle more. +The output formats can be passed via the sphinx_output_format, which is an array of +strings. For backwards compatibility if only one output is needed, it can be passed +as a single string. +The default output format is html. + +Specific formats can be installed in different directories by specifying the +install_path_<FORMAT> attribute. If not defined, the standard install_path +will be used instead. Example wscript: @@ -13,7 +21,8 @@ features='sphinx', sphinx_source='sources', # path to source directory sphinx_options='-a -v', # sphinx-build program additional options - sphinx_output_format='man' # output format of sphinx documentation + sphinx_output_format='html', 'man', # output format of sphinx documentation + install_path_man='${DOCDIR}/man' # put man pages in a specific directory ) """ @@ -43,30 +52,36 @@ if not self.sphinx_source: self.bld.fatal('Can\'t find sphinx_source: %r' % self.sphinx_source) + # In the taskgen we have the complete list of formats Utils.def_attrs(self, sphinx_output_format='html') - self.env.SPHINX_OUTPUT_FORMAT = self.sphinx_output_format + self.sphinx_output_format = Utils.to_list(self.sphinx_output_format) + self.env.SPHINX_OPTIONS = getattr(self, 'sphinx_options', ) for source_file in self.sphinx_source.ant_glob('**/*'): self.bld.add_manual_dependency(self.sphinx_source, source_file) - sphinx_build_task = self.create_task('SphinxBuildingTask') - sphinx_build_task.set_inputs(self.sphinx_source) - sphinx_build_task.set_outputs(self.path.get_bld()) + for cfmt in self.sphinx_output_format: + sphinx_build_task = self.create_task('SphinxBuildingTask') + sphinx_build_task.set_inputs(self.sphinx_source) + # In task we keep the specific format this task is generating + sphinx_build_task.env.SPHINX_OUTPUT_FORMAT = cfmt + + # the sphinx-build results are in <build + output_format> directory + sphinx_build_task.sphinx_output_directory = self.path.get_bld().make_node(cfmt) + sphinx_build_task.set_outputs(sphinx_build_task.sphinx_output_directory) + sphinx_build_task.sphinx_output_directory.mkdir() - # the sphinx-build results are in <build + output_format> directory - self.sphinx_output_directory = self.path.get_bld().make_node(self.env.SPHINX_OUTPUT_FORMAT) - self.sphinx_output_directory.mkdir() - Utils.def_attrs(self, install_path=get_install_path(self)) + Utils.def_attrs(sphinx_build_task, install_path=getattr(self, 'install_path_' + cfmt, getattr(self, 'install_path', get_install_path(sphinx_build_task)))) -def get_install_path(tg): - if tg.env.SPHINX_OUTPUT_FORMAT == 'man': - return tg.env.MANDIR - elif tg.env.SPHINX_OUTPUT_FORMAT == 'info': - return tg.env.INFODIR +def get_install_path(object): + if object.env.SPHINX_OUTPUT_FORMAT == 'man': + return object.env.MANDIR + elif object.env.SPHINX_OUTPUT_FORMAT == 'info': + return object.env.INFODIR else: - return tg.env.DOCDIR + return object.env.DOCDIR class SphinxBuildingTask(Task.Task): @@ -96,10 +111,10 @@ def add_install(self): - nodes = self.generator.sphinx_output_directory.ant_glob('**/*', quiet=True) + nodes = self.sphinx_output_directory.ant_glob('**/*', quiet=True) self.outputs += nodes - self.generator.add_install_files(install_to=self.generator.install_path, + self.generator.add_install_files(install_to=self.install_path, install_from=nodes, postpone=False, - cwd=self.generator.sphinx_output_directory, + cwd=self.sphinx_output_directory.make_node(self.env.SPHINX_OUTPUT_FORMAT), relative_trick=True)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/wafcache.py -> _service:tar_scm:ldb-2.7.2.tar.gz/third_party/waf/waflib/extras/wafcache.py
Changed
@@ -39,7 +39,14 @@ * WAFCACHE_TRIM_MAX_FOLDER: maximum amount of tasks to cache (1M) * WAFCACHE_EVICT_MAX_BYTES: maximum amount of cache size in bytes (10GB) * WAFCACHE_EVICT_INTERVAL_MINUTES: minimum time interval to try - and trim the cache (3 minutess) + and trim the cache (3 minutes) + +Upload specific options: +* WAFCACHE_ASYNC_WORKERS: define a number of workers to upload results asynchronously + this may improve build performance with many/long file uploads + the default is unset (synchronous uploads) +* WAFCACHE_ASYNC_NOWAIT: do not wait for uploads to complete (default: False) + this requires asynchonous uploads to have an effect Usage:: @@ -49,10 +56,10 @@ To troubleshoot:: - waf clean build --zones=wafcache + waf clean build --zone=wafcache """ -import atexit, base64, errno, fcntl, getpass, os, re, shutil, sys, time, traceback, urllib3, shlex +import atexit, base64, errno, fcntl, getpass, os, re, shutil, sys, time, threading, traceback, urllib3, shlex try: import subprocess32 as subprocess except ImportError: @@ -71,6 +78,8 @@ WAFCACHE_NO_PUSH = 1 if os.environ.get('WAFCACHE_NO_PUSH') else 0 WAFCACHE_VERBOSITY = 1 if os.environ.get('WAFCACHE_VERBOSITY') else 0 WAFCACHE_STATS = 1 if os.environ.get('WAFCACHE_STATS') else 0 +WAFCACHE_ASYNC_WORKERS = os.environ.get('WAFCACHE_ASYNC_WORKERS') +WAFCACHE_ASYNC_NOWAIT = os.environ.get('WAFCACHE_ASYNC_NOWAIT') OK = "ok" re_waf_cmd = re.compile('(?P<src>%{SRC})|(?P<tgt>%{TGT})') @@ -99,7 +108,9 @@ self.generator.bld.cache_reqs += 1 files_to = node.abspath() for node in self.outputs - err = cache_command(ssig, , files_to) + proc = get_process() + err = cache_command(proc, ssig, , files_to) + process_pool.append(proc) if err.startswith(OK): if WAFCACHE_VERBOSITY: Logs.pprint('CYAN', ' Fetched %r from cache' % files_to) @@ -132,23 +143,50 @@ files_from.append(path) bld = self.generator.bld + old_sig = self.signature() + + for node in self.inputs: + try: + del node.ctx.cache_signode + except KeyError: + pass + + delattr(self, 'cache_sig') sig = self.signature() - ssig = Utils.to_hex(self.uid() + sig) - err = cache_command(ssig, files_from, ) + def _async_put_files_cache(bld, ssig, files_from): + proc = get_process() + if WAFCACHE_ASYNC_WORKERS: + with bld.wafcache_lock: + if bld.wafcache_stop: + process_pool.append(proc) + return + bld.wafcache_procs.add(proc) + + err = cache_command(proc, ssig, files_from, ) + process_pool.append(proc) + if err.startswith(OK): + if WAFCACHE_VERBOSITY: + Logs.pprint('CYAN', ' Successfully uploaded %s to cache' % files_from) + else: + Logs.debug('wafcache: Successfully uploaded %r to cache', files_from) + if WAFCACHE_STATS: + bld.cache_puts += 1 + else: + if WAFCACHE_VERBOSITY: + Logs.pprint('RED', ' Error caching step results %s: %s' % (files_from, err)) + else: + Logs.debug('wafcache: Error caching results %s: %s', files_from, err) - if err.startswith(OK): - if WAFCACHE_VERBOSITY: - Logs.pprint('CYAN', ' Successfully uploaded %s to cache' % files_from) + if old_sig == sig: + ssig = Utils.to_hex(self.uid() + sig) + if WAFCACHE_ASYNC_WORKERS: + fut = bld.wafcache_executor.submit(_async_put_files_cache, bld, ssig, files_from) + bld.wafcache_uploads.append(fut) else: - Logs.debug('wafcache: Successfully uploaded %r to cache', files_from) - if WAFCACHE_STATS: - self.generator.bld.cache_puts += 1 + _async_put_files_cache(bld, ssig, files_from) else: - if WAFCACHE_VERBOSITY: - Logs.pprint('RED', ' Error caching step results %s: %s' % (files_from, err)) - else: - Logs.debug('wafcache: Error caching results %s: %s', files_from, err) + Logs.debug('wafcache: skipped %r upload due to late input modifications %r', self.outputs, self.inputs) bld.task_sigsself.uid() = self.cache_sig @@ -245,19 +283,45 @@ return subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, bufsize=0) def atexit_pool(): - for k in process_pool: - try: - os.kill(k.pid, 9) - except OSError: - pass - else: - k.wait() + for proc in process_pool: + proc.kill() atexit.register(atexit_pool) def build(bld): """ Called during the build process to enable file caching """ + + if WAFCACHE_ASYNC_WORKERS: + try: + num_workers = int(WAFCACHE_ASYNC_WORKERS) + except ValueError: + Logs.warn('Invalid WAFCACHE_ASYNC_WORKERS specified: %r' % WAFCACHE_ASYNC_WORKERS) + else: + from concurrent.futures import ThreadPoolExecutor + bld.wafcache_executor = ThreadPoolExecutor(max_workers=num_workers) + bld.wafcache_uploads = + bld.wafcache_procs = set() + bld.wafcache_stop = False + bld.wafcache_lock = threading.Lock() + + def finalize_upload_async(bld): + if WAFCACHE_ASYNC_NOWAIT: + with bld.wafcache_lock: + bld.wafcache_stop = True + + for fut in reversed(bld.wafcache_uploads): + fut.cancel() + + for proc in bld.wafcache_procs: + proc.kill() + + bld.wafcache_procs.clear() + else: + Logs.pprint('CYAN', '... waiting for wafcache uploads to complete (%s uploads)' % len(bld.wafcache_uploads)) + bld.wafcache_executor.shutdown(wait=True) + bld.add_post_fun(finalize_upload_async) + if WAFCACHE_STATS: # Init counter for statistics and hook to print results at the end bld.cache_reqs = bld.cache_hits = bld.cache_puts = 0 @@ -266,9 +330,8 @@ hit_ratio = 0 if bld.cache_reqs > 0: hit_ratio = (bld.cache_hits / bld.cache_reqs) * 100 - Logs.pprint('CYAN', ' wafcache stats: requests: %s, hits, %s, ratio: %.2f%%, writes %s' % + Logs.pprint('CYAN', ' wafcache stats: %s requests, %s hits (ratio: %.2f%%), %s writes' % (bld.cache_reqs, bld.cache_hits, hit_ratio, bld.cache_puts) ) - bld.add_post_fun(printstats) if process_pool: @@ -286,15 +349,13 @@ for x in reversed(list(Task.classes.values())): make_cached(x) -def cache_command(sig, files_from, files_to): +def cache_command(proc, sig, files_from, files_to): """ Create a command for cache worker processes, returns a pickled base64-encoded tuple containing the task signature, a list of files to cache and a list of files files to get from cache (one of the lists is assumed to be empty) """ - proc = get_process() - obj = base64.b64encode(cPickle.dumps(sig, files_from, files_to)) proc.stdin.write(obj) proc.stdin.write('\n'.encode()) @@ -302,7 +363,6 @@ obj = proc.stdout.readline() if not obj: raise OSError('Preforked sub-process %r died' % proc.pid) - process_pool.append(proc) return cPickle.loads(base64.b64decode(obj)) try: @@ -456,7 +516,10 @@ class fcache(object): def __init__(self): if not os.path.exists(CACHE_DIR): - os.makedirs(CACHE_DIR) + try: + os.makedirs(CACHE_DIR) + except OSError: + pass if not os.path.exists(CACHE_DIR): raise ValueError('Could not initialize the cache directory')
View file
_service:tar_scm:ldb-2.6.1.tar.gz/wscript -> _service:tar_scm:ldb-2.7.2.tar.gz/wscript
Changed
@@ -1,8 +1,8 @@ #!/usr/bin/env python APPNAME = 'ldb' -# For Samba 4.17.x -VERSION = '2.6.1' +# For Samba 4.18.x ! +VERSION = '2.7.2' import sys, os @@ -518,6 +518,11 @@ deps='cmocka ldb ldb_tdb_err_map', install=False) + bld.SAMBA_BINARY('ldb_filter_attrs_in_place_test', + source='tests/ldb_filter_attrs_in_place_test.c', + deps='cmocka ldb ldb_tdb_err_map', + install=False) + bld.SAMBA_BINARY('ldb_key_value_sub_txn_tdb_test', bld.SUBDIR('ldb_key_value', '''ldb_kv_search.c @@ -619,6 +624,13 @@ 'tests/python/index.py', 'tests/python/repack.py', extra_env={'SELFTEST_PREFIX': test_prefix}) + pyret = samba_utils.RUN_PYTHON_TESTS( + 'tests/python/api.py', + 'tests/python/crash.py', + 'tests/python/index.py', + 'tests/python/repack.py', + extra_env={'SELFTEST_PREFIX': test_prefix, + 'LC_ALL': 'tr_TR.UTF-8'}) print("Python testsuite returned %d" % pyret) cmocka_ret = 0 @@ -627,7 +639,6 @@ 'ldb_msg_test', 'ldb_tdb_mod_op_test', 'ldb_tdb_guid_mod_op_test', - 'ldb_msg_test', 'ldb_tdb_kv_ops_test', 'ldb_tdb_test', 'ldb_match_test', @@ -637,7 +648,10 @@ # on operations which the TDB backend does not currently # support # 'ldb_key_value_sub_txn_tdb_test' - 'ldb_parse_test' + 'ldb_parse_test', + 'ldb_filter_attrs_test', + 'ldb_filter_attrs_in_place_test', + # if LIB_LDAP and LIB_LBER defined, then we can test ldb_ldap backend # behavior regression for bz#14413
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2