Projects
openEuler:Mainline
libldb
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:libldb.spec
Changed
@@ -1,12 +1,12 @@ %global with_lmdb 1 %global with_python3 1 -%global talloc_version 2.3.3 -%global tdb_version 1.4.4 -%global tevent_version 0.11.0 +%global talloc_version 2.3.4 +%global tdb_version 1.4.7 +%global tevent_version 0.13.0 Name: libldb -Version: 2.4.1 -Release: 1 +Version: 2.6.1 +Release: 2 Summary: A schema-less, ldap like, API and database Requires: libtalloc%{?_isa} >= %{talloc_version} Requires: libtdb%{?_isa} >= %{tdb_version} @@ -17,6 +17,20 @@ 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 @@ -170,6 +184,24 @@ %{_mandir}/man1/ldbsearch.1.* %changelog +* Sat Apr 01 2023 xinghe <xinghe2@h-partners.com> - 2.6.1-2 +- Type:CVE +- ID:CVE-2023-0614 +- SUG:NA +- DESC:fix CVE-2023-0614 + +* Fri Nov 04 2022 yanglu <yanglu72@h-partners.com> - 2.6.1-1 +- Type:requirement +- ID:NA +- SUG:NA +- DESC:update libldb version to 2.6.1 + +* Mon Aug 01 2022 gaihuiying <eaglegai@163.com> - 2.4.1-2 +- Type:CVE +- ID:CVE-2022-32746 +- SUG:NA +- DESC:fix CVE-2022-32746 + * Wed Dec 15 2021 yanglu <yanglu72@huawei.com> - 2.4.1-1 - Type:update - ID:NA
View file
_service:tar_scm:backport-0001-CVE-2023-0614.patch
Added
@@ -0,0 +1,174 @@ +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
Added
@@ -0,0 +1,72 @@ +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
Added
@@ -0,0 +1,409 @@ +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
Added
@@ -0,0 +1,48 @@ +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
Added
@@ -0,0 +1,104 @@ +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
Added
@@ -0,0 +1,62 @@ +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
Added
@@ -0,0 +1,68 @@ +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
Added
@@ -0,0 +1,1224 @@ +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
Added
@@ -0,0 +1,1275 @@ +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
Added
@@ -0,0 +1,257 @@ +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
Added
@@ -0,0 +1,66 @@ +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
Added
@@ -0,0 +1,231 @@ +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
Added
@@ -0,0 +1,130 @@ +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
Added
@@ -0,0 +1,155 @@ +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
Changed
@@ -2,7 +2,7 @@ <service name="tar_scm"> <param name="scm">git</param> <param name="url">git@gitee.com:src-openeuler/libldb.git</param> - <param name="revision">14bee08f39d98d51ca1675a98dcc2985eed10aea</param> + <param name="revision">master</param> <param name="exclude">*</param> <param name="extract">*</param> </service>
View file
_service:tar_scm:ldb-2.4.1.tar.asc
Deleted
@@ -1,11 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQEzBAABCgAdFiEEkUejOXGVGO6QEby1R5ORYRMIQCUFAmF5NesACgkQR5ORYRMI -QCW4Mwf9F08o0VWPyvCrYdqnpOT6D5HFsrJwwuisMptoflDLfH4a+MRBPlcRBhMT -Ss6DSFb36bmjcNlSJeLdHtqp9LxaoQA4xOw4mWhxnrzQimrIass1h24FOwv5RpCu -EXmNCbRwp22e/e8ntFeKd7wiYBcoOHqM39jMjGbfhksbglemhMpyL92zjyzuHXPD -QeHibpPIZYlCy89LHQgHcUyyLzYN06lRQ5MKKojrerQ7LlsyvGM+EHS0X81683CM -lW2CkQKjFCKRS6tjXCEX1NEj3Xw4gltI3MiaH96ZnecftlINp8vIloqi1NkOK7hl -QylusnpzRqOXL2hr514wJr9F21Mslg== -=RW3H ------END PGP SIGNATURE-----
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/testwaf.sh
Deleted
@@ -1,70 +0,0 @@ -#!/bin/bash - -set -e -set -x - -d=$(dirname $0) - -cd $d/.. -PREFIX=$HOME/testprefix - -if $# -gt 0 ; then - tests="$*" -else - tests="lib/replace lib/talloc lib/tevent lib/tdb lib/ldb" -fi - -echo "testing in dirs $tests" - -for d in $tests; do - echo "`date`: testing $d" - pushd $d - rm -rf bin - type waf - waf dist - ./configure -C --enable-developer --prefix=$PREFIX - time make - make install - make distcheck - case $d in - "lib/ldb") - ldd bin/ldbadd - ;; - "lib/replace") - ldd bin/replace_testsuite - ;; - "lib/talloc") - ldd bin/talloc_testsuite - ;; - "lib/tdb") - ldd bin/tdbtool - ;; - esac - popd -done - -echo "testing python portability" -pushd lib/talloc -versions="python2.4 python2.5 python2.6 python3.0 python3.1" -for p in $versions; do - ret=$(which $p || echo "failed") - if $ret = "failed" ; then - echo "$p not found, skipping" - continue - fi - echo "Testing $p" - $p ../../buildtools/bin/waf configure -C --enable-developer --prefix=$PREFIX - $p ../../buildtools/bin/waf build install -done -popd - -echo "testing cross compiling" -pushd lib/talloc -ret=$(which arm-linux-gnueabi-gcc || echo "failed") -if $ret != "failed" ; then - CC=arm-linux-gnueabi-gcc ./configure -C --prefix=$PREFIX --cross-compile --cross-execute='runarm' - make && make install -else - echo "Cross-compiler not installed, skipping test" -fi -popd
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/replace/cwrap.c
Deleted
@@ -1,46 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * - * Replaceable functions by cwrap - * - * Copyright (c) 2014 Andreas Schneider <asn@samba.org> - * - * ** NOTE! The following LGPL license applies to the replace - * ** 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" - -bool nss_wrapper_enabled(void) -{ - return false; -} - -bool nss_wrapper_hosts_enabled(void) -{ - return false; -} - -bool socket_wrapper_enabled(void) -{ - return false; -} - -bool uid_wrapper_enabled(void) -{ - return false; -}
View file
_service:tar_scm:ldb-2.6.1.tar.asc
Added
@@ -0,0 +1,11 @@ +-----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/ABI/ldb-2.5.0.sigs
Added
@@ -0,0 +1,283 @@ +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_value: int (struct ldb_message *, const char *, const struct ldb_val *, struct ldb_message_element **) +ldb_msg_canonicalize: struct ldb_message *(struct ldb_context *, const struct ldb_message *) +ldb_msg_check_string_attribute: int (const struct ldb_message *, const char *, const char *) +ldb_msg_copy: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_copy_attr: int (struct ldb_message *, const char *, const char *) +ldb_msg_copy_shallow: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_diff: struct ldb_message *(struct ldb_context *, struct ldb_message *, struct ldb_message *) +ldb_msg_difference: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message *, struct ldb_message *, struct ldb_message **) +ldb_msg_element_compare: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_compare_name: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_equal_ordered: bool (const struct ldb_message_element *, const struct ldb_message_element *) +ldb_msg_find_attr_as_bool: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_dn: struct ldb_dn *(struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, const char *) +ldb_msg_find_attr_as_double: double (const struct ldb_message *, const char *, double) +ldb_msg_find_attr_as_int: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_int64: int64_t (const struct ldb_message *, const char *, int64_t) +ldb_msg_find_attr_as_string: const char *(const struct ldb_message *, const char *, const char *) +ldb_msg_find_attr_as_uint: unsigned int (const struct ldb_message *, const char *, unsigned int) +ldb_msg_find_attr_as_uint64: uint64_t (const struct ldb_message *, const char *, uint64_t) +ldb_msg_find_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.6.1.tar.gz/ABI/ldb-2.6.0.sigs
Added
@@ -0,0 +1,283 @@ +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_value: int (struct ldb_message *, const char *, const struct ldb_val *, struct ldb_message_element **) +ldb_msg_canonicalize: struct ldb_message *(struct ldb_context *, const struct ldb_message *) +ldb_msg_check_string_attribute: int (const struct ldb_message *, const char *, const char *) +ldb_msg_copy: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_copy_attr: int (struct ldb_message *, const char *, const char *) +ldb_msg_copy_shallow: struct ldb_message *(TALLOC_CTX *, const struct ldb_message *) +ldb_msg_diff: struct ldb_message *(struct ldb_context *, struct ldb_message *, struct ldb_message *) +ldb_msg_difference: int (struct ldb_context *, TALLOC_CTX *, struct ldb_message *, struct ldb_message *, struct ldb_message **) +ldb_msg_element_compare: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_compare_name: int (struct ldb_message_element *, struct ldb_message_element *) +ldb_msg_element_equal_ordered: bool (const struct ldb_message_element *, const struct ldb_message_element *) +ldb_msg_find_attr_as_bool: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_dn: struct ldb_dn *(struct ldb_context *, TALLOC_CTX *, const struct ldb_message *, const char *) +ldb_msg_find_attr_as_double: double (const struct ldb_message *, const char *, double) +ldb_msg_find_attr_as_int: int (const struct ldb_message *, const char *, int) +ldb_msg_find_attr_as_int64: int64_t (const struct ldb_message *, const char *, int64_t) +ldb_msg_find_attr_as_string: const char *(const struct ldb_message *, const char *, const char *) +ldb_msg_find_attr_as_uint: unsigned int (const struct ldb_message *, const char *, unsigned int) +ldb_msg_find_attr_as_uint64: uint64_t (const struct ldb_message *, const char *, uint64_t) +ldb_msg_find_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.6.1.tar.gz/ABI/ldb-2.6.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.6.1.tar.gz/ABI/pyldb-util-2.5.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.6.1.tar.gz/ABI/pyldb-util-2.6.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.6.1.tar.gz/ABI/pyldb-util-2.6.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.4.1.tar.gz/buildtools/bin/waf -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/bin/waf
Changed
@@ -32,7 +32,7 @@ import os, sys, inspect -VERSION="2.0.21" +VERSION="2.0.24" REVISION="x" GIT="x" INSTALL="x" @@ -164,4 +164,3 @@ from waflib import Scripting Scripting.waf_entry_point(cwd, VERSION, wafdir0) -
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/compare_config_h4.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/compare_config_h4.sh
Changed
@@ -3,8 +3,8 @@ # compare the generated config.h from a waf build with existing samba # build -grep "^.define" bin/default/source4/include/config.h | sort > waf-config.h -grep "^.define" $HOME/samba_old/source4/include/config.h | sort > old-config.h +grep "^.define" bin/default/source4/include/config.h | sort >waf-config.h +grep "^.define" $HOME/samba_old/source4/include/config.h | sort >old-config.h comm -23 old-config.h waf-config.h
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/compare_generated.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/compare_generated.sh
Changed
@@ -10,41 +10,40 @@ strip_file() { - in_file=$1 - out_file=$2 - cat $in_file | - grep -v 'The following definitions come from' | - grep -v 'Automatically generated at' | - grep -v 'Generated from' | - sed 's|/home/tnagy/samba/source4||g' | - sed 's|/home/tnagy/samba/|../|g' | - sed 's|bin/default/source4/||g' | - sed 's|bin/default/|../|g' | - sed 's/define _____/define ___/g' | - sed 's/define __*/define _/g' | - sed 's/define _DEFAULT_/define _/g' | - sed 's/define _SOURCE4_/define ___/g' | - sed 's/define ___/define _/g' | - sed 's/ifndef ___/ifndef _/g' | - sed 's|endif /* ____|endif /* __|g' | - sed s/__DEFAULT_SOURCE4/__/ | - sed s/__DEFAULT_SOURCE4/__/ | - sed s/__DEFAULT/____/ > $out_file + in_file=$1 + out_file=$2 + cat $in_file | + grep -v 'The following definitions come from' | + grep -v 'Automatically generated at' | + grep -v 'Generated from' | + sed 's|/home/tnagy/samba/source4||g' | + sed 's|/home/tnagy/samba/|../|g' | + sed 's|bin/default/source4/||g' | + sed 's|bin/default/|../|g' | + sed 's/define _____/define ___/g' | + sed 's/define __*/define _/g' | + sed 's/define _DEFAULT_/define _/g' | + sed 's/define _SOURCE4_/define ___/g' | + sed 's/define ___/define _/g' | + sed 's/ifndef ___/ifndef _/g' | + sed 's|endif /* ____|endif /* __|g' | + sed s/__DEFAULT_SOURCE4/__/ | + sed s/__DEFAULT_SOURCE4/__/ | + sed s/__DEFAULT/____/ >$out_file } compare_file() { - f=$f - bname=$(basename $f) - t1=/tmp/$bname.old.$$ - t2=/tmp/$bname.new.$$ - strip_file $old_build/$f $t1 - strip_file bin/default/$f $t2 - diff -u -b $t1 $t2 2>&1 - rm -f $t1 $t2 + f=$f + bname=$(basename $f) + t1=/tmp/$bname.old.$$ + t2=/tmp/$bname.new.$$ + strip_file $old_build/$f $t1 + strip_file bin/default/$f $t2 + diff -u -b $t1 $t2 2>&1 + rm -f $t1 $t2 } for f in $gen_files; do - compare_file $f + compare_file $f done -
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/compare_install.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/compare_install.sh
Changed
@@ -3,6 +3,6 @@ prefix1="$1" prefix2="$2" -(cd $prefix1 && find . ) | sort > p1.txt -(cd $prefix2 && find . ) | sort > p2.txt +(cd $prefix1 && find .) | sort >p1.txt +(cd $prefix2 && find .) | sort >p2.txt diff -u p12.txt
View file
_service:tar_scm:ldb-2.6.1.tar.gz/buildtools/devel_env.sh
Added
@@ -0,0 +1,7 @@ +# This file can be sourced using +# +# source buildtools/devel_env.sh + +# Setup python path for lsp server +PYTHONPATH="$(pwd)/third_party/waf:$(pwd)/python:$(pwd)/bin/python:$(pwd)/selftest:${PYTHONPATH}" +export PYTHONPATH
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/scripts/Makefile.waf -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/scripts/Makefile.waf
Changed
@@ -1,7 +1,7 @@ # simple makefile wrapper to run waf -WAF_BINARY=BUILDTOOLS/bin/waf -WAF=WAF_MAKE=1 $(WAF_BINARY) +WAF_BINARY=$(PYTHON) BUILDTOOLS/bin/waf +WAF=PYTHONHASHSEED=1 WAF_MAKE=1 $(WAF_BINARY) all: $(WAF) build
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/scripts/abi_gen.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/scripts/abi_gen.sh
Changed
@@ -6,16 +6,21 @@ GDBSCRIPT="gdb_syms.$$" ( -cat <<EOF + cat <<EOF set height 0 set width 0 EOF -nm "$SHAREDLIB" | cut -d' ' -f2- | egrep '^BDGTRVWS' | grep -v @ | egrep -v ' (__bss_start|_edata|_init|_fini|_end)' | cut -c3- | sort | while read s; do - echo "echo $s: " - echo p $s -done -) > $GDBSCRIPT + + # On older linker versions _init|_fini symbols are not hidden. + objdump --dynamic-syms "${SHAREDLIB}" | + awk '$0 !~ /.hidden/ {if ($2 == "g" && $3 ~ /D(F|O)/ && $4 ~ /(.bss|.rodata|.text)/) print $NF}' | + sort | + while read -r s; do + echo "echo $s: " + echo p "${s}" + done +) >$GDBSCRIPT # forcing the terminal avoids a problem on Fedora12 -TERM=none gdb -n -batch -x $GDBSCRIPT "$SHAREDLIB" < /dev/null +TERM=none gdb -n -batch -x $GDBSCRIPT "$SHAREDLIB" </dev/null rm -f $GDBSCRIPT
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/scripts/autogen-waf.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/scripts/autogen-waf.sh
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -p=`dirname $0` +p=$(dirname $0) echo "Setting up for waf build" @@ -13,12 +13,12 @@ echo "Setting up configure" rm -f $p/configure $p/include/config*.h* -sed "s|BUILDTOOLS|$d|g;s|BUILDPATH|$p|g" < "$p/$d/scripts/configure.waf" > $p/configure +sed "s|BUILDTOOLS|$d|g;s|BUILDPATH|$p|g" <"$p/$d/scripts/configure.waf" >$p/configure chmod +x $p/configure echo "Setting up Makefile" rm -f $p/makefile $p/Makefile -sed "s|BUILDTOOLS|$d|g" < "$p/$d/scripts/Makefile.waf" > $p/Makefile +sed "s|BUILDTOOLS|$d|g" <"$p/$d/scripts/Makefile.waf" >$p/Makefile echo "done. Now run $p/configure or $p/configure.developer then make." if $p != "." ; then
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/scripts/configure.waf -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/scripts/configure.waf
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -PREVPATH=`dirname $0` +PREVPATH=$(dirname $0) WAF=BUILDTOOLS/bin/waf @@ -9,6 +9,13 @@ JOBS=1 export JOBS +# Make sure we don't have any library preloaded. +unset LD_PRELOAD + +# Make sure we get stable hashes +PYTHONHASHSEED=1 +export PYTHONHASHSEED + cd BUILDPATH || exit 1 -$WAF configure "$@" || exit 1 +$PYTHON $WAF configure "$@" || exit 1 cd $PREVPATH
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba3.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba3.py
Changed
@@ -35,14 +35,14 @@ # the extra_includes list is relative to the source3 directory extra_includes = '.', 'include', 'lib' - # local heimdal paths only included when USING_SYSTEM_KRB5 is not set - if not bld.CONFIG_SET("USING_SYSTEM_KRB5"): - extra_includes += '../source4/heimdal/lib/com_err', - '../source4/heimdal/lib/krb5', - '../source4/heimdal/lib/gssapi', - '../source4/heimdal/lib/gssapi/gssapi', - '../source4/heimdal_build/include', - '../bin/default/source4/heimdal/lib/asn1' + # local heimdal paths must only be included when using our embedded Heimdal + if bld.CONFIG_SET("USING_EMBEDDED_HEIMDAL"): + extra_includes += '../third_party/heimdal/lib/com_err', + '../third_party/heimdal/lib/base', + '../third_party/heimdal/lib/krb5', + '../third_party/heimdal/lib/gssapi/gssapi', + '../third_party/heimdal_build/include', + '../bin/default/third_party/heimdal/lib/asn1' if bld.CONFIG_SET('USING_SYSTEM_TDB'): (tdb_includes, tdb_ldflags, tdb_cpppath) = library_flags(bld, 'tdb') @@ -85,6 +85,11 @@ return bld.SAMBA_LIBRARY(name, *args, **kwargs) Build.BuildContext.SAMBA3_LIBRARY = SAMBA3_LIBRARY +def SAMBA3_PLUGIN(bld, name, *args, **kwargs): + s3_fix_kwargs(bld, kwargs) + return bld.SAMBA_PLUGIN(name, *args, **kwargs) +Build.BuildContext.SAMBA3_PLUGIN = SAMBA3_PLUGIN + def SAMBA3_MODULE(bld, name, *args, **kwargs): s3_fix_kwargs(bld, kwargs) return bld.SAMBA_MODULE(name, *args, **kwargs)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_abi.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_abi.py
Changed
@@ -142,7 +142,7 @@ abi_gen = os.path.join(topsrc, 'buildtools/scripts/abi_gen.sh') abi_file = "%s/%s-%s.sigs" % (self.abi_directory, self.version_libname, - self.vnum) + self.abi_vnum) tsk = self.create_task('abi_check', self.link_task.outputs0) tsk.ABI_FILE = abi_file @@ -157,6 +157,46 @@ if not symname in symmap: symmapsymname = version +def version_script_map_process_file(fname, version, abi_match): + '''process one standard version_script file, adding the symbols to the + abi_match''' + in_section = False + in_global = False + in_local = False + for _line in Utils.readf(fname).splitlines(): + line = _line.strip() + if line == "": + continue + if line.startswith("#"): + continue + if line.endswith(" {"): + in_section = True + continue + if line == "};": + assert in_section + in_section = False + in_global = False + in_local = False + continue + if not in_section: + continue + if line == "global:": + in_global = True + in_local = False + continue + if line == "local:": + in_global = False + in_local = True + continue + + symname = line.split(";")0 + assert symname != "" + if in_local: + if symname == "*": + continue + symname = "!%s" % symname + if not symname in abi_match: + abi_match.append(symname) def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match): """Write a vscript file for a library in --version-script format. @@ -214,21 +254,51 @@ symmap = {} versions = + abi_match = list(task.env.ABI_MATCH) for f in task.inputs: fname = f.abspath(task.env) basename = os.path.basename(fname) - version = basenamelen(task.env.LIBNAME)+1:-len(".sigs") - versions.append(version) - abi_process_file(fname, version, symmap) + if basename.endswith(".sigs"): + version = basenamelen(task.env.LIBNAME)+1:-len(".sigs") + versions.append(version) + abi_process_file(fname, version, symmap) + continue + if basename == "version-script.map": + version_script_map_process_file(fname, task.env.VERSION, abi_match) + continue + raise Errors.WafError('Unsupported input "%s"' % fname) + if task.env.PRIVATE_LIBRARY: + # For private libraries we need to inject + # each public symbol explicitly into the + # abi match array and remove all explicit + # versioning so that each exported symbol + # is tagged with the private library tag. + for s in symmap: + abi_match.append(s) + symmap = {} + versions = f = open(tgt, mode='w') try: abi_write_vscript(f, task.env.LIBNAME, task.env.VERSION, versions, - symmap, task.env.ABI_MATCH) + symmap, abi_match) finally: f.close() +def VSCRIPT_MAP_PRIVATE(bld, libname, orig_vscript, version, private_vscript): + version = version.replace("-", "_").replace("+","_").upper() + t = bld.SAMBA_GENERATOR(private_vscript, + rule=abi_build_vscript, + source=orig_vscript, + group='vscripts', + target=private_vscript) + t.env.ABI_MATCH = + t.env.VERSION = version + t.env.LIBNAME = libname + t.env.PRIVATE_LIBRARY = True + t.vars = 'LIBNAME', 'VERSION', 'ABI_MATCH', 'PRIVATE_LIBRARY' +Build.BuildContext.VSCRIPT_MAP_PRIVATE = VSCRIPT_MAP_PRIVATE -def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None): +def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None, private_library=False): '''generate a vscript file for our public libraries''' if abi_directory: source = bld.path.ant_glob('%s/%s-0-9*.sigs' % (abi_directory, libname), flat=True) @@ -238,6 +308,9 @@ else: source = '' + if private_library is None: + private_library = False + libname = os.path.basename(libname) version = os.path.basename(version) libname = libname.replace("-", "_").replace("+","_").upper() @@ -255,5 +328,6 @@ t.env.ABI_MATCH = abi_match t.env.VERSION = version t.env.LIBNAME = libname - t.vars = 'LIBNAME', 'VERSION', 'ABI_MATCH' + t.env.PRIVATE_LIBRARY = private_library + t.vars = 'LIBNAME', 'VERSION', 'ABI_MATCH', 'PRIVATE_LIBRARY' Build.BuildContext.ABI_VSCRIPT = ABI_VSCRIPT
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_autoconf.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_autoconf.py
Changed
@@ -212,7 +212,7 @@ @conf -def CHECK_DECLS(conf, vars, reverse=False, headers=None, always=False): +def CHECK_DECLS(conf, vars, reverse=False, headers=None, lib=None, always=False): '''check a list of variable declarations, using the HAVE_DECL_xxx form of define @@ -227,6 +227,7 @@ if not CHECK_VARIABLE(conf, v, define=define, headers=headers, + lib=lib, msg='Checking for declaration of %s' % v, always=always): if not CHECK_CODE(conf, @@ -238,6 +239,7 @@ msg='Checking for declaration of %s (as enum)' % v, local_include=False, headers=headers, + lib=lib, define=define, always=always): ret = False @@ -342,6 +344,23 @@ return ret @conf +def CHECK_SIGN(conf, v, headers=None): + '''check the sign of a type''' + define_name = v.upper().replace(' ', '_') + for op, signed in ('<', 'signed'), + ('>', 'unsigned'): + if CHECK_CODE(conf, + f'static int test_array1 - 2 * !((({v})-1) {op} 0);', + define=f'{define_name}_{signed.upper()}', + quote=False, + headers=headers, + local_include=False, + msg=f"Checking if '{v}' is {signed}"): + return True + + return False + +@conf def CHECK_VALUEOF(conf, v, headers=None, define=None): '''check the value of a variable/define''' ret = True @@ -787,6 +806,9 @@ conf.env'EXTRA_CFLAGS' = conf.env'EXTRA_CFLAGS'.extend(TO_LIST("-Werror=format")) + if CHECK_CFLAGS(conf, "-Wno-error=array-bounds"): + conf.define('HAVE_WNO_ERROR_ARRAY_BOUNDS', 1) + if not Options.options.disable_warnings_as_errors: conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror -Wno-error=deprecated-declarations', testflags=True) conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=tautological-compare', testflags=True)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_bundled.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_bundled.py
Changed
@@ -5,19 +5,9 @@ from waflib.Configure import conf from wafsamba import samba_utils -def PRIVATE_NAME(bld, name, private_extension, private_library): +def PRIVATE_NAME(bld, name): '''possibly rename a library to include a bundled extension''' - if not private_library: - return name - - # we now use the same private name for libraries as the public name. - # see http://git.samba.org/?p=tridge/junkcode.git;a=tree;f=shlib for a - # demonstration that this is the right thing to do - # also see http://lists.samba.org/archive/samba-technical/2011-January/075816.html - if private_extension: - return name - extension = bld.env.PRIVATE_EXTENSION if extension and name.startswith('%s' % extension): @@ -95,20 +85,22 @@ return False return True -@conf -def LIB_MUST_BE_BUNDLED(conf, libname): - if libname in conf.env.BUNDLED_LIBS: +def __LIB_MUST_BE(liblist, libname): + if libname in liblist: return True - if '!%s' % libname in conf.env.BUNDLED_LIBS: + if '!%s' % libname in liblist: return False - if 'ALL' in conf.env.BUNDLED_LIBS: + if 'ALL' in liblist: return True return False @conf +def LIB_MUST_BE_BUNDLED(conf, libname): + return __LIB_MUST_BE(conf.env.BUNDLED_LIBS, libname) + +@conf def LIB_MUST_BE_PRIVATE(conf, libname): - return ('ALL' in conf.env.PRIVATE_LIBS or - libname in conf.env.PRIVATE_LIBS) + return __LIB_MUST_BE(conf.env.PRIVATE_LIBS, libname) @conf def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0',
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_cross.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_cross.py
Changed
@@ -77,7 +77,7 @@ f.close() return (0, ans.strip("'")) else: - m = re.match('\(\s*(-?\d+)\s*,\s*\"(.*)\"\s*\)', ans) + m = re.match(r'\(\s*(-?\d+)\s*,\s*\"(.*)\"\s*\)', ans) if m: f.close() return (int(m.group(1)), m.group(2)) @@ -134,7 +134,7 @@ cross_answers_incomplete = True add_answer(ca_file, msg, ans) (retcode, retstring) = ans - args = '/bin/sh', '-c', "echo -n '%s'; exit %d" % (retstring, retcode) + args = '/bin/sh', '-c', "printf %%s '%s'; exit %d" % (retstring, retcode) real_Popen.__init__(*(obj, args), **kw)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_deps.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_deps.py
Changed
@@ -2,12 +2,11 @@ import os, sys, re -from waflib import Build, Options, Logs, Utils, Errors +from waflib import Build, Options, Logs, Utils, Errors, Task from waflib.Logs import debug from waflib.Configure import conf from waflib import ConfigSet -from samba_bundled import BUILTIN_LIBRARY from samba_utils import LOCAL_CACHE, TO_LIST, get_tgt_list, unique_list from samba_autoconf import library_flags @@ -78,7 +77,7 @@ the full dependency list for a target until we have all of the targets declared. ''' - if self.samba_type in 'LIBRARY', 'BINARY', 'PYTHON': + if self.samba_type in 'LIBRARY', 'PLUGIN', 'BINARY', 'PYTHON': self.uselib = list(self.final_syslibs) self.uselib_local = list(self.final_libs) self.add_objects = list(self.final_objects) @@ -102,7 +101,7 @@ debug('deps: computed dependencies for target %s: uselib=%s uselib_local=%s add_objects=%s', self.sname, self.uselib, self.uselib_local, self.add_objects) - if self.samba_type in 'SUBSYSTEM': + if self.samba_type in 'SUBSYSTEM', 'BUILTIN': # this is needed for the cflags of libs that come from pkg_config self.uselib = list(self.final_syslibs) self.uselib.extend(list(self.direct_syslibs)) @@ -284,7 +283,7 @@ # build a list of targets that each source file is part of for t in tgt_list: - if not targetst.sname in 'LIBRARY', 'BINARY', 'PYTHON' : + if not targetst.sname in 'LIBRARY', 'PLUGIN', 'BINARY', 'PYTHON' : continue for obj in t.add_objects: t2 = t.bld.get_tgen_by_name(obj) @@ -354,7 +353,7 @@ targets = LOCAL_CACHE(bld, 'TARGET_TYPE') for t in tgt_list: - if not targetst.sname in 'LIBRARY', 'BINARY', 'PYTHON', 'SUBSYSTEM': + if not targetst.sname in 'LIBRARY', 'PLUGIN', 'BINARY', 'PYTHON', 'SUBSYSTEM', 'BUILTIN': continue debug('deps: final dependencies for target %s: uselib=%s uselib_local=%s add_objects=%s', t.sname, t.uselib, getattr(t, 'uselib_local', ), getattr(t, 'add_objects', )) @@ -376,6 +375,58 @@ t.samba_includes_extended = TO_LIST(t.samba_includes): t.cflags = getattr(t, 'samba_cflags', '') +def replace_builtin_subsystem_deps(bld, tgt_list): + '''replace dependencies based on builtin subsystems/libraries + + ''' + + targets = LOCAL_CACHE(bld, 'TARGET_TYPE') + + # If either the target or the dependency require builtin linking + # we should replace the dependency + for t in tgt_list: + t_require_builtin_deps = getattr(t, 'samba_require_builtin_deps', False) + if t_require_builtin_deps: + debug("deps: target %s: requires builtin dependencies..." % (t.sname)) + else: + debug("deps: target %s: does not require builtin dependencies..." % (t.sname)) + + replacing = {} + + for dep in t.samba_deps_extended: + bld.ASSERT(dep in targets, "target %s: dependency target %s not declared" % (t.sname, dep)) + dtype = targetsdep + bld.ASSERT(dtype != 'BUILTIN', "target %s: dependency target %s is BUILTIN" % (t.sname, dep)) + bld.ASSERT(dtype != 'PLUGIN', "target %s: dependency target %s is PLUGIN" % (t.sname, dep)) + if dtype not in 'SUBSYSTEM', 'LIBRARY': + debug("deps: target %s: keep %s dependency %s" % (t.sname, dtype, dep)) + continue + dt = bld.get_tgen_by_name(dep) + bld.ASSERT(dt is not None, "target %s: dependency target %s not found by name" % (t.sname, dep)) + dt_require_builtin_deps = getattr(dt, 'samba_require_builtin_deps', False) + if not dt_require_builtin_deps and not t_require_builtin_deps: + # both target and dependency don't require builtin linking + continue + sdt = getattr(dt, 'samba_builtin_subsystem', None) + if not t_require_builtin_deps: + if sdt is None: + debug("deps: target %s: dependency %s requires builtin deps only" % (t.sname, dep)) + continue + debug("deps: target %s: dependency %s requires builtin linking" % (t.sname, dep)) + bld.ASSERT(sdt is not None, "target %s: dependency target %s is missing samba_builtin_subsystem" % (t.sname, dep)) + sdep = sdt.sname + bld.ASSERT(sdep in targets, "target %s: builtin dependency target %s (from %s) not declared" % (t.sname, sdep, dep)) + sdt = targetssdep + bld.ASSERT(sdt == 'BUILTIN', "target %s: builtin dependency target %s (from %s) is not BUILTIN" % (t.sname, sdep, dep)) + replacingdep = sdep + + for i in range(len(t.samba_deps_extended)): + dep = t.samba_deps_extendedi + if dep in replacing: + sdep = replacingdep + debug("deps: target %s: replacing dependency %s with builtin subsystem %s" % (t.sname, dep, sdep)) + t.samba_deps_extendedi = sdep + def replace_grouping_libraries(bld, tgt_list): '''replace dependencies based on grouping libraries @@ -446,7 +497,12 @@ t.direct_syslibs.add(d) if d in syslib_deps: for implied in TO_LIST(syslib_depsd): - if BUILTIN_LIBRARY(bld, implied): + if targetsimplied == 'SUBSYSTEM': + it = bld.get_tgen_by_name(implied) + sit = getattr(it, 'samba_builtin_subsystem', None) + if sit: + implied = sit.sname + if targetsimplied == 'BUILTIN': t.direct_objects.add(implied) elif targetsimplied == 'SYSLIB': t.direct_syslibs.add(implied) @@ -463,8 +519,13 @@ sys.exit(1) if t2.samba_type in 'LIBRARY', 'MODULE' : t.direct_libs.add(d) - elif t2.samba_type in 'SUBSYSTEM', 'ASN1', 'PYTHON' : + elif t2.samba_type in 'SUBSYSTEM', 'BUILTIN', 'ASN1', 'PYTHON' : t.direct_objects.add(d) + elif t2.samba_type in 'PLUGIN' : + Logs.error('Implicit dependency %s in %s is of type %s' % ( + d, t.sname, t2.samba_type)) + sys.exit(1) + debug('deps: built direct dependencies') @@ -654,10 +715,10 @@ # expand indirect subsystem and library loops for loop in loops.copy(): t = bld.get_tgen_by_name(loop) - if t.samba_type in 'SUBSYSTEM': + if t.samba_type in 'SUBSYSTEM', 'BUILTIN': loopsloop = loopsloop.union(t.indirect_objects) loopsloop = loopsloop.union(t.direct_objects) - if t.samba_type in 'LIBRARY','PYTHON': + if t.samba_type in 'LIBRARY', 'PLUGIN', 'PYTHON': loopsloop = loopsloop.union(t.indirect_libs) loopsloop = loopsloop.union(t.direct_libs) if loop in loopsloop: @@ -698,6 +759,8 @@ def reduce_objects(bld, tgt_list): '''reduce objects by looking for indirect object dependencies''' + targets = LOCAL_CACHE(bld, 'TARGET_TYPE') + rely_on = {} for t in tgt_list: @@ -705,7 +768,7 @@ changed = False - for type in 'BINARY', 'PYTHON', 'LIBRARY': + for type in 'BINARY', 'PYTHON', 'LIBRARY', 'PLUGIN': for t in tgt_list: if t.samba_type != type: continue # if we will indirectly link to a target then we don't need it @@ -718,8 +781,13 @@ dup = dup.difference(rely_ont.sname) if dup: # Do not remove duplicates of BUILTINS - d = next(iter(dup)) - if BUILTIN_LIBRARY(bld, d): + for d in iter(dup.copy()): + dtype = targetsd + if dtype == 'BUILTIN': + debug('deps: BUILTIN SKIP: removing dups from %s of type %s: %s also in %s %s', + t.sname, t.samba_type, d, t2.samba_type, l) + dup.remove(d) + if len(dup) == 0: continue debug('deps: removing dups from %s of type %s: %s also in %s %s', @@ -729,6 +797,19 @@ if not l in rely_on: rely_onl = set() rely_onl = rely_onl.union(dup) + for n in iter(new.copy()): + # if we got the builtin version as well + # as the native one, we keep using the + # builtin one and remove the rest. + # Otherwise our check_duplicate_sources() + # checks would trigger! + if n.endswith('.builtin.objlist'): + unused = n.replace('.builtin.objlist', '.objlist') + if unused in new: + new.remove(unused) + unused = n.replace('.builtin.objlist', '') + if unused in new: + new.remove(unused) t.final_objects = new if not changed: @@ -834,7 +915,7 @@ # we now need to make corrections for any library loops we broke up # any target that depended on the target of the loop and doesn't # depend on the source of the loop needs to get the loop source added - for type in 'BINARY','PYTHON','LIBRARY','BINARY': + for type in 'BINARY','PYTHON','LIBRARY','PLUGIN','BINARY': for t in tgt_list: if t.samba_type != type: continue for loop in loops: @@ -867,7 +948,7 @@ # add in any syslib dependencies for t in tgt_list: - if not t.samba_type in 'BINARY','PYTHON','LIBRARY','SUBSYSTEM': + if not t.samba_type in 'BINARY','PYTHON','LIBRARY','PLUGIN','SUBSYSTEM','BUILTIN': continue syslibs = set() for d in t.final_objects: @@ -884,7 +965,7 @@ # find any unresolved library loops lib_loop_error = False for t in tgt_list: - if t.samba_type in 'LIBRARY', 'PYTHON': + if t.samba_type in 'LIBRARY', 'PLUGIN', 'PYTHON': for l in t.final_libs.copy(): t2 = bld.get_tgen_by_name(l) if t.sname in t2.final_libs: @@ -942,10 +1023,10 @@ Logs.info("showing indirect dependency counts (sorted by count)") - def indirect_count(t1, t2): - return len(t2.indirect_objects) - len(t1.indirect_objects) + def indirect_count(t): + return len(t.indirect_objects) - sorted_list = sorted(tgt_list, cmp=indirect_count) + sorted_list = sorted(tgt_list, key=indirect_count, reverse=True) for t in sorted_list: if len(t.indirect_objects) > 1: Logs.info("%s depends on %u indirect objects" % (t.sname, len(t.indirect_objects))) @@ -1083,6 +1164,52 @@ return True +def generate_clangdb(bld): + classes = + for x in ('c', 'cxx'): + cls = Task.classes.get(x) + if cls: + classes.append(cls) + task_classes = tuple(classes) + + tasks = + for g in bld.groups: + for tg in g: + if isinstance(tg, Task.Task): + lst = tg + else: + lst = tg.tasks + for task in lst: + try: + task.last_cmd + except AttributeError: + continue + if isinstance(task, task_classes): + tasks.append(task) + if len(tasks) == 0: + return + + database_file = bld.bldnode.make_node('compile_commands.json') + Logs.info('Build commands will be stored in %s', + database_file.path_from(bld.path)) + try: + root = database_file.read_json() + except IOError: + root = + clang_db = dict((x'file', x) for x in root) + for task in tasks: + f_node = task.inputs0 + cmd = task.last_cmd + filename = f_node.path_from(task.get_cwd()) + entry = { + "directory": task.get_cwd().abspath(), + "arguments": cmd, + "file": filename, + } + clang_dbfilename = entry + root = list(clang_db.values()) + database_file.write_json(root) + def check_project_rules(bld): '''check the project rules - ensuring the targets are sane''' @@ -1107,6 +1234,10 @@ debug('deps: project rules checking started') + replace_builtin_subsystem_deps(bld, tgt_list) + + debug("deps: replace_builtin_subsystem_deps: %s" % str(timer)) + expand_subsystem_deps(bld) debug("deps: expand_subsystem_deps: %s" % str(timer)) @@ -1167,6 +1298,10 @@ Logs.info("Project rules pass") + if bld.cmd == 'build': + Task.Task.keep_last_cmd = True + bld.add_post_fun(generate_clangdb) + def CHECK_PROJECT_RULES(bld): '''enable checking of project targets for sanity'''
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_patterns.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_patterns.py
Changed
@@ -32,112 +32,142 @@ def write_build_options_header(fp): '''write preamble for build_options.c''' - fp.write("/*\n") - fp.write(" Unix SMB/CIFS implementation.\n") - fp.write(" Build Options for Samba Suite\n") - fp.write(" Copyright (C) Vance Lankhaar <vlankhaar@linux.ca> 2003\n") - fp.write(" Copyright (C) Andrew Bartlett <abartlet@samba.org> 2001\n") - fp.write("\n") - fp.write(" This program is free software; you can redistribute it and/or modify\n") - fp.write(" it under the terms of the GNU General Public License as published by\n") - fp.write(" the Free Software Foundation; either version 3 of the License, or\n") - fp.write(" (at your option) any later version.\n") - fp.write("\n") - fp.write(" This program is distributed in the hope that it will be useful,\n") - fp.write(" but WITHOUT ANY WARRANTY; without even the implied warranty of\n") - fp.write(" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n") - fp.write(" GNU General Public License for more details.\n") - fp.write("\n") - fp.write(" You should have received a copy of the GNU General Public License\n") - fp.write(" along with this program; if not, see <http://www.gnu.org/licenses/>.\n") - fp.write("*/\n") - fp.write("\n") - fp.write("#include \"includes.h\"\n") - fp.write("#include \"dynconfig/dynconfig.h\"\n") - fp.write("#include \"lib/cluster_support.h\"\n") - - fp.write("\n") - fp.write("static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);\n") - fp.write("void build_options(bool screen);\n") - fp.write("\n") - fp.write("\n") - fp.write("/****************************************************************************\n") - fp.write("helper function for build_options\n") - fp.write("****************************************************************************/\n") - fp.write("static int output(bool screen, const char *format, ...)\n") - fp.write("{\n") - fp.write(" char *ptr = NULL;\n") - fp.write(" int ret = 0;\n") - fp.write(" va_list ap;\n") - fp.write(" \n") - fp.write(" va_start(ap, format);\n") - fp.write(" ret = vasprintf(&ptr,format,ap);\n") - fp.write(" va_end(ap);\n") - fp.write("\n") - fp.write(" if (screen) {\n") - fp.write(" d_printf(\"%s\", ptr ? ptr : \"\");\n") - fp.write(" } else {\n") - fp.write(" DEBUG(4,(\"%s\", ptr ? ptr : \"\"));\n") - fp.write(" }\n") - fp.write(" \n") - fp.write(" SAFE_FREE(ptr);\n") - fp.write(" return ret;\n") - fp.write("}\n") - fp.write("\n") - fp.write("/****************************************************************************\n") - fp.write("options set at build time for the samba suite\n") - fp.write("****************************************************************************/\n") - fp.write("void build_options(bool screen)\n") - fp.write("{\n") - fp.write(" if ((DEBUGLEVEL < 4) && (!screen)) {\n") - fp.write(" return;\n") - fp.write(" }\n") - fp.write("\n") - fp.write("\n") - fp.write(" /* Output various paths to files and directories */\n") - fp.write(" output(screen,\"\\nPaths:\\n\");\n") - fp.write(" output(screen,\" SBINDIR: %s\\n\", get_dyn_SBINDIR());\n") - fp.write(" output(screen,\" BINDIR: %s\\n\", get_dyn_BINDIR());\n") - fp.write(" output(screen,\" CONFIGFILE: %s\\n\", get_dyn_CONFIGFILE());\n") - fp.write(" output(screen,\" LOGFILEBASE: %s\\n\", get_dyn_LOGFILEBASE());\n") - fp.write(" output(screen,\" LMHOSTSFILE: %s\\n\",get_dyn_LMHOSTSFILE());\n") - fp.write(" output(screen,\" LIBDIR: %s\\n\",get_dyn_LIBDIR());\n") - fp.write(" output(screen,\" DATADIR: %s\\n\",get_dyn_DATADIR());\n") - fp.write(" output(screen,\" SAMBA_DATADIR: %s\\n\",get_dyn_SAMBA_DATADIR());\n") - fp.write(" output(screen,\" MODULESDIR: %s\\n\",get_dyn_MODULESDIR());\n") - fp.write(" output(screen,\" SHLIBEXT: %s\\n\",get_dyn_SHLIBEXT());\n") - fp.write(" output(screen,\" LOCKDIR: %s\\n\",get_dyn_LOCKDIR());\n") - fp.write(" output(screen,\" STATEDIR: %s\\n\",get_dyn_STATEDIR());\n") - fp.write(" output(screen,\" CACHEDIR: %s\\n\",get_dyn_CACHEDIR());\n") - fp.write(" output(screen,\" PIDDIR: %s\\n\", get_dyn_PIDDIR());\n") - fp.write(" output(screen,\" SMB_PASSWD_FILE: %s\\n\",get_dyn_SMB_PASSWD_FILE());\n") - fp.write(" output(screen,\" PRIVATE_DIR: %s\\n\",get_dyn_PRIVATE_DIR());\n") - fp.write(" output(screen,\" BINDDNS_DIR: %s\\n\",get_dyn_BINDDNS_DIR());\n") - fp.write("\n") + fp.write("/*\n" + " Unix SMB/CIFS implementation.\n" + " Build Options for Samba Suite\n" + " Copyright (C) Vance Lankhaar <vlankhaar@linux.ca> 2003\n" + " Copyright (C) Andrew Bartlett <abartlet@samba.org> 2001\n" + "\n" + " This program is free software; you can redistribute it and/or modify\n" + " it under the terms of the GNU General Public License as published by\n" + " the Free Software Foundation; either version 3 of the License, or\n" + " (at your option) any later version.\n" + "\n" + " This program is distributed in the hope that it will be useful,\n" + " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + " GNU General Public License for more details.\n" + "\n" + " You should have received a copy of the GNU General Public License\n" + " along with this program; if not, see <http://www.gnu.org/licenses/>.\n" + "*/\n" + "\n" + "#include \"includes.h\"\n" + "#include \"dynconfig/dynconfig.h\"\n" + "#include \"lib/cluster_support.h\"\n" + + "\n" + "static int output(bool screen, const char *format, ...) PRINTF_ATTRIBUTE(2,3);\n" + "void build_options(bool screen);\n" + "\n" + "\n" + "/****************************************************************************\n" + "helper function for build_options\n" + "****************************************************************************/\n" + "static int output(bool screen, const char *format, ...)\n" + "{\n" + " char *ptr = NULL;\n" + " int ret = 0;\n" + " va_list ap;\n" + " \n" + " va_start(ap, format);\n" + " ret = vasprintf(&ptr,format,ap);\n" + " va_end(ap);\n" + "\n" + " if (screen) {\n" + " d_printf(\"%s\", ptr ? ptr : \"\");\n" + " } else {\n" + " DEBUG(4,(\"%s\", ptr ? ptr : \"\"));\n" + " }\n" + " \n" + " SAFE_FREE(ptr);\n" + " return ret;\n" + "}\n" + "\n" + "/****************************************************************************\n" + "options set at build time for the samba suite\n" + "****************************************************************************/\n" + "void build_options(bool screen)\n" + "{\n" + " if ((DEBUGLEVEL < 4) && (!screen)) {\n" + " return;\n" + " }\n" + "\n" + "\n" + " /* Output various paths to files and directories */\n" + " output(screen,\"\\nPaths:\\n\"\n" + " \" SBINDIR: %s\\n\"\n" + " \" BINDIR: %s\\n\"\n" + " \" CONFIGFILE: %s\\n\"\n" + " \" LOGFILEBASE: %s\\n\"\n" + " \" LMHOSTSFILE: %s\\n\"\n" + " \" LIBDIR: %s\\n\"\n" + " \" DATADIR: %s\\n\"\n" + " \" SAMBA_DATADIR: %s\\n\"\n" + " \" MODULESDIR: %s\\n\"\n" + " \" SHLIBEXT: %s\\n\"\n" + " \" LOCKDIR: %s\\n\"\n" + " \" STATEDIR: %s\\n\"\n" + " \" CACHEDIR: %s\\n\"\n" + " \" PIDDIR: %s\\n\"\n" + " \" SMB_PASSWD_FILE: %s\\n\"\n" + " \" PRIVATE_DIR: %s\\n\"\n" + " \" BINDDNS_DIR: %s\\n\",\n" + " get_dyn_SBINDIR(),\n" + " get_dyn_BINDIR(),\n" + " get_dyn_CONFIGFILE(),\n" + " get_dyn_LOGFILEBASE(),\n" + " get_dyn_LMHOSTSFILE(),\n" + " get_dyn_LIBDIR(),\n" + " get_dyn_DATADIR(),\n" + " get_dyn_SAMBA_DATADIR(),\n" + " get_dyn_MODULESDIR(),\n" + " get_dyn_SHLIBEXT(),\n" + " get_dyn_LOCKDIR(),\n" + " get_dyn_STATEDIR(),\n" + " get_dyn_CACHEDIR(),\n" + " get_dyn_PIDDIR(),\n" + " get_dyn_SMB_PASSWD_FILE(),\n" + " get_dyn_PRIVATE_DIR(),\n" + " get_dyn_BINDDNS_DIR());\n" + "\n") def write_build_options_footer(fp): - fp.write(" /* Output the sizes of the various cluster features */\n") - fp.write(" output(screen, \"\\n%s\", cluster_support_features());\n") - fp.write("\n") - fp.write(" /* Output the sizes of the various types */\n") - fp.write(" output(screen, \"\\nType sizes:\\n\");\n") - fp.write(" output(screen, \" sizeof(char): %lu\\n\",(unsigned long)sizeof(char));\n") - fp.write(" output(screen, \" sizeof(int): %lu\\n\",(unsigned long)sizeof(int));\n") - fp.write(" output(screen, \" sizeof(long): %lu\\n\",(unsigned long)sizeof(long));\n") - fp.write(" output(screen, \" sizeof(long long): %lu\\n\",(unsigned long)sizeof(long long));\n") - fp.write(" output(screen, \" sizeof(uint8_t): %lu\\n\",(unsigned long)sizeof(uint8_t));\n") - fp.write(" output(screen, \" sizeof(uint16_t): %lu\\n\",(unsigned long)sizeof(uint16_t));\n") - fp.write(" output(screen, \" sizeof(uint32_t): %lu\\n\",(unsigned long)sizeof(uint32_t));\n") - fp.write(" output(screen, \" sizeof(short): %lu\\n\",(unsigned long)sizeof(short));\n") - fp.write(" output(screen, \" sizeof(void*): %lu\\n\",(unsigned long)sizeof(void*));\n") - fp.write(" output(screen, \" sizeof(size_t): %lu\\n\",(unsigned long)sizeof(size_t));\n") - fp.write(" output(screen, \" sizeof(off_t): %lu\\n\",(unsigned long)sizeof(off_t));\n") - fp.write(" output(screen, \" sizeof(ino_t): %lu\\n\",(unsigned long)sizeof(ino_t));\n") - fp.write(" output(screen, \" sizeof(dev_t): %lu\\n\",(unsigned long)sizeof(dev_t));\n") - fp.write("\n") - fp.write(" output(screen, \"\\nBuiltin modules:\\n\");\n") - fp.write(" output(screen, \" %s\\n\", STRING_STATIC_MODULES);\n") - fp.write("}\n") + fp.write(" /* Output the sizes of the various cluster features */\n" + " output(screen, \"\\n%s\", cluster_support_features());\n" + "\n" + " /* Output the sizes of the various types */\n" + " output(screen, \"\\nType sizes:\\n\"\n" + " \" sizeof(char): %lu\\n\"\n" + " \" sizeof(int): %lu\\n\"\n" + " \" sizeof(long): %lu\\n\"\n" + " \" sizeof(long long): %lu\\n\"\n" + " \" sizeof(uint8_t): %lu\\n\"\n" + " \" sizeof(uint16_t): %lu\\n\"\n" + " \" sizeof(uint32_t): %lu\\n\"\n" + " \" sizeof(short): %lu\\n\"\n" + " \" sizeof(void*): %lu\\n\"\n" + " \" sizeof(size_t): %lu\\n\"\n" + " \" sizeof(off_t): %lu\\n\"\n" + " \" sizeof(ino_t): %lu\\n\"\n" + " \" sizeof(dev_t): %lu\\n\",\n" + " (unsigned long)sizeof(char),\n" + " (unsigned long)sizeof(int),\n" + " (unsigned long)sizeof(long),\n" + " (unsigned long)sizeof(long long),\n" + " (unsigned long)sizeof(uint8_t),\n" + " (unsigned long)sizeof(uint16_t),\n" + " (unsigned long)sizeof(uint32_t),\n" + " (unsigned long)sizeof(short),\n" + " (unsigned long)sizeof(void*),\n" + " (unsigned long)sizeof(size_t),\n" + " (unsigned long)sizeof(off_t),\n" + " (unsigned long)sizeof(ino_t),\n" + " (unsigned long)sizeof(dev_t));\n" + "\n" + " output(screen, \"\\nBuiltin modules:\\n\"\n" + " \" %s\\n\", STRING_STATIC_MODULES);\n" + "}\n") def write_build_options_section(fp, keys, section): fp.write("\n\t/* Show %s */\n" % section)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_perl.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_perl.py
Changed
@@ -28,7 +28,6 @@ return v except IndexError: conf.end_msg(False, 'YELLOW') - pass return None vendor_prefix = check_perl_config_var('vendorprefix')
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_python.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_python.py
Changed
@@ -7,9 +7,6 @@ @conf def SAMBA_CHECK_PYTHON(conf, version=(3,6,0)): - if conf.env.enable_fuzzing: - version=(3,5,0) - # enable tool to build python extensions if conf.env.HAVE_PYTHON_H: conf.check_python_version(version)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_third_party.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_third_party.py
Changed
@@ -24,12 +24,12 @@ @conf def CHECK_SOCKET_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.3.3') + return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.3.4') Build.BuildContext.CHECK_SOCKET_WRAPPER = CHECK_SOCKET_WRAPPER @conf def CHECK_NSS_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.11') + return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.12') Build.BuildContext.CHECK_NSS_WRAPPER = CHECK_NSS_WRAPPER @conf @@ -44,5 +44,5 @@ @conf def CHECK_PAM_WRAPPER(conf): - return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.1.2') + return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.1.4') Build.BuildContext.CHECK_PAM_WRAPPER = CHECK_PAM_WRAPPER
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/samba_utils.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/samba_utils.py
Changed
@@ -465,8 +465,7 @@ 'CleanContext', 'InstallContext', 'UninstallContext', - 'ListContext', - 'ClangDbContext': + 'ListContext': return ctx.recurse(relpath) if 'waflib.extras.compat15' in sys.modules: return ctx.recurse(relpath) @@ -658,7 +657,7 @@ tgt_list = for tgt in targets: type = targetstgt - if not type in 'SUBSYSTEM', 'MODULE', 'BINARY', 'LIBRARY', 'ASN1', 'PYTHON': + if not type in 'SUBSYSTEM', 'BUILTIN', 'MODULE', 'BINARY', 'LIBRARY', 'PLUGIN', 'ASN1', 'PYTHON': continue t = bld.get_tgen_by_name(tgt) if t is None:
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/stale_files.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/stale_files.py
Changed
@@ -69,7 +69,7 @@ objpath = os.path.normpath(output.abspath(bld.env)) expected.append(objpath) for t in tlist: - if ttype in 'LIBRARY','MODULE': + if ttype in 'LIBRARY', 'PLUGIN', 'MODULE': t = samba_utils.apply_pattern(t, bld.env.shlib_PATTERN) if ttype == 'PYTHON': t = samba_utils.apply_pattern(t, bld.env.pyext_PATTERN)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/symbols.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/symbols.py
Changed
@@ -252,7 +252,7 @@ bld.env.public_symbolsname = bld.env.public_symbolsname.union(t.public_symbols) else: bld.env.public_symbolsname = t.public_symbols - if t.samba_type == 'LIBRARY': + if t.samba_type in 'LIBRARY', 'PLUGIN': for dep in t.add_objects: t2 = bld.get_tgen_by_name(dep) bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep)) @@ -265,7 +265,7 @@ bld.env.used_symbolsname = bld.env.used_symbolsname.union(t.used_symbols) else: bld.env.used_symbolsname = t.used_symbols - if t.samba_type == 'LIBRARY': + if t.samba_type in 'LIBRARY', 'PLUGIN': for dep in t.add_objects: t2 = bld.get_tgen_by_name(dep) bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep)) @@ -281,7 +281,7 @@ bld.env.library_dict = {} for t in tgt_list: - if t.samba_type in 'LIBRARY', 'PYTHON' : + if t.samba_type in 'LIBRARY', 'PLUGIN', 'PYTHON' : linkpath = os.path.realpath(t.link_task.outputs0.abspath(bld.env)) bld.env.library_dictlinkpath = t.sname @@ -296,7 +296,7 @@ syslibs = {} objmap = {} for t in tgt_list: - if getattr(t, 'uselib', ) and t.samba_type in 'LIBRARY', 'BINARY', 'PYTHON' : + if getattr(t, 'uselib', ) and t.samba_type in 'LIBRARY', 'PLUGIN', 'BINARY', 'PYTHON' : for lib in t.uselib: if lib in 'PYEMBED', 'PYEXT': lib = "python" @@ -386,10 +386,10 @@ t.in_library = for t in tgt_list: - if t.samba_type in 'LIBRARY' : + if t.samba_type in 'LIBRARY', 'PLUGIN': for obj in t.samba_deps_extended: t2 = bld.get_tgen_by_name(obj) - if t2 and t2.samba_type in 'SUBSYSTEM', 'ASN1' : + if t2 and t2.samba_type in 'SUBSYSTEM', 'BUILTIN', 'ASN1' : if not t.sname in t2.in_library: t2.in_library.append(t.sname) bld.env.done_build_library_names = True
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/test_duplicate_symbol.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/test_duplicate_symbol.sh
Changed
@@ -5,6 +5,9 @@ subunit_start_test duplicate_symbols +PYTHONHASHSEED=1 +export PYTHONHASHSEED + if $PYTHON ./buildtools/bin/waf build --dup-symbol-check; then subunit_pass_test duplicate_symbols else
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/wafsamba.py -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/wafsamba.py
Changed
@@ -38,7 +38,7 @@ os.environ'PYTHONUNBUFFERED' = '1' -if Context.HEXVERSION not in (0x2001500,): +if Context.HEXVERSION not in (0x2001800,): 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 @@ -55,11 +55,12 @@ mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, LIB_PATH)) mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, LIB_PATH, "private")) mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, "modules")) + mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, "plugins")) mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, 'python/samba/dcerpc')) # this allows all of the bin/shared and bin/python targets # to be expressed in terms of build directory paths mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, 'default')) - for (source, target) in ('shared', 'shared'), ('modules', 'modules'), ('python', 'python'): + for (source, target) in ('shared', 'shared'), ('modules', 'modules'), ('plugins', 'plugins'), ('python', 'python'): link_target = os.path.join(conf.env.BUILD_DIRECTORY, 'default/' + target) if not os.path.lexists(link_target): symlink('../' + source, link_target) @@ -122,25 +123,56 @@ pyembed=False, pyext=False, target_type='LIBRARY', - bundled_extension=False, bundled_name=None, link_name=None, abi_directory=None, abi_match=None, + orig_vscript_map=None, hide_symbols=False, manpages=None, private_library=False, grouping_library=False, + require_builtin_deps=False, + provide_builtin_linking=False, + builtin_cflags='', allow_undefined_symbols=False, allow_warnings=False, enabled=True): '''define a Samba library''' + # We support: + # - LIBRARY: this can be use to link via -llibname + # - MODULE: this is module from SAMBA_MODULE() + # - PLUGIN: this is plugin for external consumers to be + # loaded via dlopen() + # - PYTHON: a python C binding library + # + if target_type not in 'LIBRARY', 'MODULE', 'PLUGIN', 'PYTHON': + raise Errors.WafError("target_type%s not supported in SAMBA_LIBRARY('%s')" % + (target_type, libname)) + + if require_builtin_deps: + # For now we only support require_builtin_deps only for libraries, plugins + if target_type not in 'LIBRARY', 'PLUGIN': + raise Errors.WafError("target_type%s not supported SAMBA_LIBRARY('%s', require_builtin_deps=True)" % + (target_type, libname)) + if private_library and public_headers: raise Errors.WafError("private library '%s' must not have public header files" % libname) - if LIB_MUST_BE_PRIVATE(bld, libname): + if orig_vscript_map and not private_library: + raise Errors.WafError("public library '%s' must not have orig_vscript_map" % + libname) + + if orig_vscript_map and abi_directory: + raise Errors.WafError("private library '%s' with orig_vscript_map must not have abi_directory" % + libname) + if orig_vscript_map and abi_match: + raise Errors.WafError("private library '%s' with orig_vscript_map must not have abi_match" % + libname) + + if LIB_MUST_BE_PRIVATE(bld, libname) and target_type not in 'PLUGIN': private_library = True if not enabled: @@ -162,10 +194,26 @@ target=empty_c) source=empty_c + samba_deps = deps + ' ' + public_deps + samba_deps = TO_LIST(samba_deps) + if BUILTIN_LIBRARY(bld, libname): - obj_target = libname + builtin_target = libname + '.builtin.objlist' + builtin_cflags_end = '-D_PUBLIC_=_PRIVATE_' + empty_target = libname + obj_target = None else: + if provide_builtin_linking: + builtin_target = libname + '.builtin.objlist' + builtin_cflags_end = '-D_PUBLIC_=_PRIVATE_' + else: + builtin_target = None + empty_target = None obj_target = libname + '.objlist' + if require_builtin_deps: + # hide the builtin deps from the callers + samba_deps = TO_LIST('') + dep_target = obj_target if group == 'libraries': subsystem_group = 'main' @@ -175,27 +223,51 @@ # first create a target for building the object files for this library # by separating in this way, we avoid recompiling the C files # separately for the install library and the build library - bld.SAMBA_SUBSYSTEM(obj_target, - source = source, - deps = deps, - public_deps = public_deps, - includes = includes, - public_headers = public_headers, - public_headers_install = public_headers_install, - private_headers= private_headers, - header_path = header_path, - cflags = cflags, - cflags_end = cflags_end, - group = subsystem_group, - autoproto = autoproto, - autoproto_extra_source=autoproto_extra_source, - depends_on = depends_on, - hide_symbols = hide_symbols, - allow_warnings = allow_warnings, - pyembed = pyembed, - pyext = pyext, - local_include = local_include, - global_include = global_include) + if builtin_target: + __t = __SAMBA_SUBSYSTEM_BUILTIN(bld, builtin_target, source, + deps=deps, + public_deps=public_deps, + includes=includes, + header_path=header_path, + builtin_cflags=builtin_cflags, + builtin_cflags_end=builtin_cflags_end, + group=group, + depends_on=depends_on, + local_include=local_include, + global_include=global_include, + allow_warnings=allow_warnings) + builtin_subsystem = __t + else: + builtin_subsystem = None + if obj_target: + bld.SAMBA_SUBSYSTEM(obj_target, + source = source, + deps = deps, + public_deps = public_deps, + includes = includes, + public_headers = public_headers, + public_headers_install = public_headers_install, + private_headers= private_headers, + header_path = header_path, + cflags = cflags, + cflags_end = cflags_end, + group = subsystem_group, + autoproto = autoproto, + autoproto_extra_source=autoproto_extra_source, + depends_on = depends_on, + hide_symbols = hide_symbols, + allow_warnings = allow_warnings, + pyembed = pyembed, + pyext = pyext, + local_include = local_include, + __require_builtin_deps=require_builtin_deps, + global_include = global_include) + else: + et = bld.SAMBA_SUBSYSTEM(empty_target, + source=, + __force_empty=True, + __require_builtin_deps=True) + et.samba_builtin_subsystem = builtin_subsystem if BUILTIN_LIBRARY(bld, libname): return @@ -204,9 +276,7 @@ return # the library itself will depend on that object target - deps += ' ' + public_deps - deps = TO_LIST(deps) - deps.append(obj_target) + samba_deps.append(dep_target) realname = bld.map_shlib_extension(realname, python=(target_type=='PYTHON')) link_name = bld.map_shlib_extension(link_name, python=(target_type=='PYTHON')) @@ -223,6 +293,8 @@ raise Errors.WafError("public library '%s' must have header files" % libname) + abi_vnum = vnum + if bundled_name is not None: pass elif target_type == 'PYTHON' or realname or not private_library: @@ -232,10 +304,8 @@ bundled_name = libname.replace('_', '-') else: assert (private_library == True and realname is None) - if abi_directory or vnum or soname: - bundled_extension=True - bundled_name = PRIVATE_NAME(bld, libname.replace('_', '-'), - bundled_extension, private_library) + bundled_name = PRIVATE_NAME(bld, libname.replace('_', '-')) + vnum = None ldflags = TO_LIST(ldflags) if bld.env'ENABLE_RELRO' is True: @@ -262,15 +332,18 @@ vscript = None if bld.env.HAVE_LD_VERSION_SCRIPT: if private_library: - version = "%s_%s" % (Context.g_module.APPNAME, Context.g_module.VERSION) + version = bld.env.PRIVATE_VERSION elif vnum: version = "%s_%s" % (libname, vnum) else: version = None if version: vscript = "%s.vscript" % libname - bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript, - abi_match) + if orig_vscript_map: + bld.VSCRIPT_MAP_PRIVATE(version_libname, orig_vscript_map, version, vscript) + else: + bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript, + abi_match, private_library) fullname = apply_pattern(bundled_name, bld.env.cshlib_PATTERN) fullpath = bld.path.find_or_declare(fullname) vscriptpath = bld.path.find_or_declare(vscript) @@ -292,7 +365,7 @@ target = bundled_name, depends_on = depends_on, samba_ldflags = ldflags, - samba_deps = deps, + samba_deps = samba_deps, samba_includes = includes, version_script = vscript, version_libname = version_libname, @@ -307,9 +380,12 @@ samba_install = install, abi_directory = "%s/%s" % (bld.path.abspath(), abi_directory), abi_match = abi_match, + abi_vnum = abi_vnum, private_library = private_library, grouping_library=grouping_library, - allow_undefined_symbols=allow_undefined_symbols + allow_undefined_symbols=allow_undefined_symbols, + samba_require_builtin_deps=False, + samba_builtin_subsystem=builtin_subsystem, ) if realname and not link_name: @@ -558,17 +634,125 @@ manpages=manpages, allow_undefined_symbols=allow_undefined_symbols, allow_warnings=allow_warnings, + private_library=True, install=install ) Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE +################################################################# +def SAMBA_PLUGIN(bld, pluginname, source, + deps='', + includes='', + vnum=None, + soname=None, + cflags='', + ldflags='', + local_include=True, + global_include=True, + vars=None, + subdir=None, + realname=None, + keep_underscore=False, + autoproto=None, + autoproto_extra_source='', + install_path=None, + install=True, + manpages=None, + require_builtin_deps=True, + allow_undefined_symbols=False, + enabled=True): + '''define an external plugin.''' + + bld.ASSERT(realname, "You must specify a realname for SAMBA_PLUGIN(%s)" % pluginname) + + source = bld.EXPAND_VARIABLES(source, vars=vars) + if subdir: + source = bld.SUBDIR(subdir, source) + + build_name = "_plugin_%s" % (pluginname) + build_link_name = "plugins/%s" % (realname) + + bld.SAMBA_LIBRARY(pluginname, + source, + bundled_name=build_name, + link_name=build_link_name, + target_type='PLUGIN', + deps=deps, + includes=includes, + vnum=vnum, + soname=soname, + cflags=cflags, + ldflags=ldflags, + realname=realname, + autoproto=autoproto, + autoproto_extra_source=autoproto_extra_source, + local_include=local_include, + global_include=global_include, + vars=vars, + group='main', + install_path=install_path, + install=install, + manpages=manpages, + require_builtin_deps=require_builtin_deps, + builtin_cflags=cflags, + hide_symbols=True, + public_headers=, + public_headers_install=False, + pc_files=, + allow_undefined_symbols=allow_undefined_symbols, + allow_warnings=False, + enabled=enabled) +Build.BuildContext.SAMBA_PLUGIN = SAMBA_PLUGIN + +def __SAMBA_SUBSYSTEM_BUILTIN(bld, builtin_target, source, + deps='', + public_deps='', + includes='', + public_headers=None, + public_headers_install=True, + private_headers=None, + header_path=None, + builtin_cflags='', + builtin_cflags_end=None, + group='main', + autoproto=None, + autoproto_extra_source='', + depends_on='', + local_include=True, + global_include=True, + allow_warnings=False): + + bld.ASSERT(builtin_target.endswith('.builtin.objlist'), + "builtin_target%s does not end with '.builtin.objlist'" % + (builtin_target)) + return bld.SAMBA_SUBSYSTEM(builtin_target, source, + deps=deps, + public_deps=public_deps, + includes=includes, + public_headers=public_headers, + public_headers_install=public_headers_install, + private_headers=private_headers, + header_path=header_path, + cflags=builtin_cflags, + cflags_end=builtin_cflags_end, + hide_symbols=True, + group=group, + target_type='BUILTIN', + autoproto=autoproto, + autoproto_extra_source=autoproto_extra_source, + depends_on=depends_on, + local_include=local_include, + global_include=global_include, + allow_warnings=allow_warnings, + __require_builtin_deps=True) ################################################################# def SAMBA_SUBSYSTEM(bld, modname, source, deps='', public_deps='', + __force_empty=False, includes='', public_headers=None, public_headers_install=True, @@ -577,6 +761,7 @@ cflags='', cflags_end=None, group='main', + target_type='SUBSYSTEM', init_function_sentinel=None, autoproto=None, autoproto_extra_source='', @@ -591,18 +776,28 @@ vars=None, subdir=None, hide_symbols=False, + __require_builtin_deps=False, + provide_builtin_linking=False, + builtin_cflags='', allow_warnings=False, pyext=False, pyembed=False): '''define a Samba subsystem''' + # We support: + # - SUBSYSTEM: a normal subsystem from SAMBA_SUBSYSTEM() + # - BUILTIN: a hidden subsystem from __SAMBA_SUBSYSTEM_BUILTIN() + if target_type not in 'SUBSYSTEM', 'BUILTIN': + raise Errors.WafError("target_type%s not supported in SAMBA_SUBSYSTEM('%s')" % + (target_type, modname)) + if not enabled: SET_TARGET_TYPE(bld, modname, 'DISABLED') return # remember empty subsystems, so we can strip the dependencies if ((source == '') or (source == )): - if deps == '' and public_deps == '': + if not __force_empty and deps == '' and public_deps == '': SET_TARGET_TYPE(bld, modname, 'EMPTY') return empty_c = modname + '.empty.c' @@ -611,7 +806,7 @@ target=empty_c) source=empty_c - if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'): + if not SET_TARGET_TYPE(bld, modname, target_type): return source = bld.EXPAND_VARIABLES(source, vars=vars) @@ -646,6 +841,8 @@ samba_subsystem= subsystem_name, samba_use_hostcc = use_hostcc, samba_use_global_deps = use_global_deps, + samba_require_builtin_deps = __require_builtin_deps, + samba_builtin_subsystem = None, ) if cflags_end is not None: @@ -656,6 +853,39 @@ if public_headers is not None: bld.PUBLIC_HEADERS(public_headers, header_path=header_path, public_headers_install=public_headers_install) + + if provide_builtin_linking: + + if use_hostcc: + raise Errors.WafError("subsystem%s provide_builtin_linking=True " + + "not allowed with use_hostcc=True" % + modname) + + if pyext or pyembed: + raise Errors.WafError("subsystem%s provide_builtin_linking=True " + + "not allowed with pyext=True nor pyembed=True" % + modname) + + if __require_builtin_deps: + raise Errors.WafError("subsystem%s provide_builtin_linking=True " + + "not allowed with __require_builtin_deps=True" % + modname) + + builtin_target = modname + '.builtin.objlist' + tbuiltin = __SAMBA_SUBSYSTEM_BUILTIN(bld, builtin_target, source, + deps=deps, + public_deps=public_deps, + includes=includes, + header_path=header_path, + builtin_cflags=builtin_cflags, + builtin_cflags_end='-D_PUBLIC_=_PRIVATE_', + group=group, + depends_on=depends_on, + local_include=local_include, + global_include=global_include, + allow_warnings=allow_warnings) + t.samba_builtin_subsystem = tbuiltin + return t @@ -679,15 +909,23 @@ if not enabled: return + dep_vars = TO_LIST(dep_vars) dep_vars.append('ruledeps') dep_vars.append('SAMBA_GENERATOR_VARS') + shell=isinstance(rule, str) + + # This ensures that if the command (executed in the shell) fails + # (returns non-zero), the build fails + if shell: + rule = "set -e; " + rule + bld.SET_BUILD_GROUP(group) t = bld( rule=rule, source=bld.EXPAND_VARIABLES(source, vars=vars), + shell=shell, target=target, - shell=isinstance(rule, str), update_outputs=True, before='c', ext_out='.c', @@ -949,10 +1187,10 @@ source = m + '.xml' if extra_source is not None: source = source, extra_source - # ${SRC1} and ${SRC2} are not referenced in the + # ${SRC1}, ${SRC2} and ${SRC3} are not referenced in the # SAMBA_GENERATOR but trigger the dependency calculation so # ensures that manpages are rebuilt when these change. - source += 'build/DTD/samba.entities', 'build/DTD/samba.build.version' + source += 'build/DTD/samba.build.pathconfig', 'build/DTD/samba.entities', 'build/DTD/samba.build.version' bld.SAMBA_GENERATOR(m, source=source, target=m,
View file
_service:tar_scm:ldb-2.4.1.tar.gz/buildtools/wafsamba/wscript -> _service:tar_scm:ldb-2.6.1.tar.gz/buildtools/wafsamba/wscript
Changed
@@ -8,6 +8,10 @@ from samba_utils import symlink from optparse import SUPPRESS_HELP +phs = os.environ.get("PYTHONHASHSEED", None) +if phs != "1": + raise Errors.WafError('''PYTHONHASHSEED=1 missing! Don't use waf directly, use ./configure and make!''') + # this forces configure to be re-run if any of the configure # sections of the build scripts change. We have to check # for this in sys.argv as options have not yet been parsed when @@ -30,11 +34,37 @@ gr = opt.option_group('library handling options') gr.add_option('--bundled-libraries', - help=("comma separated list of bundled libraries. May include !LIBNAME to disable bundling a library. Can be 'NONE' or 'ALL' auto"), + help=(f'''comma separated list of bundled libraries. + +{Context.g_module.APPNAME} includes copies of externally maintained +system libraries (such as popt, cmokca) as well as Samba-maintained +libraries that can be found on the system already (such as talloc, +tdb). + +This option, most useful for packagers, controls if each library +should be forced to be obtained from inside Samba (bundled), forced to +be obtained from the system (bundling disabled, ensuing that +dependency errors are not silently missed) or if that choice should be +automatic (best for end users). + +May include !LIBNAME to disable bundling a library. + +Can be 'NONE' or 'ALL' auto'''), action="store", dest='BUNDLED_LIBS', default='') gr.add_option('--private-libraries', - help=("comma separated list of normally public libraries to build instead as private libraries. May include !LIBNAME to disable making a library private. Can be 'NONE' or 'ALL' auto"), + help=(f'''comma separated list of normally public libraries to build instead as private libraries. + +By default {Context.g_module.APPNAME} will publish a number of public +libraries for use by other software. For Samba this would include +libwbclient, libsmbclient and others. + +This allows that to be disabled, to ensure that other software does +not use these libraries and they are placed in a private filesystem +prefix. + +May include !LIBNAME to disable making a library private in order to +limit the effect of 'ALL' '''), action="store", dest='PRIVATE_LIBS', default='') extension_default = default_value('PRIVATE_EXTENSION_DEFAULT') @@ -48,12 +78,33 @@ action="store", dest='PRIVATE_EXTENSION_EXCEPTION', default=extension_exception) builtin_default = default_value('BUILTIN_LIBRARIES_DEFAULT') - gr.add_option('--builtin-libraries', - help=("command separated list of libraries to build directly into binaries %s" % builtin_default), - action="store", dest='BUILTIN_LIBRARIES', default=builtin_default) + gr.add_option('--builtin-libraries', help=( +f'''comma separated list of libraries to build directly into binaries. + +By default {Context.g_module.APPNAME} will build a large number of +shared libraries, to reduce binary size. This overrides this +behaviour and essentially statically links the specified libraries into +each binary {builtin_default}'''), + action="store", + dest='BUILTIN_LIBRARIES', default=builtin_default) gr.add_option('--minimum-library-version', - help=("list of minimum system library versions (LIBNAME1:version,LIBNAME2:version)"), + help=( +f'''list of minimum system library versions for otherwise bundled +libraries. + +{Context.g_module.APPNAME} by default requires that, in order to match +what is tested in our continuous integration (CI) test-suite, that the +versions of libraries that we include match that found on the system, +before we will select not to 'bundle'. + +This option, possibly useful for packagers, allows that specified +version to be overridden (say, if it is absolutely known that a the +newer version included in this tarball has no relevant changes). + +Use this with extreme care + +(LIBNAME1:version,LIBNAME2:version)'''), action="store", dest='MINIMUM_LIBRARY_VERSION', default='') gr.add_option('--disable-rpath', @@ -66,7 +117,13 @@ help=("Disable use of rpath for private library path in installed files"), action="store_true", dest='disable_rpath_private_install', default=False) gr.add_option('--nonshared-binary', - help=("Disable use of shared libs for the listed binaries"), + help=( +f'''Disable use of shared libaries internal to {Context.g_module.APPNAME} for the listed binaries. + +The resulting binaries are 'statically linked' with regard to components provided by +{Context.g_module.APPNAME}, but remain dynamically linked to (eg) libc.so and libgnutls.so + +Currently the only tested value is 'smbtorture,smbd/smbd' for Samba'''), action="store", dest='NONSHARED_BINARIES', default='') gr.add_option('--disable-symbol-versions', help=("Disable use of the --version-script linker option"), @@ -132,9 +189,6 @@ action="store_true", dest='undefined_sanitizer', default=False) - gr.add_option('--enable-clangdb', - help=("Enable use of clang_compilation_database"), - action="store_true", dest='enable_clangdb', default=False) gr.add_option('--enable-libfuzzer', help=("Build fuzzing binaries (use ADDITIONAL_CFLAGS to specify compiler options for libFuzzer or use CC=honggfuzz/hfuzz-cc)"), action="store_true", dest='enable_libfuzzer', default=False) @@ -272,6 +326,8 @@ conf.env.PRIVATE_EXTENSION = Options.options.PRIVATE_EXTENSION conf.env.PRIVATE_EXTENSION_EXCEPTION = Options.options.PRIVATE_EXTENSION_EXCEPTION.split(',') + conf.env.PRIVATE_VERSION = "%s_%s_%s" % (Context.g_module.APPNAME, + Context.g_module.VERSION, conf.env.PRIVATE_EXTENSION) conf.env.CROSS_COMPILE = Options.options.CROSS_COMPILE conf.env.CROSS_EXECUTE = Options.options.CROSS_EXECUTE @@ -663,13 +719,10 @@ conf.DEFINE('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', 1) conf.env.FUZZ_TARGET_LDFLAGS = Options.options.FUZZ_TARGET_LDFLAGS - conf.env.enable_clangdb = Options.options.enable_clangdb - if conf.env.enable_clangdb: - conf.load('clang_compilation_database') - # Create a symlink of the compile db for clangd - symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), - os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), - force=True) + # Create a symlink of the compile db for clangd + symlink(os.path.join(conf.bldnode.abspath(), 'default/compile_commands.json'), + os.path.join(conf.srcnode.abspath(), 'compile_commands.json'), + force=True) conf.SAMBA_BUILD_ENV()
View file
_service:tar_scm:ldb-2.4.1.tar.gz/common/ldb.c -> _service:tar_scm:ldb-2.6.1.tar.gz/common/ldb.c
Changed
@@ -312,10 +312,7 @@ void ldb_reset_err_string(struct ldb_context *ldb) { - if (ldb->err_string) { - talloc_free(ldb->err_string); - ldb->err_string = NULL; - } + TALLOC_FREE(ldb->err_string); }
View file
_service:tar_scm:ldb-2.4.1.tar.gz/common/ldb_dn.c -> _service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_dn.c
Changed
@@ -298,7 +298,7 @@ char *parse_dn; bool is_index; - if (dn == NULL || dn->invalid == true) { + if (dn == NULL || dn->invalid) { return false; } @@ -324,7 +324,7 @@ } /* Special DNs case */ - if (dn->special == true) { + if (dn->special) { return true; } @@ -350,7 +350,7 @@ d = dt = data; while (*p) { - if (in_extended == true) { + if (in_extended) { if (!in_ex_name && !in_ex_value) { @@ -437,8 +437,8 @@ *d++ = *p++; continue; } - if (in_attr == true) { - if (trim == true) { + if (in_attr) { + if (trim) { if (*p == ' ') { p++; continue; @@ -505,7 +505,7 @@ goto failed; } - if (is_oid == true && ( ! (isdigit(*p) || (*p == '.')))) { + if (is_oid && ( ! (isdigit(*p) || (*p == '.')))) { /* not a digit nor a dot, * invalid attribute oid */ ldb_dn_mark_invalid(dn); @@ -521,8 +521,8 @@ continue; } - if (in_value == true) { - if (in_quote == true) { + if (in_value) { + if (in_quote) { if (*p == '\"') { if (p-1 != '\\') { p++; @@ -535,7 +535,7 @@ continue; } - if (trim == true) { + if (trim) { if (*p == ' ') { p++; continue; @@ -558,7 +558,7 @@ */ case ',': - if (escape == true) { + if (escape) { *d++ = *p++; l++; escape = false; @@ -620,7 +620,7 @@ accept the base64 encoded binary index values, which contain a '+' or '=' which should normally be escaped */ - if (is_index == true) { + if (is_index) { if (t != NULL) { t = NULL; } @@ -635,7 +635,7 @@ case '>': case ';': /* a string with not escaped specials is invalid (tested) */ - if (escape == false) { + if (!escape) { ldb_dn_mark_invalid(dn); goto failed; } @@ -650,7 +650,7 @@ break; case '\\': - if (escape == false) { + if (!escape) { escape = true; p++; continue; @@ -666,7 +666,7 @@ break; default: - if (escape == true) { + if (escape) { if (isxdigit(p0) && isxdigit(p1)) { if (sscanf(p, "%02x", &x) != 1) { /* invalid escaping sequence */ @@ -706,13 +706,13 @@ } } - if (in_attr == true || in_quote == true) { + if (in_attr || in_quote) { /* invalid dn */ ldb_dn_mark_invalid(dn); goto failed; } - if (in_value == true) { + if (in_value) { /* save last element */ if (t != NULL) { /* trim back */
View file
_service:tar_scm:ldb-2.4.1.tar.gz/common/ldb_modules.c -> _service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_modules.c
Changed
@@ -197,9 +197,11 @@ int ret; char *backend; struct backends_list_entry *be; + char *colon = NULL; - if (strchr(url, ':') != NULL) { - backend = talloc_strndup(ldb, url, strchr(url, ':')-url); + colon = strchr(url, ':'); + if (colon != NULL) { + backend = talloc_strndup(ldb, url, colon-url); } else { /* Default to tdb */ backend = talloc_strdup(ldb, "tdb");
View file
_service:tar_scm:ldb-2.4.1.tar.gz/common/ldb_msg.c -> _service:tar_scm:ldb-2.6.1.tar.gz/common/ldb_msg.c
Changed
@@ -418,6 +418,47 @@ } /* + * add a value to a message element + */ +int ldb_msg_element_add_value(TALLOC_CTX *mem_ctx, + struct ldb_message_element *el, + const struct ldb_val *val) +{ + struct ldb_val *vals; + + if (el->flags & LDB_FLAG_INTERNAL_SHARED_VALUES) { + /* + * Another message is using this message element's values array, + * so we don't want to make any modifications to the original + * message, or potentially invalidate its own values by calling + * talloc_realloc(). Make a copy instead. + */ + el->flags &= ~LDB_FLAG_INTERNAL_SHARED_VALUES; + + vals = talloc_array(mem_ctx, struct ldb_val, + el->num_values + 1); + if (vals == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + + if (el->values != NULL) { + memcpy(vals, el->values, el->num_values * sizeof(struct ldb_val)); + } + } else { + vals = talloc_realloc(mem_ctx, el->values, struct ldb_val, + el->num_values + 1); + if (vals == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + } + el->values = vals; + el->valuesel->num_values = *val; + el->num_values++; + + return LDB_SUCCESS; +} + +/* add a value to a message */ int ldb_msg_add_value(struct ldb_message *msg, @@ -426,7 +467,6 @@ struct ldb_message_element **return_el) { struct ldb_message_element *el; - struct ldb_val *vals; int ret; el = ldb_msg_find_element(msg, attr_name); @@ -437,14 +477,10 @@ } } - vals = talloc_realloc(msg->elements, el->values, struct ldb_val, - el->num_values+1); - if (!vals) { - return LDB_ERR_OPERATIONS_ERROR; + ret = ldb_msg_element_add_value(msg->elements, el, val); + if (ret != LDB_SUCCESS) { + return ret; } - el->values = vals; - el->valuesel->num_values = *val; - el->num_values++; if (return_el) { *return_el = el; @@ -473,12 +509,15 @@ /* - add a string element to a message + add a string element to a message, specifying flags */ -int ldb_msg_add_string(struct ldb_message *msg, - const char *attr_name, const char *str) +int ldb_msg_add_string_flags(struct ldb_message *msg, + const char *attr_name, const char *str, + int flags) { struct ldb_val val; + int ret; + struct ldb_message_element *el = NULL; val.data = discard_const_p(uint8_t, str); val.length = strlen(str); @@ -488,7 +527,25 @@ return LDB_SUCCESS; } - return ldb_msg_add_value(msg, attr_name, &val, NULL); + ret = ldb_msg_add_value(msg, attr_name, &val, &el); + if (ret != LDB_SUCCESS) { + return ret; + } + + if (flags != 0) { + el->flags = flags; + } + + return LDB_SUCCESS; +} + +/* + add a string element to a message +*/ +int ldb_msg_add_string(struct ldb_message *msg, + const char *attr_name, const char *str) +{ + return ldb_msg_add_string_flags(msg, attr_name, str, 0); } /* @@ -550,6 +607,142 @@ return ldb_msg_add_steal_value(msg, attr_name, &val); } +static int ldb_msg_append_value_impl(struct ldb_message *msg, + const char *attr_name, + const struct ldb_val *val, + int flags, + struct ldb_message_element **return_el) +{ + struct ldb_message_element *el = NULL; + int ret; + + ret = ldb_msg_add_empty(msg, attr_name, flags, &el); + if (ret != LDB_SUCCESS) { + return ret; + } + + ret = ldb_msg_element_add_value(msg->elements, el, val); + if (ret != LDB_SUCCESS) { + return ret; + } + + if (return_el != NULL) { + *return_el = el; + } + + return LDB_SUCCESS; +} + +/* + append a value to a message +*/ +int ldb_msg_append_value(struct ldb_message *msg, + const char *attr_name, + const struct ldb_val *val, + int flags) +{ + return ldb_msg_append_value_impl(msg, attr_name, val, flags, NULL); +} + +/* + append a value to a message, stealing it into the 'right' place +*/ +int ldb_msg_append_steal_value(struct ldb_message *msg, + const char *attr_name, + struct ldb_val *val, + int flags) +{ + int ret; + struct ldb_message_element *el = NULL; + + ret = ldb_msg_append_value_impl(msg, attr_name, val, flags, &el); + if (ret == LDB_SUCCESS) { + talloc_steal(el->values, val->data); + } + return ret; +} + +/* + append a string element to a message, stealing it into the 'right' place +*/ +int ldb_msg_append_steal_string(struct ldb_message *msg, + const char *attr_name, char *str, + int flags) +{ + struct ldb_val val; + + val.data = (uint8_t *)str; + val.length = strlen(str); + + if (val.length == 0) { + /* allow empty strings as non-existent attributes */ + return LDB_SUCCESS; + } + + return ldb_msg_append_steal_value(msg, attr_name, &val, flags); +} + +/* + append a string element to a message +*/ +int ldb_msg_append_string(struct ldb_message *msg, + const char *attr_name, const char *str, int flags) +{ + struct ldb_val val; + + val.data = discard_const_p(uint8_t, str); + val.length = strlen(str); + + if (val.length == 0) { + /* allow empty strings as non-existent attributes */ + return LDB_SUCCESS; + } + + return ldb_msg_append_value(msg, attr_name, &val, flags); +} + +/* + append a DN element to a message + WARNING: this uses the linearized string from the dn, and does not + copy the string. +*/ +int ldb_msg_append_linearized_dn(struct ldb_message *msg, const char *attr_name, + struct ldb_dn *dn, int flags) +{ + char *str = ldb_dn_alloc_linearized(msg, dn); + + if (str == NULL) { + /* we don't want to have unknown DNs added */ + return LDB_ERR_OPERATIONS_ERROR; + } + + return ldb_msg_append_steal_string(msg, attr_name, str, flags); +} + +/* + append a printf formatted element to a message +*/ +int ldb_msg_append_fmt(struct ldb_message *msg, int flags, + const char *attr_name, const char *fmt, ...) +{ + struct ldb_val val; + va_list ap; + char *str = NULL; + + va_start(ap, fmt); + str = talloc_vasprintf(msg, fmt, ap); + va_end(ap); + + if (str == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + + val.data = (uint8_t *)str; + val.length = strlen(str); + + return ldb_msg_append_steal_value(msg, attr_name, &val, flags); +} + /* compare two ldb_message_element structures assumes case sensitive comparison @@ -833,11 +1026,7 @@ ldb_msg_element_compare_name); } -/* - shallow copy a message - copying only the elements array so that the caller - can safely add new elements without changing the message -*/ -struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx, +static struct ldb_message *ldb_msg_copy_shallow_impl(TALLOC_CTX *mem_ctx, const struct ldb_message *msg) { struct ldb_message *msg2; @@ -863,6 +1052,35 @@ return NULL; } +/* + shallow copy a message - copying only the elements array so that the caller + can safely add new elements without changing the message +*/ +struct ldb_message *ldb_msg_copy_shallow(TALLOC_CTX *mem_ctx, + const struct ldb_message *msg) +{ + struct ldb_message *msg2; + unsigned int i; + + msg2 = ldb_msg_copy_shallow_impl(mem_ctx, msg); + if (msg2 == NULL) { + return NULL; + } + + for (i = 0; i < msg2->num_elements; ++i) { + /* + * Mark this message's elements as sharing their values with the + * original message, so that we don't inadvertently modify or + * free them. We don't mark the original message element as + * shared, so the original message element should not be + * modified or freed while the shallow copy lives. + */ + struct ldb_message_element *el = &msg2->elementsi; + el->flags |= LDB_FLAG_INTERNAL_SHARED_VALUES; + } + + return msg2; +} /* copy a message, allocating new memory for all parts @@ -873,7 +1091,7 @@ struct ldb_message *msg2; unsigned int i, j; - msg2 = ldb_msg_copy_shallow(mem_ctx, msg); + msg2 = ldb_msg_copy_shallow_impl(mem_ctx, msg); if (msg2 == NULL) return NULL; if (msg2->dn != NULL) { @@ -894,6 +1112,12 @@ goto failed; } } + + /* + * Since we copied this element's values, we can mark them as + * not shared. + */ + el->flags &= ~LDB_FLAG_INTERNAL_SHARED_VALUES; } return msg2;
View file
_service:tar_scm:ldb-2.4.1.tar.gz/configure -> _service:tar_scm:ldb-2.6.1.tar.gz/configure
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -PREVPATH=`dirname $0` +PREVPATH=$(dirname $0) if -f $PREVPATH/../../buildtools/bin/waf ; then WAF=../../buildtools/bin/waf @@ -16,6 +16,13 @@ JOBS=1 export JOBS +# Make sure we don't have any library preloaded. +unset LD_PRELOAD + +# Make sure we get stable hashes +PYTHONHASHSEED=1 +export PYTHONHASHSEED + cd . || exit 1 $PYTHON $WAF configure "$@" || exit 1 cd $PREVPATH
View file
_service:tar_scm:ldb-2.4.1.tar.gz/docs/builddocs.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/docs/builddocs.sh
Changed
@@ -6,8 +6,8 @@ SRCDIR="$2" if -z "$XSLTPROC" || ! -x "$XSLTPROC" ; then - echo "xsltproc not installed" - exit 0 + echo "xsltproc not installed" + exit 0 fi MANXSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" @@ -16,37 +16,37 @@ mkdir -p man for f in $SRCDIR/man/*.xml; do - base=`basename $f .xml` - out=man/"`basename $base`" - if ! -f "$out" || "$f" -nt "$out" ; then - echo Processing manpage $f - $XSLTPROC --nonet -o "$out" "$MANXSL" $f - ret=$? - if "$ret" = "4" ; then - echo "ignoring stylesheet error 4 for $MANXSL" - exit 0 + base=$(basename $f .xml) + out=man/"$(basename $base)" + if ! -f "$out" || "$f" -nt "$out" ; then + echo Processing manpage $f + $XSLTPROC --nonet -o "$out" "$MANXSL" $f + ret=$? + if "$ret" = "4" ; then + echo "ignoring stylesheet error 4 for $MANXSL" + exit 0 + fi + if "$ret" != "0" ; then + echo "xsltproc failed with error $ret" + exit $ret + fi fi - if "$ret" != "0" ; then - echo "xsltproc failed with error $ret" - exit $ret - fi - fi done for f in $SRCDIR/man/*.xml; do - base=`basename $f .xml` - out=man/"`basename $base`".html - if ! -f "$out" || "$f" -nt "$out" ; then - echo Processing html $f - $XSLTPROC --nonet -o "$out" "$HTMLXSL" $f - ret=$? - if "$ret" = "4" ; then - echo "ignoring stylesheet error 4 for $HTMLXSL" - exit 0 - fi - if "$ret" != "0" ; then - echo "xsltproc failed with error $ret" - exit $ret + base=$(basename $f .xml) + out=man/"$(basename $base)".html + if ! -f "$out" || "$f" -nt "$out" ; then + echo Processing html $f + $XSLTPROC --nonet -o "$out" "$HTMLXSL" $f + ret=$? + if "$ret" = "4" ; then + echo "ignoring stylesheet error 4 for $HTMLXSL" + exit 0 + fi + if "$ret" != "0" ; then + echo "xsltproc failed with error $ret" + exit $ret + fi fi - fi done
View file
_service:tar_scm:ldb-2.4.1.tar.gz/docs/installdocs.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/docs/installdocs.sh
Changed
@@ -4,14 +4,14 @@ MANDIR="$1" -MAN1="`/bin/ls man/*.1`" -MAN3="`/bin/ls man/*.3`" +MAN1="$(/bin/ls man/*.1)" +MAN3="$(/bin/ls man/*.3)" if -z "$MAN1" && -z "$MAN3" ; then - echo "No manpages have been built" - exit 0 + echo "No manpages have been built" + exit 0 fi -mkdir -p "$MANDIR/man1" "$MANDIR/man3" +mkdir -p "$MANDIR/man1" "$MANDIR/man3" cp $MAN1 "$MANDIR/man1/" || exit 1 cp $MAN3 "$MANDIR/man3/" || exit 1
View file
_service:tar_scm:ldb-2.4.1.tar.gz/include/ldb.h -> _service:tar_scm:ldb-2.6.1.tar.gz/include/ldb.h
Changed
@@ -1982,6 +1982,12 @@ struct ldb_message_element **return_el); /** + add a value to a message element +*/ +int ldb_msg_element_add_value(TALLOC_CTX *mem_ctx, + struct ldb_message_element *el, + const struct ldb_val *val); +/** add a element to a ldb_message */ int ldb_msg_add(struct ldb_message *msg, @@ -1996,12 +2002,36 @@ struct ldb_val *val); int ldb_msg_add_steal_string(struct ldb_message *msg, const char *attr_name, char *str); +int ldb_msg_add_string_flags(struct ldb_message *msg, + const char *attr_name, const char *str, + int flags); int ldb_msg_add_string(struct ldb_message *msg, const char *attr_name, const char *str); int ldb_msg_add_linearized_dn(struct ldb_message *msg, const char *attr_name, struct ldb_dn *dn); int ldb_msg_add_fmt(struct ldb_message *msg, const char *attr_name, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); +/** + append a element to a ldb_message +*/ +int ldb_msg_append_value(struct ldb_message *msg, + const char *attr_name, + const struct ldb_val *val, + int flags); +int ldb_msg_append_steal_value(struct ldb_message *msg, + const char *attr_name, + struct ldb_val *val, + int flags); +int ldb_msg_append_steal_string(struct ldb_message *msg, + const char *attr_name, char *str, + int flags); +int ldb_msg_append_string(struct ldb_message *msg, + const char *attr_name, const char *str, + int flags); +int ldb_msg_append_linearized_dn(struct ldb_message *msg, const char *attr_name, + struct ldb_dn *dn, int flags); +int ldb_msg_append_fmt(struct ldb_message *msg, int flags, + const char *attr_name, const char *fmt, ...) PRINTF_ATTRIBUTE(4,5); /** compare two message elements - return 0 on match
View file
_service:tar_scm:ldb-2.4.1.tar.gz/include/ldb_module.h -> _service:tar_scm:ldb-2.6.1.tar.gz/include/ldb_module.h
Changed
@@ -96,6 +96,12 @@ */ #define LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX 0x100 +/* + * indicates that this element's values are shared with another element (for + * example, in a shallow copy of an ldb_message) and should not be freed + */ +#define LDB_FLAG_INTERNAL_SHARED_VALUES 0x200 + /* 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"
View file
_service:tar_scm:ldb-2.4.1.tar.gz/ldb_key_value/ldb_kv.c -> _service:tar_scm:ldb-2.6.1.tar.gz/ldb_key_value/ldb_kv.c
Changed
@@ -2078,6 +2078,8 @@ } } + ac->timeout_timeval = tv; + /* set a spy so that we do not try to use the request context * if it is freed before ltdb_callback fires */ ac->spy = talloc(req, struct ldb_kv_req_spy);
View file
_service:tar_scm:ldb-2.4.1.tar.gz/ldb_key_value/ldb_kv.h -> _service:tar_scm:ldb-2.6.1.tar.gz/ldb_key_value/ldb_kv.h
Changed
@@ -152,6 +152,16 @@ struct ldb_module *module; struct ldb_request *req; + /* + * Required as we might not get to the event loop before the + * timeout, so we need some old-style cooperative multitasking + * here. + */ + struct timeval timeout_timeval; + + /* Used to throttle calls to gettimeofday() */ + size_t timeout_counter; + bool request_terminated; struct ldb_kv_req_spy *spy;
View file
_service:tar_scm:ldb-2.4.1.tar.gz/ldb_key_value/ldb_kv_index.c -> _service:tar_scm:ldb-2.6.1.tar.gz/ldb_key_value/ldb_kv_index.c
Changed
@@ -2352,6 +2352,47 @@ for (i = 0; i < num_keys; i++) { int ret; bool matched; + + /* + * Check the time every 64 records, to reduce calls to + * gettimeofday(). This is a compromise, not all + * calls to ldb_match_message() will take the same + * time, most will run quickly but by luck it might be + * possible to have 64 records that are slow, doing a + * recursive search via LDAP_MATCHING_RULE_IN_CHAIN. + * + * Thankfully this is after index processing so only + * on the subset that matches some index (but still + * possibly a big one like objectclass=user) + */ + if (i % 64 == 0) { + struct timeval now = tevent_timeval_current(); + int timeval_cmp = tevent_timeval_compare(&ac->timeout_timeval, + &now); + + /* + * The search has taken too long. This is the + * most likely place for our time to expire, + * as we are checking the records after the + * index set intersection. This is now the + * slow process of checking if the records + * actually match. + * + * The tevent based timeout is not likely to + * be hit, sadly, as we don't run an event + * loop. + * + * While we are indexed and most of the work + * should have been done already, the + * ldb_match_* calls can be quite expensive if + * the caller uses LDAP_MATCHING_RULE_IN_CHAIN + */ + if (timeval_cmp <= 0) { + talloc_free(keys); + return LDB_ERR_TIME_LIMIT_EXCEEDED; + } + } + msg = ldb_msg_new(ac); if (!msg) { talloc_free(keys);
View file
_service:tar_scm:ldb-2.4.1.tar.gz/ldb_key_value/ldb_kv_search.c -> _service:tar_scm:ldb-2.6.1.tar.gz/ldb_key_value/ldb_kv_search.c
Changed
@@ -314,7 +314,8 @@ struct ldb_context *ldb; struct ldb_kv_context *ac; struct ldb_message *msg, *filtered_msg; - int ret; + struct timeval now; + int ret, timeval_cmp; bool matched; ac = talloc_get_type(state, struct ldb_kv_context); @@ -341,6 +342,36 @@ return 0; } + /* + * Check the time every 64 records, to reduce calls to + * gettimeofday(). This is a compromise, not all calls to + * ldb_match_message() will take the same time, most will fail + * quickly but by luck it might be possible to have 64 records + * that are slow, doing a recursive search via + * LDAP_MATCHING_RULE_IN_CHAIN. + */ + if (ac->timeout_counter++ % 64 == 0) { + now = tevent_timeval_current(); + timeval_cmp = tevent_timeval_compare(&ac->timeout_timeval, + &now); + + /* + * The search has taken too long. This is the most + * likely place for our time to expire, as we are in + * an un-indexed search and we return the data from + * within this loop. The tevent based timeout is not + * likely to be hit, sadly. + * + * ldb_match_msg_error() can be quite expensive if a + * LDAP_MATCHING_RULE_IN_CHAIN extended match was + * specified. + */ + if (timeval_cmp <= 0) { + ac->error = LDB_ERR_TIME_LIMIT_EXCEEDED; + return -1; + } + } + msg = ldb_msg_new(ac); if (!msg) { ac->error = LDB_ERR_OPERATIONS_ERROR;
View file
_service:tar_scm:ldb-2.4.1.tar.gz/ldb_map/ldb_map.c -> _service:tar_scm:ldb-2.6.1.tar.gz/ldb_map/ldb_map.c
Changed
@@ -946,10 +946,7 @@ if ( ! dn || ! ldb_dn_validate(msg->dn)) { goto failed; } - if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_REPLACE, NULL) != 0) { - goto failed; - } - if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) { + if (ldb_msg_append_string(msg, IS_MAPPED, dn, LDB_FLAG_MOD_REPLACE) != 0) { goto failed; }
View file
_service:tar_scm:ldb-2.4.1.tar.gz/ldb_map/ldb_map_inbound.c -> _service:tar_scm:ldb-2.6.1.tar.gz/ldb_map/ldb_map_inbound.c
Changed
@@ -569,12 +569,9 @@ /* No local record present, add it instead */ /* Add local 'IS_MAPPED' */ /* TODO: use GUIDs here instead */ - if (ldb_msg_add_empty(ac->local_msg, IS_MAPPED, - LDB_FLAG_MOD_ADD, NULL) != 0) { - return LDB_ERR_OPERATIONS_ERROR; - } - ret = ldb_msg_add_linearized_dn(ac->local_msg, IS_MAPPED, - ac->remote_req->op.mod.message->dn); + ret = ldb_msg_append_linearized_dn(ac->local_msg, IS_MAPPED, + ac->remote_req->op.mod.message->dn, + LDB_FLAG_MOD_ADD); if (ret != 0) { return LDB_ERR_OPERATIONS_ERROR; }
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/replace/configure -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/configure
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -PREVPATH=`dirname $0` +PREVPATH=$(dirname $0) if -f $PREVPATH/../../buildtools/bin/waf ; then WAF=../../buildtools/bin/waf @@ -16,6 +16,13 @@ JOBS=1 export JOBS +# Make sure we don't have any library preloaded. +unset LD_PRELOAD + +# Make sure we get stable hashes +PYTHONHASHSEED=1 +export PYTHONHASHSEED + cd . || exit 1 $PYTHON $WAF configure "$@" || exit 1 cd $PREVPATH
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/replace/replace.h -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/replace.h
Changed
@@ -703,7 +703,7 @@ #ifdef HAVE__Bool #define bool _Bool #else -typedef int bool; +#error Need a real boolean type #endif #endif @@ -982,10 +982,59 @@ # endif /* HAVE_FALLTHROUGH_ATTRIBUTE */ #endif /* FALL_THROUGH */ -bool nss_wrapper_enabled(void); -bool nss_wrapper_hosts_enabled(void); -bool socket_wrapper_enabled(void); -bool uid_wrapper_enabled(void); +struct __rep_cwrap_enabled_state { + const char *fnname; + bool cached; + bool retval; +}; + +static inline bool __rep_cwrap_enabled_fn(struct __rep_cwrap_enabled_state *state) +{ + bool (*__wrapper_enabled_fn)(void) = NULL; + + if (state->cached) { + return state->retval; + } + state->retval = false; + state->cached = true; + + __wrapper_enabled_fn = (bool (*)(void))dlsym(RTLD_DEFAULT, state->fnname); + if (__wrapper_enabled_fn == NULL) { + return state->retval; + } + + state->retval = __wrapper_enabled_fn(); + return state->retval; +} + +static inline bool nss_wrapper_enabled(void) +{ + struct __rep_cwrap_enabled_state state = { + .fnname = "nss_wrapper_enabled", + }; + return __rep_cwrap_enabled_fn(&state); +} +static inline bool nss_wrapper_hosts_enabled(void) +{ + struct __rep_cwrap_enabled_state state = { + .fnname = "nss_wrapper_hosts_enabled", + }; + return __rep_cwrap_enabled_fn(&state); +} +static inline bool socket_wrapper_enabled(void) +{ + struct __rep_cwrap_enabled_state state = { + .fnname = "socket_wrapper_enabled", + }; + return __rep_cwrap_enabled_fn(&state); +} +static inline bool uid_wrapper_enabled(void) +{ + struct __rep_cwrap_enabled_state state = { + .fnname = "uid_wrapper_enabled", + }; + return __rep_cwrap_enabled_fn(&state); +} static inline bool _hexcharval(char c, uint8_t *val) {
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/replace/tests/os2_delete.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/tests/os2_delete.c
Changed
@@ -66,8 +66,8 @@ char namesREADDIR_SIZE256; /* scan, remembering offsets */ - for (i=0, de=readdir(d); - de && i < READDIR_SIZE; + for (i=0, de=readdir(d); + de && i < READDIR_SIZE; de=readdir(d), i++) { offsetsi = telldir(d); /* strlcpy not available here */ @@ -106,7 +106,7 @@ d = opendir(TESTDIR "/test0.txt"); if (d != NULL) FAILED("opendir() on file succeed"); if (errno != ENOTDIR) FAILED("opendir() on file didn't give ENOTDIR"); - closedir(d); + if (d != NULL) closedir(d); d = opendir(TESTDIR);
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/replace/tests/testsuite.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/tests/testsuite.c
Changed
@@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. libreplace tests @@ -8,7 +8,7 @@ ** NOTE! The following LGPL license applies to the talloc ** 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 @@ -127,7 +127,7 @@ return false; } if (strcmp(tmp, "bl") != 0) { - printf("failure: strlcat \nexpected \"bl\", got \"%s\"\n\n", + printf("failure: strlcat \nexpected \"bl\", got \"%s\"\n\n", tmp); return false; } @@ -179,7 +179,7 @@ free(x); printf("success: strdup\n"); return true; -} +} static int test_setlinebuf(void) { @@ -308,6 +308,8 @@ static int test_strnlen(void) { + char longlen20 = { 0 }; + printf("test: strnlen\n"); if (strnlen("bla", 2) != 2) { printf("failure: strnlen \nunexpected length\n\n"); @@ -319,7 +321,9 @@ return false; } - if (strnlen("some text", 20) != 9) { + memcpy(longlen, "some text", 10); + + if (strnlen(longlen, 20) != 9) { printf("failure: strnlen \nunexpected length\n\n"); return false; } @@ -774,7 +778,7 @@ return true; } -/* +/* FIXME: Types: bool
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/replace/timegm.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/timegm.c
Changed
@@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1997 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. *
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/replace/wscript -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/replace/wscript
Changed
@@ -128,6 +128,9 @@ if conf.CHECK_CFLAGS('-Wno-strict-overflow'): conf.define('HAVE_WNO_STRICT_OVERFLOW', '1') + if conf.CHECK_CFLAGS('-Wuse-after-free=1'): + conf.define('HAVE_WUSE_AFTER_FREE_1', '1') + # Check for process set name support conf.CHECK_CODE(''' #include <sys/prctl.h> @@ -153,8 +156,9 @@ msg='Checking for O_DIRECT flag to open(2)') conf.CHECK_TYPES('"long long" intptr_t uintptr_t ptrdiff_t comparison_fn_t') - conf.CHECK_TYPE('_Bool', define='HAVE__Bool') - 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'): + raise Errors.WafError('Samba requires a genuine boolean type') conf.CHECK_TYPE('int8_t', 'char') conf.CHECK_TYPE('uint8_t', 'unsigned char') @@ -299,6 +303,13 @@ msg='Checking for __sync_fetch_and_add compiler builtin') conf.CHECK_CODE(''' + int i; + (void)__sync_add_and_fetch(&i, 1); + ''', + 'HAVE___SYNC_ADD_AND_FETCH', + msg='Checking for __sync_add_and_fetch compiler builtin') + + conf.CHECK_CODE(''' int32_t i; atomic_add_32(&i, 1); ''', @@ -306,6 +317,22 @@ headers='stdint.h sys/atomic.h', msg='Checking for atomic_add_32 compiler builtin') + conf.CHECK_CODE(''' + uint32_t i,j; + j = __atomic_add_fetch(&i,1,__ATOMIC_SEQ_CST) + ''', + 'HAVE___ATOMIC_ADD_FETCH', + headers='stdint.h', + msg='Checking for __atomic_add_fetch compiler builtin') + + conf.CHECK_CODE(''' + uint32_t i,j; + __atomic_load(&i,&j,__ATOMIC_SEQ_CST) + ''', + 'HAVE___ATOMIC_ADD_LOAD', + headers='stdint.h', + msg='Checking for __atomic_load compiler builtin') + # Check for thread fence. */ tf = conf.CHECK_CODE('atomic_thread_fence(memory_order_seq_cst);', 'HAVE_ATOMIC_THREAD_FENCE', @@ -446,7 +473,7 @@ execute = True, define = 'HAVE_BSD_STRTOLL', ) - conf.CHECK_FUNCS('if_nametoindex strerror_r') + conf.CHECK_FUNCS('if_nameindex if_nametoindex strerror_r') conf.CHECK_FUNCS('syslog') conf.CHECK_FUNCS('gai_strerror get_current_dir_name') conf.CHECK_FUNCS('timegm getifaddrs freeifaddrs mmap setgroups syscall setsid') @@ -456,11 +483,10 @@ conf.CHECK_FUNCS('getprogname') if not conf.CHECK_FUNCS('copy_file_range'): conf.CHECK_CODE(''' -#include <sys/syscall.h> -#include <unistd.h> syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0); ''', 'HAVE_SYSCALL_COPY_FILE_RANGE', + headers='sys/syscall.h unistd.h', msg='Checking whether we have copy_file_range system call') conf.SET_TARGET_TYPE('attr', 'EMPTY') @@ -883,7 +909,6 @@ ) REPLACE_SOURCE = REPLACE_HOSTCC_SOURCE - REPLACE_SOURCE += ' cwrap.c' if not bld.CONFIG_SET('HAVE_DLOPEN'): REPLACE_SOURCE += ' dlfcn.c' if not bld.CONFIG_SET('HAVE_POLL'): REPLACE_SOURCE += ' poll.c' @@ -911,6 +936,7 @@ # at the moment: # hide_symbols=bld.BUILTIN_LIBRARY('replace'), private_library=True, + provide_builtin_linking=True, deps='dl attr' + extra_libs) replace_test_cflags = ''
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/talloc/ABI/pytalloc-util-2.3.4.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.6.1.tar.gz/lib/talloc/ABI/talloc-2.3.4.sigs
Added
@@ -0,0 +1,65 @@ +_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_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.4.1.tar.gz/lib/talloc/configure -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/talloc/configure
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -PREVPATH=`dirname $0` +PREVPATH=$(dirname $0) if -f $PREVPATH/../../buildtools/bin/waf ; then WAF=../../buildtools/bin/waf @@ -16,6 +16,13 @@ JOBS=1 export JOBS +# Make sure we don't have any library preloaded. +unset LD_PRELOAD + +# Make sure we get stable hashes +PYTHONHASHSEED=1 +export PYTHONHASHSEED + cd . || exit 1 $PYTHON $WAF configure "$@" || exit 1 cd $PREVPATH
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/talloc/wscript -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/talloc/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.3.3' +VERSION = '2.3.4' import os import sys @@ -114,6 +114,7 @@ bld.SAMBA_LIBRARY('talloc', 'talloc.c', deps='replace', + provide_builtin_linking=True, abi_directory='ABI', abi_match='talloc* _talloc*', hide_symbols=True,
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/ABI/tdb-1.4.5.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/ABI/tdb-1.4.6.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/ABI/tdb-1.4.7.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.4.1.tar.gz/lib/tdb/common/tdb.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/common/tdb.c
Changed
@@ -64,6 +64,15 @@ return; } +#if defined(HAVE___ATOMIC_ADD_FETCH) && defined(HAVE___ATOMIC_ADD_LOAD) + if (tdb->map_ptr != NULL) { + uint32_t *pseqnum = (uint32_t *)( + TDB_SEQNUM_OFS + (char *)tdb->map_ptr); + __atomic_add_fetch(pseqnum, 1, __ATOMIC_SEQ_CST); + return; + } +#endif + if (tdb_nest_lock(tdb, TDB_SEQNUM_OFS, F_WRLCK, TDB_LOCK_WAIT|TDB_LOCK_PROBE) != 0) { return; @@ -838,6 +847,21 @@ { tdb_off_t seqnum=0; + if (tdb->transaction != NULL) { + tdb_ofs_read(tdb, TDB_SEQNUM_OFS, &seqnum); + return seqnum; + } + +#if defined(HAVE___ATOMIC_ADD_FETCH) && defined(HAVE___ATOMIC_ADD_LOAD) + if (tdb->map_ptr != NULL) { + uint32_t *pseqnum = (uint32_t *)( + TDB_SEQNUM_OFS + (char *)tdb->map_ptr); + uint32_t ret; + __atomic_load(pseqnum, &ret,__ATOMIC_SEQ_CST); + return ret; + } +#endif + tdb_ofs_read(tdb, TDB_SEQNUM_OFS, &seqnum); return seqnum; }
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tdb/configure -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/configure
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -PREVPATH=`dirname $0` +PREVPATH=$(dirname $0) if -f $PREVPATH/../../buildtools/bin/waf ; then WAF=../../buildtools/bin/waf @@ -16,6 +16,13 @@ JOBS=1 export JOBS +# Make sure we don't have any library preloaded. +unset LD_PRELOAD + +# Make sure we get stable hashes +PYTHONHASHSEED=1 +export PYTHONHASHSEED + cd . || exit 1 $PYTHON $WAF configure "$@" || exit 1 cd $PREVPATH
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tdb/include/tdb.h -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/include/tdb.h
Changed
@@ -33,6 +33,19 @@ #include <signal.h> #include <stdbool.h> +/* for old gcc releases that don't have the feature test macro __has_attribute */ +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + +#ifndef _PUBLIC_ +#if __has_attribute(visibility) +#define _PUBLIC_ __attribute__((visibility("default"))) +#else +#define _PUBLIC_ +#endif +#endif + /** * @defgroup tdb The tdb API *
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tdb/test/test_tdbbackup.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/test/test_tdbbackup.sh
Changed
@@ -4,29 +4,32 @@ if $# -lt 1 ; then echo "Usage: $0 LDBFILE" - exit 1; + exit 1 fi LDBFILE=$1 -timestamp() { - date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/\..*NZ$/.000000Z/' +timestamp() +{ + date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/\..*NZ$/.000000Z/' } -subunit_fail_test () { - timestamp - printf 'failure: %s \n' "$1" - cat - - echo "" +subunit_fail_test() +{ + timestamp + printf 'failure: %s \n' "$1" + cat - + echo "" } -testit () { +testit() +{ name="$1" shift cmdline="$@" timestamp printf 'test: %s\n' "$1" - output=`$cmdline 2>&1` + output=$($cmdline 2>&1) status=$? if x$status = x0 ; then timestamp @@ -37,16 +40,16 @@ return $status } -$BINDIR/tdbdump $LDBFILE | sort > orig_dump +$BINDIR/tdbdump $LDBFILE | sort >orig_dump testit "normal tdbbackup on tdb file" $BINDIR/tdbbackup $LDBFILE -s .bak -$BINDIR/tdbdump $LDBFILE.bak | sort > bak_dump +$BINDIR/tdbdump $LDBFILE.bak | sort >bak_dump testit "cmp between tdbdumps of original and backup" cmp orig_dump bak_dump rm $LDBFILE.bak rm bak_dump testit "readonly tdbbackup on tdb file" $BINDIR/tdbbackup $LDBFILE -s .bak -r -$BINDIR/tdbdump $LDBFILE.bak | sort > bak_dump +$BINDIR/tdbdump $LDBFILE.bak | sort >bak_dump testit "cmp between tdbdumps of original and back dbs" cmp orig_dump bak_dump rm $LDBFILE.bak rm bak_dump
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/tools/tdbtortseq.c
Added
@@ -0,0 +1,123 @@ +/* + * Unix SMB/CIFS implementation. + * + * 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/>. + */ + +#include "replace.h" +#include "system/filesys.h" +#include <tdb.h> +#include <stdio.h> +#include <errno.h> +#include "system/wait.h" + +#define NPROCS 500 +#define NUMOPS 1000000 + +int main(void) +{ + pid_t pidsNPROCS; + struct tdb_context *tdb = NULL; + int i; + uint32_t seqnum_before, seqnum_after; + + tdb = tdb_open("seqnum_test.tdb", + 10000, + TDB_CLEAR_IF_FIRST| + TDB_SEQNUM| + TDB_INCOMPATIBLE_HASH| + TDB_MUTEX_LOCKING, + O_CREAT|O_RDWR, + 0644); + if (tdb == NULL) { + perror("tdb_open failed"); + return 1; + } + seqnum_before = tdb_get_seqnum(tdb); + + for (i=0; i<NPROCS; i++) { + pidsi = fork(); + if (pidsi == -1) { + perror("fork failed"); + return 1; + } + if (pidsi == 0) { + pid_t mypid = getpid(); + int ret; + int j; + + ret = tdb_reopen(tdb); + if (ret != 0) { + perror("tdb_reopen failed"); + return 1; + } + + for (j=0; j<NUMOPS; j++) { + TDB_DATA key = { + .dptr = (uint8_t *)&mypid, + .dsize = sizeof(mypid), + }; + TDB_DATA value = { + .dptr = (uint8_t *)&j, + .dsize = sizeof(j), + }; + ret = tdb_store(tdb, key, value, 0); + if (ret == -1) { + perror("tdb_store failed"); + return 1; + } + } + + return 0; + } + } + + for (i=0; i<NPROCS; i++) { + int wstatus; + pid_t ret = waitpid(pidsi, &wstatus, 0); + + if (ret == -1) { + perror("waitpid failed"); + return 1; + } + + if (!WIFEXITED(wstatus)) { + fprintf(stderr, + "pid %d did not exit properly\n", + (int)pidsi); + return 1; + } + + if (WEXITSTATUS(wstatus) != 0) { + fprintf(stderr, + "pid %d returned %d\n", + (int)pidsi, + WEXITSTATUS(wstatus)); + return 1; + } + } + + seqnum_after = tdb_get_seqnum(tdb); + + printf("seqnum_before=%"PRIu32", seqnum_after=%"PRIu32"\n", + seqnum_before, + seqnum_after); + + if ((seqnum_after - seqnum_before) != (NPROCS*NUMOPS)) { + perror("incrementing seqnum failed"); + return 1; + } + + return 0; +}
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tdb/wscript -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tdb/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tdb' -VERSION = '1.4.4' +VERSION = '1.4.7' import sys, os @@ -145,6 +145,11 @@ 'tdb', install=False) + bld.SAMBA_BINARY('tdbtortseq', + 'tools/tdbtortseq.c', + 'tdb', + install=False) + bld.SAMBA_BINARY('tdbrestore', 'tools/tdbrestore.c', 'tdb', manpages='man/tdbrestore.8')
View file
_service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/ABI/tevent-0.12.0.sigs
Added
@@ -0,0 +1,151 @@ +_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_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_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_queue_entry_get_tag: uint64_t (const struct tevent_queue_entry *) +tevent_queue_entry_set_tag: void (struct tevent_queue_entry *, 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_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_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_queue_callback: void (struct tevent_context *, struct tevent_queue_entry *, enum tevent_event_trace_point) +tevent_trace_point_callback: void (struct tevent_context *, enum tevent_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/ABI/tevent-0.12.1.sigs
Added
@@ -0,0 +1,151 @@ +_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_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_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_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/ABI/tevent-0.13.0.sigs
Added
@@ -0,0 +1,152 @@ +_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_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_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.4.1.tar.gz/lib/tevent/configure -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/configure
Changed
@@ -1,6 +1,6 @@ #!/bin/sh -PREVPATH=`dirname $0` +PREVPATH=$(dirname $0) if -f $PREVPATH/../../buildtools/bin/waf ; then WAF=../../buildtools/bin/waf @@ -16,6 +16,13 @@ JOBS=1 export JOBS +# Make sure we don't have any library preloaded. +unset LD_PRELOAD + +# Make sure we get stable hashes +PYTHONHASHSEED=1 +export PYTHONHASHSEED + cd . || exit 1 $PYTHON $WAF configure "$@" || exit 1 cd $PREVPATH
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tests/test_tevent_tag.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tests/test_tevent_tag.c
Changed
@@ -33,6 +33,12 @@ #include <tevent.h> #include <cmocka.h> +static void queue_trigger(struct tevent_req *req, void *private_data) +{ + /* Dummy handler. Just return. */ + return; +} + static void fd_handler(struct tevent_context *ev, struct tevent_fd *fde, uint16_t flags, @@ -197,6 +203,40 @@ TALLOC_FREE(im); } +static void test_queue_entry_tag(void **state) +{ + struct tevent_context *ev = (struct tevent_context *)(*state); + struct tevent_queue *q; + struct tevent_queue_entry *e1, *e2; + struct tevent_req *r1, *r2; + int *s1, *s2; + uint64_t tag; + + q = tevent_queue_create(ev, "test_queue"); + assert_non_null(q); + + r1 = tevent_req_create(ev, &s1, int); + r2 = tevent_req_create(ev, &s2, int); + e1 = tevent_queue_add_entry(q, ev, r1, queue_trigger, NULL); + e2 = tevent_queue_add_entry(q, ev, r2, queue_trigger, NULL); + + tag = tevent_queue_entry_get_tag(e1); + assert_int_equal(0, tag); + tag = tevent_queue_entry_get_tag(e2); + assert_int_equal(0, tag); + + tevent_queue_entry_set_tag(e1, 1); + tevent_queue_entry_set_tag(e2, 2); + + tag = tevent_queue_entry_get_tag(e1); + assert_int_equal(1, tag); + + tag = tevent_queue_entry_get_tag(e2); + assert_int_equal(2, tag); + + TALLOC_FREE(q); +} + int main(int argc, char **argv) { const struct CMUnitTest tests = { @@ -204,6 +244,7 @@ cmocka_unit_test_setup_teardown(test_timer_tag, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_signal_tag, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_immediate_tag, test_setup, test_teardown), + cmocka_unit_test_setup_teardown(test_queue_entry_tag, test_setup, test_teardown), }; cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tests/test_tevent_trace.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tests/test_tevent_trace.c
Changed
@@ -280,6 +280,28 @@ } } +static void trace_event_cb1(void *event, + enum tevent_event_trace_point point, + void *private_data) +{ + struct test_ctx *tctx = (struct test_ctx *)private_data; + uint64_t tag; + + switch (point) { + case TEVENT_EVENT_TRACE_ATTACH: + tctx->attach = true; + tag = ++tctx->current_tag; + tctx->set_tag(event, tag); + break; + case TEVENT_EVENT_TRACE_BEFORE_HANDLER: + tctx->before_handler = true; + break; + case TEVENT_EVENT_TRACE_DETACH: + tctx->detach = true; + break; + } +} + static int test_setup(void **state) { struct test_ctx *tctx; @@ -371,6 +393,22 @@ tevent_immediate_set_tag(event, tag); } +static uint64_t queue_entry_get_tag(const void *_event) +{ + const struct tevent_queue_entry *event = + (const struct tevent_queue_entry *)_event; + + return tevent_queue_entry_get_tag(event); +} + +static void queue_entry_set_tag(void *_event, uint64_t tag) +{ + struct tevent_queue_entry *event = + (struct tevent_queue_entry *)_event; + + tevent_queue_entry_set_tag(event, tag); +} + static void test_trace_event_fd__loop(void **state) { struct test_ctx *tctx = (struct test_ctx *)(*state); @@ -949,6 +987,203 @@ assert_true(tctx->detach); } +struct dummy_request_state +{ + int i; + struct tevent_queue_entry *e; +}; + +static void queue_trigger(struct tevent_req *req, void *private_data) +{ + struct test_ctx *tctx = (struct test_ctx *)private_data; + struct dummy_request_state *state = tevent_req_data( + req, struct dummy_request_state); + + tctx->handler_called = true; + assert_int_equal(tevent_queue_entry_get_tag(state->e), state->i); + TALLOC_FREE(req); + + return; +} + +static void test_trace_queue__loop(void **state) +{ + struct test_ctx *tctx = (struct test_ctx *)(*state); + struct tevent_queue *qa, *qb; + struct tevent_req *r1, *r2, *r3, *r4, *r5; + struct dummy_request_state *ds1, *ds2, *ds3, *ds4, *ds5; + + tevent_set_trace_queue_callback( + tctx->ev, + (tevent_trace_queue_callback_t)trace_event_cb1, + tctx); + tctx->get_tag = queue_entry_get_tag; + tctx->set_tag = queue_entry_set_tag; + + qa = tevent_queue_create(tctx->ev, "test_queue A"); + assert_non_null(qa); + qb = tevent_queue_create(tctx->ev, "test_queue B"); + assert_non_null(qb); + + r1 = tevent_req_create(tctx->ev, &ds1, struct dummy_request_state); + ds1->e = tevent_queue_add_entry(qa, + tctx->ev, + r1, + queue_trigger, + *state); + ds1->i = tctx->current_tag; + assert_int_equal(ds1->i, 1); + + r2 = tevent_req_create(tctx->ev, &ds2, struct dummy_request_state); + ds2->e = tevent_queue_add_entry(qa, + tctx->ev, + r2, + queue_trigger, + *state); + ds2->i = tctx->current_tag; + assert_int_equal(ds2->i, 2); + + r3 = tevent_req_create(tctx->ev, &ds3, struct dummy_request_state); + ds3->e = tevent_queue_add_entry(qb, + tctx->ev, + r3, + queue_trigger, + *state); + ds3->i = tctx->current_tag; + assert_int_equal(ds3->i, 3); + + r4 = tevent_req_create(tctx->ev, &ds4, struct dummy_request_state); + ds4->e = tevent_queue_add_entry(qb, + tctx->ev, + r4, + queue_trigger, + *state); + ds4->i = tctx->current_tag; + assert_int_equal(ds4->i, 4); + + r5 = tevent_req_create(tctx->ev, &ds5, struct dummy_request_state); + ds5->e = tevent_queue_add_entry(qa, + tctx->ev, + r5, + queue_trigger, + *state); + ds5->i = tctx->current_tag; + assert_int_equal(ds5->i, 5); + + tevent_loop_once(tctx->ev); + tevent_loop_once(tctx->ev); + tevent_loop_once(tctx->ev); + tevent_loop_once(tctx->ev); + tevent_loop_once(tctx->ev); +} + +static void reset_tctx(struct test_ctx *tctx) +{ + tctx->attach = false; + tctx->before_handler = false; + tctx->handler_called = false; + tctx->detach = false; +} + +static void test_trace_queue__extra(void **state) +{ + struct test_ctx *tctx = (struct test_ctx *)(*state); + struct tevent_queue *qa; + struct tevent_req *r1, *r2, *r3; + struct dummy_request_state *ds1, *ds2, *ds3; + + tevent_set_trace_queue_callback( + tctx->ev, + (tevent_trace_queue_callback_t)trace_event_cb1, + tctx); + tctx->get_tag = queue_entry_get_tag; + tctx->set_tag = queue_entry_set_tag; + + qa = tevent_queue_create(tctx->ev, "test_queue A"); + assert_non_null(qa); + + /* + * r1 - this tests optimize_empty - request is triggered immediately, + * (and not even scheduled to tevent_context). The TALLOC_FREE() called + * from queue_trigger removes the request/queue_entry from the queue qa. + * So qa is empty + */ + r1 = tevent_req_create(tctx->ev, &ds1, struct dummy_request_state); + ds1->e = tevent_queue_add_optimize_empty(qa, + tctx->ev, + r1, + queue_trigger, + *state); + assert_true(tctx->attach); + assert_true(tctx->before_handler); + assert_true(tctx->handler_called); + assert_true(tctx->detach); + assert_int_equal(tevent_queue_length(qa), 0); + + reset_tctx(tctx); + + /* + * Test a blocker request r2 - the trigger function is NULL. + */ + r2 = tevent_req_create(tctx->ev, &ds2, struct dummy_request_state); + ds2->e = tevent_queue_add_entry(qa, tctx->ev, r2, NULL, *state); + ds2->i = tctx->current_tag; + assert_true(tctx->attach); + assert_false(tctx->before_handler); + assert_false(tctx->handler_called); + assert_false(tctx->detach); + assert_int_equal(tevent_queue_length(qa), 1); + + /* + * This runs the tevent_queue_noop_trigger(). + * A blocker r2 is still on the queue head, with triggered==true + */ + tevent_loop_once(tctx->ev); + + assert_true(tctx->attach); + assert_true(tctx->before_handler); + assert_false(tctx->handler_called); + /* tevent_queue_noop_trigger() is a noop. Does not set handler_called */ + assert_false(tctx->detach); + assert_int_equal(tevent_queue_length(qa), 1); + + /* + * Add a normal request r3. It will be blocked by r2. + */ + r3 = tevent_req_create(tctx->ev, &ds3, struct dummy_request_state); + ds3->e = tevent_queue_add_entry(qa, + tctx->ev, + r3, + queue_trigger, + *state); + ds3->i = tctx->current_tag; + assert_true(tctx->attach); + assert_true(tctx->before_handler); + assert_false(tctx->handler_called); + assert_false(tctx->detach); + assert_int_equal(tevent_queue_length(qa), 2); + + /* + * Remove the blocker r2. + */ + TALLOC_FREE(r2); + assert_true(tctx->attach); + assert_true(tctx->before_handler); + assert_false(tctx->handler_called); + assert_true(tctx->detach); + assert_int_equal(tevent_queue_length(qa), 1); + + reset_tctx(tctx); + + /* Process r3 */ + tevent_loop_once(tctx->ev); + + assert_false(tctx->attach); + assert_true(tctx->before_handler); + assert_true(tctx->handler_called); + assert_true(tctx->detach); +} + static void test_get_set_trace_fd_callback(void **state) { struct test_ctx *tctx = (struct test_ctx *)(*state); @@ -1033,6 +1268,27 @@ assert_null(pvt); } +static void test_get_set_trace_queue_callback(void **state) +{ + struct test_ctx *tctx = (struct test_ctx *)(*state); + tevent_trace_queue_callback_t cb; + void *pvt; + + tevent_get_trace_queue_callback(tctx->ev, &cb, &pvt); + assert_null(cb); + assert_null(pvt); + + tevent_set_trace_queue_callback(tctx->ev, (tevent_trace_queue_callback_t)trace_event_cb, tctx); + tevent_get_trace_queue_callback(tctx->ev, &cb, &pvt); + assert_ptr_equal(cb, trace_event_cb); + assert_ptr_equal(pvt, tctx); + + tevent_set_trace_queue_callback(tctx->ev, NULL, NULL); + tevent_get_trace_queue_callback(tctx->ev, &cb, &pvt); + assert_null(cb); + assert_null(pvt); +} + int main(int argc, char **argv) { const struct CMUnitTest tests = { @@ -1053,10 +1309,13 @@ cmocka_unit_test_setup_teardown(test_trace_event_immediate__free, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_trace_event_immediate__free_in_handler, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_trace_event_immediate__reschedule, test_setup, test_teardown), + cmocka_unit_test_setup_teardown(test_trace_queue__loop, test_setup, test_teardown), + cmocka_unit_test_setup_teardown(test_trace_queue__extra, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_get_set_trace_fd_callback, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_get_set_trace_timer_callback, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_get_set_trace_signal_callback, test_setup, test_teardown), cmocka_unit_test_setup_teardown(test_get_set_trace_immediate_callback, test_setup, test_teardown), + cmocka_unit_test_setup_teardown(test_get_set_trace_queue_callback, test_setup, test_teardown), }; cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/testsuite.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/testsuite.c
Changed
@@ -1761,8 +1761,75 @@ talloc_free(ev); return true; } + +struct test_cached_pid_thread_state { + pid_t thread_cached_pid; + pid_t thread_pid; +}; + +static void *test_cached_pid_thread(void *private_data) +{ + struct test_cached_pid_thread_state *state = + (struct test_cached_pid_thread_state *)private_data; + + state->thread_cached_pid = tevent_cached_getpid(); + state->thread_pid = getpid(); + + return NULL; +} #endif +static bool test_cached_pid(struct torture_context *test, + const void *test_data) +{ + pid_t parent_pid = getpid(); + pid_t child_pid; + pid_t finished_pid; + int child_status; + + torture_assert(test, tevent_cached_getpid() == parent_pid, "tevent_cached_getpid()"); + +#ifdef HAVE_PTHREAD + { + struct test_cached_pid_thread_state state = { .thread_cached_pid = -1, }; + pthread_t thread; + void *retval = NULL; + int ret; + + ret = pthread_create(&thread, NULL, test_cached_pid_thread, &state); + torture_assert(test, ret == 0, "pthread_create failed"); + + ret = pthread_join(thread, &retval); + torture_assert(test, ret == 0, "pthread_join failed"); + + torture_assert(test, state.thread_pid == parent_pid, "getpid() in thread"); + torture_assert(test, state.thread_cached_pid == parent_pid, "tevent_cached_getpid() in thread"); + } +#endif /* HAVE_PTHREAD */ + + child_pid = fork(); + if (child_pid == 0) { + /* child */ + pid_t pid = getpid(); + pid_t cached_pid = tevent_cached_getpid(); + + if (parent_pid == pid) { + exit(1); + } + if (pid != cached_pid) { + exit(2); + } + exit(0); + } + torture_assert(test, child_pid > 0, "fork failed"); + + finished_pid = waitpid(child_pid, &child_status, 0); + torture_assert(test, finished_pid == child_pid, "wrong child"); + torture_assert(test, child_status == 0, "child_status"); + + return true; +} + struct torture_suite *torture_local_event(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, "event"); @@ -1817,5 +1884,9 @@ #endif + torture_suite_add_simple_tcase_const(suite, "tevent_cached_getpid", + test_cached_pid, + NULL); + return suite; }
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tevent.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent.c
Changed
@@ -199,6 +199,7 @@ static pthread_mutex_t tevent_contexts_mutex = PTHREAD_MUTEX_INITIALIZER; static struct tevent_context *tevent_contexts = NULL; static pthread_once_t tevent_atfork_initialized = PTHREAD_ONCE_INIT; +static pid_t tevent_cached_global_pid = 0; static void tevent_atfork_prepare(void) { @@ -263,6 +264,8 @@ struct tevent_context *ev; int ret; + tevent_cached_global_pid = getpid(); + for (ev = DLIST_TAIL(tevent_contexts); ev != NULL; ev = DLIST_PREV(ev)) { struct tevent_threaded_context *tctx; @@ -302,9 +305,41 @@ if (ret != 0) { abort(); } + + tevent_cached_global_pid = getpid(); +} + +#endif + +static int tevent_init_globals(void) +{ +#ifdef HAVE_PTHREAD + int ret; + + ret = pthread_once(&tevent_atfork_initialized, tevent_prep_atfork); + if (ret != 0) { + return ret; + } +#endif + + return 0; } +_PUBLIC_ pid_t tevent_cached_getpid(void) +{ +#ifdef HAVE_PTHREAD + tevent_init_globals(); +#ifdef TEVENT_VERIFY_CACHED_GETPID + if (tevent_cached_global_pid != getpid()) { + tevent_abort(NULL, "tevent_cached_global_pid invalid"); + } +#endif + if (tevent_cached_global_pid != 0) { + return tevent_cached_global_pid; + } #endif + return getpid(); +} int tevent_common_context_destructor(struct tevent_context *ev) { @@ -434,13 +469,13 @@ { int ret; -#ifdef HAVE_PTHREAD - - ret = pthread_once(&tevent_atfork_initialized, tevent_prep_atfork); + ret = tevent_init_globals(); if (ret != 0) { return ret; } +#ifdef HAVE_PTHREAD + ret = pthread_mutex_init(&ev->scheduled_mutex, NULL); if (ret != 0) { return ret;
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tevent.h -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent.h
Changed
@@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. generalised event loop handling @@ -31,6 +31,7 @@ #include <stdint.h> #include <talloc.h> #include <sys/time.h> +#include <sys/types.h> #include <stdbool.h> /* for old gcc releases that don't have the feature test macro __has_attribute */ @@ -1908,6 +1909,22 @@ */ struct timeval tevent_timeval_current_ofs(uint32_t secs, uint32_t usecs); +/** + * + * @brief A cached version of getpid() + * + * We use getpid() in a lot a performance critical situations + * in order to check if caches are still valid in the current process. + * + * Calling getpid() always add the cost of an additional syscall! + * + * When tevent is build with pthread support, we already make use + * of pthread_atfork(), so it's trivial to use it maintain a cache for getpid(). + * + * @return The pid of the current process. + */ +pid_t tevent_cached_getpid(void); + /* @} */ @@ -1930,6 +1947,55 @@ struct tevent_queue; struct tevent_queue_entry; +/** + * @brief Associate a custom tag with the queue entry. + * + * This tag can be then retrieved with tevent_queue_entry_get_tag() + * + * @paramin qe The queue entry. + * + * @paramin tag Custom tag. + */ +void tevent_queue_entry_set_tag(struct tevent_queue_entry *qe, uint64_t tag); + +/** + * @brief Get custom queue entry tag. + */ +uint64_t tevent_queue_entry_get_tag(const struct tevent_queue_entry *qe); + +typedef void (*tevent_trace_queue_callback_t)(struct tevent_queue_entry *qe, + enum tevent_event_trace_point, + void *private_data); + +/** + * Register a callback to be called at certain trace points of queue. + * + * @paramin ev Event context + * @paramin cb Trace callback + * @paramin private_data Data to be passed to callback + * + * @note The callback will be called at trace points defined by + * tevent_event_trace_point. Call with NULL to reset. + */ +void tevent_set_trace_queue_callback(struct tevent_context *ev, + tevent_trace_queue_callback_t cb, + void *private_data); + +/** + * Retrieve the current trace callback of queue. + * + * @paramin ev Event context + * @paramout cb Registered trace callback + * @paramout p_private_data Registered data to be passed to callback + * + * @note This can be used to allow one component that wants to + * register a callback to respect the callback that another component + * has already registered. + */ +void tevent_get_trace_queue_callback(struct tevent_context *ev, + tevent_trace_queue_callback_t *cb, + void *p_private_data); + #ifdef DOXYGEN /** * @brief Create and start a tevent queue.
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tevent_debug.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_debug.c
Changed
@@ -260,3 +260,35 @@ ev->tracing.im.callback(im, tp, ev->tracing.im.private_data); } } + +void tevent_set_trace_queue_callback(struct tevent_context *ev, + tevent_trace_queue_callback_t cb, + void *private_data) +{ + if (ev->wrapper.glue != NULL) { + ev = tevent_wrapper_main_ev(ev); + tevent_abort(ev, "tevent_set_trace_queue_callback() " + "on wrapper"); + return; + } + + ev->tracing.qe.callback = cb; + ev->tracing.qe.private_data = private_data; +} + +void tevent_get_trace_queue_callback(struct tevent_context *ev, + tevent_trace_queue_callback_t *cb, + void *p_private_data) +{ + *cb = ev->tracing.qe.callback; + *(void**)p_private_data = ev->tracing.qe.private_data; +} + +void tevent_trace_queue_callback(struct tevent_context *ev, + struct tevent_queue_entry *qe, + enum tevent_event_trace_point tp) +{ + if (ev->tracing.qe.callback != NULL) { + ev->tracing.qe.callback(qe, tp, ev->tracing.qe.private_data); + } +}
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tevent_epoll.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_epoll.c
Changed
@@ -206,7 +206,7 @@ "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - epoll_ev->pid = getpid(); + epoll_ev->pid = tevent_cached_getpid(); talloc_set_destructor(epoll_ev, epoll_ctx_destructor); return 0; @@ -224,8 +224,9 @@ struct tevent_fd *fde; bool *caller_panic_state = epoll_ev->panic_state; bool panic_triggered = false; + pid_t pid = tevent_cached_getpid(); - if (epoll_ev->pid == getpid()) { + if (epoll_ev->pid == pid) { return; } @@ -241,7 +242,7 @@ "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - epoll_ev->pid = getpid(); + epoll_ev->pid = pid; epoll_ev->panic_state = &panic_triggered; for (fde=epoll_ev->ev->fd_events;fde;fde=fde->next) { fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tevent_internal.h -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_internal.h
Changed
@@ -1,10 +1,10 @@ -/* +/* Unix SMB/CIFS implementation. generalised event loop handling INTERNAL STRUCTS. THERE ARE NO API GUARANTEES. - External users should only ever have to include this header when + External users should only ever have to include this header when implementing new tevent backends. Copyright (C) Stefan Metzmacher 2005-2009 @@ -366,6 +366,11 @@ tevent_trace_immediate_callback_t callback; void *private_data; } im; + + struct { + tevent_trace_queue_callback_t callback; + void *private_data; + } qe; } tracing; struct { @@ -516,3 +521,7 @@ void tevent_trace_immediate_callback(struct tevent_context *ev, struct tevent_immediate *im, enum tevent_event_trace_point); + +void tevent_trace_queue_callback(struct tevent_context *ev, + struct tevent_queue_entry *qe, + enum tevent_event_trace_point);
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tevent_port.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_port.c
Changed
@@ -95,7 +95,7 @@ "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - port_ev->pid = getpid(); + port_ev->pid = tevent_cached_getpid(); talloc_set_destructor(port_ev, port_ctx_destructor); return 0; @@ -199,8 +199,9 @@ 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 == getpid()) { + if (port_ev->pid == pid) { return 0; } @@ -217,7 +218,7 @@ "Failed to set close-on-exec, file descriptor may be leaked to children.\n"); } - port_ev->pid = getpid(); + 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) {
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/tevent_queue.c -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/tevent_queue.c
Changed
@@ -38,6 +38,7 @@ tevent_queue_trigger_fn_t trigger; void *private_data; + uint64_t tag; }; struct tevent_queue { @@ -63,6 +64,7 @@ return 0; } + tevent_trace_queue_callback(q->list->ev, e, TEVENT_EVENT_TRACE_DETACH); DLIST_REMOVE(q->list, e); q->length--; @@ -145,10 +147,18 @@ return; } + tevent_trace_queue_callback(ev, q->list, + TEVENT_EVENT_TRACE_BEFORE_HANDLER); q->list->triggered = true; q->list->trigger(q->list->req, q->list->private_data); } +static void tevent_queue_noop_trigger(struct tevent_req *req, + void *_private_data) +{ + /* this is doing nothing but blocking the queue */ +} + static struct tevent_queue_entry *tevent_queue_add_internal( struct tevent_queue *queue, struct tevent_context *ev, @@ -164,19 +174,19 @@ return NULL; } - e->queue = queue; - e->req = req; - e->ev = ev; - e->trigger = trigger; - e->private_data = private_data; - /* * if there is no trigger, it is just a blocker */ if (trigger == NULL) { - e->triggered = true; + trigger = tevent_queue_noop_trigger; } + e->queue = queue; + e->req = req; + e->ev = ev; + e->trigger = trigger; + e->private_data = private_data; + if (queue->length > 0) { /* * if there are already entries in the @@ -198,6 +208,7 @@ DLIST_ADD_END(queue->list, e); queue->length++; talloc_set_destructor(e, tevent_queue_entry_destructor); + tevent_trace_queue_callback(ev, e, TEVENT_EVENT_TRACE_ATTACH); if (!queue->running) { return e; @@ -213,6 +224,9 @@ * an immediate event. */ if (allow_direct) { + tevent_trace_queue_callback(ev, + queue->list, + TEVENT_EVENT_TRACE_BEFORE_HANDLER); queue->list->triggered = true; queue->list->trigger(queue->list->req, queue->list->private_data); @@ -368,3 +382,21 @@ tevent_req_received(req); return true; } + +void tevent_queue_entry_set_tag(struct tevent_queue_entry *qe, uint64_t tag) +{ + if (qe == NULL) { + return; + } + + qe->tag = tag; +} + +uint64_t tevent_queue_entry_get_tag(const struct tevent_queue_entry *qe) +{ + if (qe == NULL) { + return 0; + } + + return qe->tag; +}
View file
_service:tar_scm:ldb-2.4.1.tar.gz/lib/tevent/wscript -> _service:tar_scm:ldb-2.6.1.tar.gz/lib/tevent/wscript
Changed
@@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tevent' -VERSION = '0.11.0' +VERSION = '0.13.0' import sys, os
View file
_service:tar_scm:ldb-2.4.1.tar.gz/modules/rdn_name.c -> _service:tar_scm:ldb-2.6.1.tar.gz/modules/rdn_name.c
Changed
@@ -308,16 +308,10 @@ } rdn_val = ldb_val_dup(msg, rdn_val_p); - if (ldb_msg_add_empty(msg, rdn_name, LDB_FLAG_MOD_REPLACE, NULL) != 0) { + if (ldb_msg_append_value(msg, rdn_name, &rdn_val, LDB_FLAG_MOD_REPLACE) != 0) { goto error; } - if (ldb_msg_add_value(msg, rdn_name, &rdn_val, NULL) != 0) { - goto error; - } - if (ldb_msg_add_empty(msg, "name", LDB_FLAG_MOD_REPLACE, NULL) != 0) { - goto error; - } - if (ldb_msg_add_value(msg, "name", &rdn_val, NULL) != 0) { + if (ldb_msg_append_value(msg, "name", &rdn_val, LDB_FLAG_MOD_REPLACE) != 0) { goto error; } @@ -466,11 +460,7 @@ if (ret != 0) { return ldb_module_oom(module); } - ret = ldb_msg_add_empty(msg, rdn_name, LDB_FLAG_MOD_ADD, NULL); - if (ret != 0) { - return ldb_module_oom(module); - } - ret = ldb_msg_add_value(msg, rdn_name, &rdn_val, NULL); + ret = ldb_msg_append_value(msg, rdn_name, &rdn_val, LDB_FLAG_MOD_ADD); if (ret != 0) { return ldb_module_oom(module); } @@ -479,11 +469,7 @@ if (ret != 0) { return ldb_module_oom(module); } - ret = ldb_msg_add_empty(msg, "name", LDB_FLAG_MOD_ADD, NULL); - if (ret != 0) { - return ldb_module_oom(module); - } - ret = ldb_msg_add_value(msg, "name", &rdn_val, NULL); + ret = ldb_msg_append_value(msg, "name", &rdn_val, LDB_FLAG_MOD_ADD); if (ret != 0) { return ldb_module_oom(module); } @@ -545,7 +531,7 @@ if (e != NULL) { ldb_asprintf_errstring(ldb, "Modify of 'distinguishedName' on %s not permitted, must use 'rename' operation instead", ldb_dn_get_linearized(req->op.mod.message->dn)); - if (e->flags == LDB_FLAG_MOD_REPLACE) { + if (LDB_FLAG_MOD_TYPE(e->flags) == LDB_FLAG_MOD_REPLACE) { return LDB_ERR_CONSTRAINT_VIOLATION; } else { return LDB_ERR_UNWILLING_TO_PERFORM;
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/init_slapd.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/init_slapd.sh
Changed
@@ -1,20 +1,20 @@ -#!/bin/sh +#!/bin/sh if -z "$LDBDIR" ; then - LDBDIR=`dirname $0`/.. - export LDBDIR + LDBDIR=$(dirname $0)/.. + export LDBDIR fi rm -rf tests/tmp/db mkdir -p tests/tmp/db if -f tests/tmp/slapd.pid ; then - kill `cat tests/tmp/slapd.pid` - sleep 1 + kill $(cat tests/tmp/slapd.pid) + sleep 1 fi if -f tests/tmp/slapd.pid ; then - kill -9 `cat tests/tmp/slapd.pid` - rm -f tests/tmp/slapd.pid + kill -9 $(cat tests/tmp/slapd.pid) + rm -f tests/tmp/slapd.pid fi # we don't consider a slapadd failure as a test suite failure, as it @@ -24,18 +24,17 @@ rm -f $MODCONF touch $MODCONF || exit 1 -slaptest -u -f $LDBDIR/tests/slapd.conf > /dev/null 2>&1 || { - echo "enabling sladp modules" -cat > $MODCONF <<EOF +slaptest -u -f $LDBDIR/tests/slapd.conf >/dev/null 2>&1 || { + echo "enabling sladp modules" + cat >$MODCONF <<EOF modulepath /usr/lib/ldap moduleload back_bdb EOF } slaptest -u -f $LDBDIR/tests/slapd.conf || { - echo "slaptest failed - skipping ldap tests" - exit 0 + echo "slaptest failed - skipping ldap tests" + exit 0 } -slapadd -f $LDBDIR/tests/slapd.conf < $LDBDIR/tests/init.ldif || exit 0 - +slapadd -f $LDBDIR/tests/slapd.conf <$LDBDIR/tests/init.ldif || exit 0
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/kill_slapd.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/kill_slapd.sh
Changed
@@ -1,12 +1,12 @@ -#!/bin/sh +#!/bin/sh if -z "$LDBDIR" ; then - LDBDIR=`dirname $0`/.. - export LDBDIR + LDBDIR=$(dirname $0)/.. + export LDBDIR fi if -f tests/tmp/slapd.pid ; then - echo "killing slapd process `cat tests/tmp/slapd.pid`" - kill -9 `cat tests/tmp/slapd.pid` - rm -f tests/tmp/slapd.pid + echo "killing slapd process $(cat tests/tmp/slapd.pid)" + kill -9 $(cat tests/tmp/slapd.pid) + rm -f tests/tmp/slapd.pid fi
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/ldapi_url.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/ldapi_url.sh
Changed
@@ -2,10 +2,10 @@ # aargh, did LDAP ever have to expose this crap to users ... -BASE=`pwd` +BASE=$(pwd) TMPDIR=$BASE/tests/tmp -LDAPI_ESCAPE=`echo $TMPDIR/ldapi | sed 's|/|%2F|g'` +LDAPI_ESCAPE=$(echo $TMPDIR/ldapi | sed 's|/|%2F|g') echo "ldapi://$LDAPI_ESCAPE"
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/start_slapd.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/start_slapd.sh
Changed
@@ -1,14 +1,14 @@ #!/bin/sh if -z "$LDBDIR" ; then - LDBDIR=`dirname $0`/.. - export LDBDIR + LDBDIR=$(dirname $0)/.. + export LDBDIR fi mkdir -p $LDBDIR/tests/tmp/db # running slapd in the background (with &) means it stays in the same process group, so it can be # killed by timelimit -slapd -d0 -f $LDBDIR/tests/slapd.conf -h "`$LDBDIR/tests/ldapi_url.sh`" $* & +slapd -d0 -f $LDBDIR/tests/slapd.conf -h "$($LDBDIR/tests/ldapi_url.sh)" $* & sleep 2
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-extended.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-extended.sh
Changed
@@ -35,16 +35,17 @@ samAccountType: 805306369 EOF -checkcount() { - count=$1 - expression="$2" - n=`$VALGRIND ldbsearch "$expression" | grep '^dn' | wc -l` - if $n != $count ; then - echo "Got $n but expected $count for $expression" - $VALGRIND ldbsearch "$expression" - exit 1 - fi - echo "OK: $count $expression" +checkcount() +{ + count=$1 + expression="$2" + n=$($VALGRIND ldbsearch "$expression" | grep '^dn' | wc -l) + if $n != $count ; then + echo "Got $n but expected $count for $expression" + $VALGRIND ldbsearch "$expression" + exit 1 + fi + echo "OK: $count $expression" } checkcount 1 '(i3=1234)' @@ -66,4 +67,3 @@ # this is one that w2k gives checkcount 3 '(|(|(&(!(groupType:1.2.840.113556.1.4.803:=1))(groupType:1.2.840.113556.1.4.803:=2147483648)(groupType:1.2.840.113556.1.4.804:=10))(samAccountType=805306368))(samAccountType=805306369))' -
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-generic.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-generic.sh
Changed
@@ -1,8 +1,8 @@ #!/bin/sh if -z "$LDB_SPECIALS" ; then - LDB_SPECIALS=1 - export LDB_SPECIALS + LDB_SPECIALS=1 + export LDB_SPECIALS fi echo "LDB_URL: $LDB_URL" @@ -11,15 +11,15 @@ $VALGRIND ldbadd $LDBDIR/tests/test.ldif || exit 1 echo "Adding again - should fail" -$VALGRIND ldbadd $LDBDIR/tests/test.ldif 2> /dev/null && { - echo "Should have failed to add again - gave $?" - exit 1 +$VALGRIND ldbadd $LDBDIR/tests/test.ldif 2>/dev/null && { + echo "Should have failed to add again - gave $?" + exit 1 } echo "Adding LDIF with one already-existing user again - should fail" -$VALGRIND ldbadd $LDBDIR/tests/test-dup.ldif 2> /dev/null && { - echo "Should have failed to add again - gave $?" - exit 1 +$VALGRIND ldbadd $LDBDIR/tests/test-dup.ldif 2>/dev/null && { + echo "Should have failed to add again - gave $?" + exit 1 } echo "Adding again - should succeed (as previous failed)" @@ -29,19 +29,19 @@ $VALGRIND ldbmodify $LDBDIR/tests/test-modify.ldif || exit 1 echo "Modify LDIF with one un-met constraint - should fail" -$VALGRIND ldbadd $LDBDIR/tests/test-modify-unmet.ldif 2> /dev/null && { - echo "Should have failed to modify - gave $?" - exit 1 +$VALGRIND ldbadd $LDBDIR/tests/test-modify-unmet.ldif 2>/dev/null && { + echo "Should have failed to modify - gave $?" + exit 1 } echo "Modify LDIF with after failure of un-met constraint - should also fail" -$VALGRIND ldbadd $LDBDIR/tests/test-modify-unmet-2.ldif 2> /dev/null && { - echo "Should have failed to modify - gave $?" - exit 1 +$VALGRIND ldbadd $LDBDIR/tests/test-modify-unmet-2.ldif 2>/dev/null && { + echo "Should have failed to modify - gave $?" + exit 1 } echo "Showing modified record" -$VALGRIND ldbsearch '(uid=uham)' || exit 1 +$VALGRIND ldbsearch '(uid=uham)' || exit 1 echo "Rename entry with ldbmodify - modrdn" $VALGRIND ldbmodify $LDBDIR/tests/test-modify-modrdn.ldif || exit 1 @@ -49,33 +49,33 @@ echo "Rename entry with ldbrename" OLDDN="cn=Ursula Hampster,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST" NEWDN="cn=Hampster Ursula,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST" -$VALGRIND ldbrename "$OLDDN" "$NEWDN" || exit 1 +$VALGRIND ldbrename "$OLDDN" "$NEWDN" || exit 1 echo "Showing renamed record" $VALGRIND ldbsearch '(uid=uham)' || exit 1 echo "Starting ldbtest" -$VALGRIND ldbtest --num-records 100 --num-searches 10 || exit 1 +$VALGRIND ldbtest --num-records 100 --num-searches 10 || exit 1 if $LDB_SPECIALS = 1 ; then - echo "Adding index" - $VALGRIND ldbadd $LDBDIR/tests/test-index.ldif || exit 1 + echo "Adding index" + $VALGRIND ldbadd $LDBDIR/tests/test-index.ldif || exit 1 fi echo "Adding bad attributes - should fail" $VALGRIND ldbadd $LDBDIR/tests/test-wrong_attributes.ldif && { - echo "Should fhave failed - gave $?" - exit 1 + echo "Should fhave failed - gave $?" + exit 1 } echo "Testing indexed search" -$VALGRIND ldbsearch '(uid=uham)' || exit 1 +$VALGRIND ldbsearch '(uid=uham)' || exit 1 $VALGRIND ldbsearch '(&(objectclass=person)(objectclass=person)(objectclass=top))' || exit 1 -$VALGRIND ldbsearch '(&(uid=uham)(uid=uham))' || exit 1 -$VALGRIND ldbsearch '(|(uid=uham)(uid=uham))' || exit 1 -$VALGRIND ldbsearch '(|(uid=uham)(uid=uham)(objectclass=OpenLDAPperson))' || exit 1 -$VALGRIND ldbsearch '(&(uid=uham)(uid=uham)(!(objectclass=xxx)))' || exit 1 -$VALGRIND ldbsearch '(&(objectclass=person)(uid=uham)(!(uid=uhamxx)))' uid \* \+ dn || exit 1 +$VALGRIND ldbsearch '(&(uid=uham)(uid=uham))' || exit 1 +$VALGRIND ldbsearch '(|(uid=uham)(uid=uham))' || exit 1 +$VALGRIND ldbsearch '(|(uid=uham)(uid=uham)(objectclass=OpenLDAPperson))' || exit 1 +$VALGRIND ldbsearch '(&(uid=uham)(uid=uham)(!(objectclass=xxx)))' || exit 1 +$VALGRIND ldbsearch '(&(objectclass=person)(uid=uham)(!(uid=uhamxx)))' uid \* \+ dn || exit 1 $VALGRIND ldbsearch '(&(uid=uham)(uid=uha*)(title=*))' uid || exit 1 echo "Testing invalid search expression" @@ -89,64 +89,65 @@ $VALGRIND ldbsearch -b 'cn=Hampster Ursula,ou=Alumni Association,ou=People,o=University of Michigan,c=TEST' --scope=base "" sn || exit 1 echo "Test wildcard match" -$VALGRIND ldbadd $LDBDIR/tests/test-wildcard.ldif || exit 1 -$VALGRIND ldbsearch '(cn=test*multi)' || exit 1 -$VALGRIND ldbsearch '(cn=*test*multi*)' || exit 1 -$VALGRIND ldbsearch '(cn=*test_multi)' || exit 1 -$VALGRIND ldbsearch '(cn=test_multi*)' || exit 1 -$VALGRIND ldbsearch '(cn=test*multi*test*multi)' || exit 1 +$VALGRIND ldbadd $LDBDIR/tests/test-wildcard.ldif || exit 1 +$VALGRIND ldbsearch '(cn=test*multi)' || exit 1 +$VALGRIND ldbsearch '(cn=*test*multi*)' || exit 1 +$VALGRIND ldbsearch '(cn=*test_multi)' || exit 1 +$VALGRIND ldbsearch '(cn=test_multi*)' || exit 1 +$VALGRIND ldbsearch '(cn=test*multi*test*multi)' || exit 1 $VALGRIND ldbsearch '(cn=test*multi*test*multi*multi_*)' || exit 1 echo "Starting ldbtest indexed" -$VALGRIND ldbtest --num-records 100 --num-searches 500 || exit 1 +$VALGRIND ldbtest --num-records 100 --num-searches 500 || exit 1 echo "Testing one level search" -count=`$VALGRIND ldbsearch -b 'ou=Groups,o=University of Michigan,c=TEST' --scope=one 'objectclass=*' none |grep '^dn' | wc -l` +count=$($VALGRIND ldbsearch -b 'ou=Groups,o=University of Michigan,c=TEST' --scope=one 'objectclass=*' none | grep '^dn' | wc -l) if $count != 3 ; then - echo returned $count records - expected 3 - exit 1 + echo returned $count records - expected 3 + exit 1 fi echo "Testing binary file attribute value" $VALGRIND ldbmodify $LDBDIR/tests/photo.ldif || exit 1 -count=`$VALGRIND ldbsearch '(cn=Hampster Ursula)' jpegPhoto | grep '^dn' | wc -l` +count=$($VALGRIND ldbsearch '(cn=Hampster Ursula)' jpegPhoto | grep '^dn' | wc -l) if $count != 1 ; then - echo returned $count records - expected 1 - exit 1 + echo returned $count records - expected 1 + exit 1 fi echo "*TODO* Testing UTF8 upper lower case searches !!" echo "Testing compare" -count=`$VALGRIND ldbsearch '(cn>=t)' cn | grep '^dn' | wc -l` +count=$($VALGRIND ldbsearch '(cn>=t)' cn | grep '^dn' | wc -l) if $count != 1 ; then - # only "cn: test_multi_test_multi_test_multi" (comes after "t") - # upper-cased words come before "t" - hence excluded - echo returned $count records - expected 1 - exit 1 + # only "cn: test_multi_test_multi_test_multi" (comes after "t") + # upper-cased words come before "t" - hence excluded + echo returned $count records - expected 1 + exit 1 fi $VALGRIND ldbsearch '(cn>t)' cn && exit 1 # strictly greater should not work -count=`$VALGRIND ldbsearch '(cn<=t)' cn | grep '^dn' | wc -l` +count=$($VALGRIND ldbsearch '(cn<=t)' cn | grep '^dn' | wc -l) if $count != 18 ; then - # everything except "cn: test_multi_test_multi_test_multi" (comes after "t") - # upper-cased letters come before "t" - hence included - echo returned $count records - expected 18 - exit 1 + # everything except "cn: test_multi_test_multi_test_multi" (comes after "t") + # upper-cased letters come before "t" - hence included + echo returned $count records - expected 18 + exit 1 fi $VALGRIND ldbsearch '(cn<t)' cn && exit 1 # strictly less should not work -checkcount() { - count=$1 - scope=$2 - basedn=$3 - expression="$4" - n=`$VALGRIND ldbsearch --scope="$scope" -b "$basedn" "$expression" | grep '^dn' | wc -l` - if $n != $count ; then - echo "Got $n but expected $count for $expression" - exit 1 - fi - echo "OK: $count $expression" +checkcount() +{ + count=$1 + scope=$2 + basedn=$3 + expression="$4" + n=$($VALGRIND ldbsearch --scope="$scope" -b "$basedn" "$expression" | grep '^dn' | wc -l) + if $n != $count ; then + echo "Got $n but expected $count for $expression" + exit 1 + fi + echo "OK: $count $expression" } checkcount 0 'base' '' '(uid=uham)'
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-ldap.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-ldap.sh
Changed
@@ -6,31 +6,31 @@ # setup needed schema files for f in $SCHEMA_NEEDED; do - if ! -r tests/schema/$f.schema ; then - mkdir -p tests/schema - if -r /etc/ldap/schema/$f.schema ; then - ln -s /etc/ldap/schema/$f.schema tests/schema/$f.schema - continue; + if ! -r tests/schema/$f.schema ; then + mkdir -p tests/schema + if -r /etc/ldap/schema/$f.schema ; then + ln -s /etc/ldap/schema/$f.schema tests/schema/$f.schema + continue + fi + if -r /etc/openldap/schema/$f.schema ; then + ln -s /etc/openldap/schema/$f.schema tests/schema/$f.schema + continue + fi + + echo "SKIPPING TESTS: you need the following OpenLDAP schema files" + for f in $SCHEMA_NEEDED; do + echo " $f.schema" + done + exit 0 fi - if -r /etc/openldap/schema/$f.schema ; then - ln -s /etc/openldap/schema/$f.schema tests/schema/$f.schema - continue; - fi - - echo "SKIPPING TESTS: you need the following OpenLDAP schema files" - for f in $SCHEMA_NEEDED; do - echo " $f.schema" - done - exit 0 - fi done if -z "$LDBDIR" ; then - LDBDIR=`dirname $0`/.. - export LDBDIR + LDBDIR=$(dirname $0)/.. + export LDBDIR fi -LDB_URL=`$LDBDIR/tests/ldapi_url.sh` +LDB_URL=$($LDBDIR/tests/ldapi_url.sh) export LDB_URL PATH=bin:$PATH @@ -39,14 +39,14 @@ LDB_SPECIALS=0 export LDB_SPECIALS -if $LDBDIR/tests/init_slapd.sh && - $LDBDIR/tests/start_slapd.sh && - $LDBDIR/tests/test-generic.sh; then - echo "ldap tests passed"; - ret=0 +if $LDBDIR/tests/init_slapd.sh && + $LDBDIR/tests/start_slapd.sh && + $LDBDIR/tests/test-generic.sh; then + echo "ldap tests passed" + ret=0 else - echo "ldap tests failed"; - ret=$? + echo "ldap tests failed" + ret=$? fi #$LDBDIR/tests/kill_slapd.sh
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-schema.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-schema.sh
Changed
@@ -30,5 +30,4 @@ fi echo "Showing modified record" -$VALGRIND bin/ldbsearch '(cn=Test)' || exit 1 - +$VALGRIND bin/ldbsearch '(cn=Test)' || exit 1
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-soloading.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-soloading.sh
Changed
@@ -13,8 +13,8 @@ rm -f $LDB_URL* if -z "$LDBDIR" ; then - LDBDIR=`dirname $0`/.. - export LDBDIR + LDBDIR=$(dirname $0)/.. + export LDBDIR fi cat <<EOF | $VALGRIND ldbadd || exit 1 @@ -29,4 +29,3 @@ EOF $VALGRIND ldbsearch "(touchedBy=sample)" | grep "touchedBy: sample" || exit 1 -
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-sqlite3.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-sqlite3.sh
Changed
@@ -1,14 +1,13 @@ #!/bin/sh - LDB_URL="sqlite3://sqltest.ldb" export LDB_URL rm -f sqltest.ldb if -z "$LDBDIR" ; then - LDBDIR=`dirname $0`/.. - export LDBDIR + LDBDIR=$(dirname $0)/.. + export LDBDIR fi PATH=bin:$PATH @@ -22,4 +21,3 @@ #. $LDBDIR/tests/test-extended.sh #. $LDBDIR/tests/test-tdb-features.sh -
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-tdb-features.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-tdb-features.sh
Changed
@@ -9,16 +9,17 @@ @LIST: rdn_name EOF -checkcount() { - count=$1 - expression="$2" - n=`$VALGRIND ldbsearch "$expression" | grep '^dn' | wc -l` - if $n != $count ; then - echo "Got $n but expected $count for $expression" - $VALGRIND ldbsearch "$expression" - exit 1 - fi - echo "OK: $count $expression" +checkcount() +{ + count=$1 + expression="$2" + n=$($VALGRIND ldbsearch "$expression" | grep '^dn' | wc -l) + if $n != $count ; then + echo "Got $n but expected $count for $expression" + $VALGRIND ldbsearch "$expression" + exit 1 + fi + echo "OK: $count $expression" } echo "Testing case sensitive search" @@ -120,17 +121,18 @@ checkcount 0 '(test=FOO)' checkcount 1 '(test=f*o*)' -checkone() { - count=$1 - base="$2" - expression="$3" - n=`$VALGRIND ldbsearch --scope=one -b "$base" "$expression" | grep '^dn' | wc -l` - if $n != $count ; then - echo "Got $n but expected $count for $expression" - $VALGRIND ldbsearch --scope=one -b "$base" "$expression" - exit 1 - fi - echo "OK: $count $expression" +checkone() +{ + count=$1 + base="$2" + expression="$3" + n=$($VALGRIND ldbsearch --scope=one -b "$base" "$expression" | grep '^dn' | wc -l) + if $n != $count ; then + echo "Got $n but expected $count for $expression" + $VALGRIND ldbsearch --scope=one -b "$base" "$expression" + exit 1 + fi + echo "OK: $count $expression" } echo "Removing wildcard attribute" @@ -175,4 +177,3 @@ EOF checkone 3 "cn=t1,cn=TEST" '(test=one)' checkone 1 "cn=t1,cn=TEST" '(cn=two)' -
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-tdb-subunit.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-tdb-subunit.sh
Changed
@@ -2,6 +2,6 @@ BINDIR=$1 -. `dirname $0`/../../../testprogs/blackbox/subunit.sh +. $(dirname $0)/../../../testprogs/blackbox/subunit.sh -testit "ldb" `dirname $0`/test-tdb.sh $BINDIR +testit "ldb" $(dirname $0)/test-tdb.sh $BINDIR
View file
_service:tar_scm:ldb-2.4.1.tar.gz/tests/test-tdb.sh -> _service:tar_scm:ldb-2.6.1.tar.gz/tests/test-tdb.sh
Changed
@@ -14,8 +14,8 @@ export PATH if -z "$LDBDIR" ; then - LDBDIR=`dirname $0`/.. - export LDBDIR + LDBDIR=$(dirname $0)/.. + export LDBDIR fi cd $LDBDIR
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/update.sh
Added
@@ -0,0 +1,81 @@ +#!/bin/bash + +if $# -lt 1 ; then + echo "Usage: update.sh VERSION" + exit 1 +fi + +WAF_VERSION="${1}" +WAF_GIT="https://gitlab.com/ita1024/waf.git" +WAF_UPDATE_SCRIPT="$(readlink -f "$0")" +WAF_SAMBA_DIR="$(dirname "${WAF_UPDATE_SCRIPT}")" +WAF_TMPDIR=$(mktemp --tmpdir -d waf-XXXXXXXX) + +echo "VERSION: ${WAF_VERSION}" +echo "GIT URL: ${WAF_GIT}" +echo "WAF SAMBA DIR: ${WAF_SAMBA_DIR}" +echo "WAF TMP DIR: ${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 +} + +# Checkout the git tree +mkdir -p "${WAF_TMPDIR}" +pushd "${WAF_TMPDIR}" || cleanup_and_exit 1 + +git clone "${WAF_GIT}" +ret=$? +if $ret -ne 0 ; then + 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 +fi +popd || cleanup_and_exit 1 + +popd || cleanup_and_exit 1 + +# Update waflib +pushd "${WAF_SAMBA_DIR}" || cleanup_and_exit 1 +pwd + +rm -rf waflib/ +rsync -av "${WAF_TMPDIR}/waf/waflib" . +ret=$? +if $ret -ne 0 ; then + echo "ERROR: Failed copy waflib" + cleanup_and_exit 1 +fi +chmod -x waflib/Context.py + +git add waflib + +popd || cleanup_and_exit 1 + +echo +echo "Now please change VERSION in buildtools/bin/waf and" +echo "Context.HEXVERSION in buildtools/wafsamba/wafsamba.py" +grep WAFVERSION "${WAF_SAMBA_DIR}/waflib/Context.py" +grep HEXVERSION "${WAF_SAMBA_DIR}/waflib/Context.py" +echo + +cleanup_and_exit 0
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Build.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Build.py
Changed
@@ -1066,9 +1066,9 @@ else: dest = os.path.normpath(Utils.subst_vars(self.install_to, self.env)) if not os.path.isabs(dest): - dest = os.path.join(self.env.PREFIX, dest) + dest = os.path.join(self.env.PREFIX, dest) if destdir and Options.options.destdir: - dest = os.path.join(Options.options.destdir, os.path.splitdrive(dest)1.lstrip(os.sep)) + dest = Options.options.destdir.rstrip(os.sep) + os.sep + os.path.splitdrive(dest)1.lstrip(os.sep) return dest def copy_fun(self, src, tgt):
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Context.py -> _service:tar_scm:ldb-2.6.1.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=0x2001500 +HEXVERSION=0x2001800 """Constant updated on new releases""" -WAFVERSION="2.0.21" +WAFVERSION="2.0.24" """Constant updated on new releases""" -WAFREVISION="edde20a6425a5c3eb6b47d5f3f5c4fbc93fed5f4" +WAFREVISION="1af97c71f5a6756abf36d0f78ed8fd551596d7cb" """Git revision when the waf version is updated""" WAFNAME="waf" @@ -144,7 +144,7 @@ :type fun: string .. inheritance-diagram:: waflib.Context.Context waflib.Build.BuildContext waflib.Build.InstallContext waflib.Build.UninstallContext waflib.Build.StepContext waflib.Build.ListContext waflib.Configure.ConfigurationContext waflib.Scripting.Dist waflib.Scripting.DistCheck waflib.Build.CleanContext - + :top-classes: waflib.Context.Context """ errors = Errors
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Runner.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Runner.py
Changed
@@ -71,7 +71,7 @@ """Task to execute""" self.spawner = spawner """Coordinator object""" - self.setDaemon(1) + self.daemon = True self.start() def run(self): """ @@ -98,7 +98,7 @@ """:py:class:`waflib.Runner.Parallel` producer instance""" self.sem = Utils.threading.Semaphore(master.numjobs) """Bounded semaphore that prevents spawning more than *n* concurrent consumers""" - self.setDaemon(1) + self.daemon = True self.start() def run(self): """
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/TaskGen.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/TaskGen.py
Changed
@@ -631,12 +631,8 @@ cls.scan = self.scan elif has_deps: def scan(self): - nodes = - for x in self.generator.to_list(getattr(self.generator, 'deps', None)): - node = self.generator.path.find_resource(x) - if not node: - self.generator.bld.fatal('Could not find %r (was it declared?)' % x) - nodes.append(node) + deps = getattr(self.generator, 'deps', None) + nodes = self.generator.to_nodes(deps) return nodes, cls.scan = scan
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/c_config.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/c_config.py
Changed
@@ -69,6 +69,7 @@ '__sh__' : 'sh', '__xtensa__' : 'xtensa', '__e2k__' : 'e2k', +'__riscv' : 'riscv', } @conf
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/ccroot.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/ccroot.py
Changed
@@ -128,6 +128,7 @@ Base class for all link tasks. A task generator is supposed to have at most one link task bound in the attribute *link_task*. See :py:func:`waflib.Tools.ccroot.apply_link`. .. inheritance-diagram:: waflib.Tools.ccroot.stlink_task waflib.Tools.c.cprogram waflib.Tools.c.cshlib waflib.Tools.cxx.cxxstlib waflib.Tools.cxx.cxxprogram waflib.Tools.cxx.cxxshlib waflib.Tools.d.dprogram waflib.Tools.d.dshlib waflib.Tools.d.dstlib waflib.Tools.ccroot.fake_shlib waflib.Tools.ccroot.fake_stlib waflib.Tools.asm.asmprogram waflib.Tools.asm.asmshlib waflib.Tools.asm.asmstlib + :top-classes: waflib.Tools.ccroot.link_task """ color = 'YELLOW'
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/compiler_c.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/compiler_c.py
Changed
@@ -36,18 +36,19 @@ from waflib.Logs import debug c_compiler = { -'win32': 'msvc', 'gcc', 'clang', -'cygwin': 'gcc', 'clang', -'darwin': 'clang', 'gcc', -'aix': 'xlc', 'gcc', 'clang', -'linux': 'gcc', 'clang', 'icc', -'sunos': 'suncc', 'gcc', -'irix': 'gcc', 'irixcc', -'hpux': 'gcc', -'osf1V': 'gcc', -'gnu': 'gcc', 'clang', -'java': 'gcc', 'msvc', 'clang', 'icc', -'default':'clang', 'gcc', +'win32': 'msvc', 'gcc', 'clang', +'cygwin': 'gcc', 'clang', +'darwin': 'clang', 'gcc', +'aix': 'xlc', 'gcc', 'clang', +'linux': 'gcc', 'clang', 'icc', +'sunos': 'suncc', 'gcc', +'irix': 'gcc', 'irixcc', +'hpux': 'gcc', +'osf1V': 'gcc', +'gnu': 'gcc', 'clang', +'java': 'gcc', 'msvc', 'clang', 'icc', +'gnukfreebsd': 'gcc', 'clang', +'default': 'clang', 'gcc', } """ Dict mapping platform names to Waf tools finding specific C compilers::
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/compiler_cxx.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/compiler_cxx.py
Changed
@@ -37,18 +37,19 @@ from waflib.Logs import debug cxx_compiler = { -'win32': 'msvc', 'g++', 'clang++', -'cygwin': 'g++', 'clang++', -'darwin': 'clang++', 'g++', -'aix': 'xlc++', 'g++', 'clang++', -'linux': 'g++', 'clang++', 'icpc', -'sunos': 'sunc++', 'g++', -'irix': 'g++', -'hpux': 'g++', -'osf1V': 'g++', -'gnu': 'g++', 'clang++', -'java': 'g++', 'msvc', 'clang++', 'icpc', -'default': 'clang++', 'g++' +'win32': 'msvc', 'g++', 'clang++', +'cygwin': 'g++', 'clang++', +'darwin': 'clang++', 'g++', +'aix': 'xlc++', 'g++', 'clang++', +'linux': 'g++', 'clang++', 'icpc', +'sunos': 'sunc++', 'g++', +'irix': 'g++', +'hpux': 'g++', +'osf1V': 'g++', +'gnu': 'g++', 'clang++', +'java': 'g++', 'msvc', 'clang++', 'icpc', +'gnukfreebsd': 'g++', 'clang++', +'default': 'clang++', 'g++' } """ Dict mapping the platform names to Waf tools finding specific C++ compilers::
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/msvc.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/msvc.py
Changed
@@ -109,6 +109,21 @@ opt.add_option('--msvc_targets', type='string', help = 'msvc targets, eg: "x64,arm"', default='') opt.add_option('--no-msvc-lazy', action='store_false', help = 'lazily check msvc target environments', default=True, dest='msvc_lazy') +class MSVCVersion(object): + def __init__(self, ver): + m = re.search('^(.*)\s+(\d+.\d+)', ver) + if m: + self.name = m.group(1) + self.number = float(m.group(2)) + else: + self.name = ver + self.number = 0. + + def __lt__(self, other): + if self.number == other.number: + return self.name < other.name + return self.number < other.number + @conf def setup_msvc(conf, versiondict): """ @@ -125,7 +140,7 @@ platforms=Utils.to_list(conf.env.MSVC_TARGETS) or i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms desired_versions = getattr(Options.options, 'msvc_version', '').split(',') if desired_versions == '': - desired_versions = conf.env.MSVC_VERSIONS or list(reversed(sorted(versiondict.keys()))) + desired_versions = conf.env.MSVC_VERSIONS or list(sorted(versiondict.keys(), key=MSVCVersion, reverse=True)) # Override lazy detection by evaluating after the fact. lazy_detect = getattr(Options.options, 'msvc_lazy', True) @@ -193,7 +208,7 @@ echo INCLUDE=%%INCLUDE%% echo LIB=%%LIB%%;%%LIBPATH%% """ % (vcvars,target)) - sout = conf.cmd_and_log('cmd.exe', '/E:on', '/V:on', '/C', batfile.abspath()) + sout = conf.cmd_and_log('cmd.exe', '/E:on', '/V:on', '/C', batfile.abspath(), stdin=getattr(Utils.subprocess, 'DEVNULL', None)) lines = sout.splitlines() if not lines0:
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/python.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/python.py
Changed
@@ -315,7 +315,7 @@ conf.fatal('Could not find the python executable') # so we actually do all this for compatibility reasons and for obtaining pyext_PATTERN below - v = 'prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION'.split() + v = 'prefix SO EXT_SUFFIX LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION'.split() try: lst = conf.get_python_variables("get_config_var('%s') or ''" % x for x in v) except RuntimeError: @@ -327,8 +327,8 @@ dct = dict(zip(v, lst)) x = 'MACOSX_DEPLOYMENT_TARGET' if dctx: - envx = conf.environx = dctx - env.pyext_PATTERN = '%s' + dct'SO' # not a mistake + envx = conf.environx = str(dctx) + env.pyext_PATTERN = '%s' + (dct'EXT_SUFFIX' or dct'SO') # SO is deprecated in 3.5 and removed in 3.11 # Try to get pythonX.Y-config @@ -416,9 +416,14 @@ if not result: path = os.path.join(dct'prefix', "libs") - conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n") + conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY rather than pythonX.Y (win32)\n") result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in $prefix/libs' % name) + if not result: + path = os.path.normpath(os.path.join(dct'INCLUDEPY', '..', 'libs')) + conf.to_log("\n\n# try again with -L$INCLUDEPY/../libs, and pythonXY rather than pythonX.Y (win32)\n") + result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in $INCLUDEPY/../libs' % name) + if result: break # do not forget to set LIBPATH_PYEMBED
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/qt5.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/qt5.py
Changed
@@ -566,7 +566,7 @@ # at the end, try to find qmake in the paths given # keep the one with the highest version cand = None - prev_ver = '5', '0', '0' + prev_ver = '0', '0', '0' for qmk in ('qmake-qt5', 'qmake5', 'qmake'): try: qmake = self.find_program(qmk, path_list=paths) @@ -580,7 +580,7 @@ else: if version: new_ver = version.split('.') - if new_ver > prev_ver: + if new_ver0 == '5' and new_ver > prev_ver: cand = qmake prev_ver = new_ver @@ -783,8 +783,8 @@ pat = self.env.cxxstlib_PATTERN if Utils.unversioned_sys_platform() == 'darwin': pat = r"%s\.framework" - re_qt = re.compile(pat%'Qt5?(?P<name>.*)'+'$') - for x in dirlst: + re_qt = re.compile(pat % 'Qt5?(?P<name>\\w+)' + '$') + for x in sorted(dirlst): m = re_qt.match(x) if m: self.qt5_vars.append("Qt5%s" % m.group('name'))
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/tex.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/tex.py
Changed
@@ -90,6 +90,7 @@ Compiles a tex/latex file. .. inheritance-diagram:: waflib.Tools.tex.latex waflib.Tools.tex.xelatex waflib.Tools.tex.pdflatex + :top-classes: waflib.Tools.tex.tex """ bibtex_fun, _ = Task.compile_fun('${BIBTEX} ${BIBTEXFLAGS} ${SRCFILE}', shell=False)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/waf_unit_test.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/waf_unit_test.py
Changed
@@ -206,7 +206,7 @@ self.ut_exec = getattr(self.generator, 'ut_exec', self.inputs0.abspath()) ut_cmd = getattr(self.generator, 'ut_cmd', False) if ut_cmd: - self.ut_exec = shlex.split(ut_cmd % ' '.join(self.ut_exec)) + self.ut_exec = shlex.split(ut_cmd % Utils.shell_escape(self.ut_exec)) return self.exec_command(self.ut_exec)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Tools/winres.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Tools/winres.py
Changed
@@ -4,10 +4,12 @@ "Process *.rc* files for C/C++: X{.rc -> .res|.rc.o}" +import os import re from waflib import Task from waflib.TaskGen import extension from waflib.Tools import c_preproc +from waflib import Utils @extension('.rc') def rc_file(self, node): @@ -61,6 +63,39 @@ tmp.start(self.inputs0, self.env) return (tmp.nodes, tmp.names) + def exec_command(self, cmd, **kw): + if self.env.WINRC_TGT_F == '/fo': + # Since winres include paths may contain spaces, they do not fit in + # response files and are best passed as environment variables + replace_cmd = + incpaths = + while cmd: + # filter include path flags + flag = cmd.pop(0) + if flag.upper().startswith('/I'): + if len(flag) == 2: + incpaths.append(cmd.pop(0)) + else: + incpaths.append(flag2:) + else: + replace_cmd.append(flag) + cmd = replace_cmd + if incpaths: + # append to existing environment variables in INCLUDE + env = kw'env' = dict(kw.get('env') or self.env.env or os.environ) + pre_includes = env.get('INCLUDE', '') + env'INCLUDE' = pre_includes + os.pathsep + os.pathsep.join(incpaths) + + return super(winrc, self).exec_command(cmd, **kw) + + def quote_flag(self, flag): + if self.env.WINRC_TGT_F == '/fo': + # winres does not support quotes around flags in response files + return flag + + return super(winrc, self).quote_flag(flag) + + def configure(conf): """ Detects the programs RC or windres, depending on the C/C++ compiler in use
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/Utils.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/Utils.py
Changed
@@ -11,7 +11,7 @@ from __future__ import with_statement -import atexit, os, sys, errno, inspect, re, datetime, platform, base64, signal, functools, time +import atexit, os, sys, errno, inspect, re, datetime, platform, base64, signal, functools, time, shlex try: import cPickle @@ -577,10 +577,13 @@ fu = fu.upper() return fu -re_sh = re.compile('\\s|\'|"') -""" -Regexp used for shell_escape below -""" +# shlex.quote didn't exist until python 3.3. Prior to that it was a non-documented +# function in pipes. +try: + shell_quote = shlex.quote +except AttributeError: + import pipes + shell_quote = pipes.quote def shell_escape(cmd): """ @@ -589,7 +592,7 @@ """ if isinstance(cmd, str): return cmd - return ' '.join(repr(x) if re_sh.search(x) else x for x in cmd) + return ' '.join(shell_quote(x) for x in cmd) def h_list(lst): """
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/clang_compilation_database.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/clang_compilation_database.py
Changed
@@ -29,22 +29,9 @@ Task.Task.keep_last_cmd = True -@TaskGen.feature('c', 'cxx') -@TaskGen.after_method('process_use') -def collect_compilation_db_tasks(self): - "Add a compilation database entry for compiled tasks" - if not isinstance(self.bld, ClangDbContext): - return - - tup = tuple(y for y in Task.classes.get(x) for x in ('c', 'cxx') if y) - for task in getattr(self, 'compiled_tasks', ): - if isinstance(task, tup): - self.bld.clang_compilation_database_tasks.append(task) - class ClangDbContext(Build.BuildContext): '''generates compile_commands.json by request''' cmd = 'clangdb' - clang_compilation_database_tasks = def write_compilation_database(self): """ @@ -78,6 +65,8 @@ Build dry run """ self.restore() + self.cur_tasks = + self.clang_compilation_database_tasks = if not self.all_envs: self.load_envs() @@ -103,8 +92,21 @@ lst = tg else: lst = tg.tasks for tsk in lst: + if tsk.__class__.__name__ == "swig": + tsk.runnable_status() + if hasattr(tsk, 'more_tasks'): + lst.extend(tsk.more_tasks) + # Not all dynamic tasks can be processed, in some cases + # one may have to call the method "run()" like this: + #elif tsk.__class__.__name__ == 'src2c': + # tsk.run() + # if hasattr(tsk, 'more_tasks'): + # lst.extend(tsk.more_tasks) + tup = tuple(y for y in Task.classes.get(x) for x in ('c', 'cxx') if y) if isinstance(tsk, tup): + self.clang_compilation_database_tasks.append(tsk) + tsk.nocache = True old_exec = tsk.exec_command tsk.exec_command = exec_command tsk.run() @@ -124,7 +126,7 @@ Invoke clangdb command before build """ if self.cmd.startswith('build'): - Scripting.run_command('clangdb') + Scripting.run_command(self.cmd.replace('build','clangdb')) old_execute_build(self)
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/classic_runner.py
Added
@@ -0,0 +1,68 @@ +#!/usr/bin/env python +# encoding: utf-8 +# Thomas Nagy, 2021 (ita) + +from waflib import Utils, Runner + +""" +Re-enable the classic threading system from waf 1.x + +def configure(conf): + conf.load('classic_runner') +""" + +class TaskConsumer(Utils.threading.Thread): + """ + Task consumers belong to a pool of workers + + They wait for tasks in the queue and then use ``task.process(...)`` + """ + def __init__(self, spawner): + Utils.threading.Thread.__init__(self) + """ + Obtain :py:class:`waflib.Task.TaskBase` instances from this queue. + """ + self.spawner = spawner + self.daemon = True + self.start() + + def run(self): + """ + Loop over the tasks to execute + """ + try: + self.loop() + except Exception: + pass + + def loop(self): + """ + Obtain tasks from :py:attr:`waflib.Runner.TaskConsumer.ready` and call + :py:meth:`waflib.Task.TaskBase.process`. If the object is a function, execute it. + """ + master = self.spawner.master + while 1: + if not master.stop: + try: + tsk = master.ready.get() + if tsk: + tsk.log_display(tsk.generator.bld) + master.process_task(tsk) + else: + break + finally: + master.out.put(tsk) + +class Spawner(object): + """ + Daemon thread that consumes tasks from :py:class:`waflib.Runner.Parallel` producer and + spawns a consuming thread :py:class:`waflib.Runner.Consumer` for each + :py:class:`waflib.Task.Task` instance. + """ + def __init__(self, master): + self.master = master + """:py:class:`waflib.Runner.Parallel` producer instance""" + + self.pool = TaskConsumer(self) for i in range(master.numjobs) + +Runner.Spawner = Spawner
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/color_gcc.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/color_gcc.py
Changed
@@ -19,7 +19,7 @@ func = frame.f_code.co_name if func == 'exec_command': cmd = frame.f_locals.get('cmd') - if isinstance(cmd, list) and ('gcc' in cmd0 or 'g++' in cmd0): + if isinstance(cmd, list) and (len(cmd) > 0) and ('gcc' in cmd0 or 'g++' in cmd0): lines = for line in rec.msg.splitlines(): if 'warning: ' in line:
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/eclipse.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/eclipse.py
Changed
@@ -10,6 +10,9 @@ def options(opt): opt.load('eclipse') +To add additional targets beside standard ones (configure, dist, install, check) +the environment ECLIPSE_EXTRA_TARGETS can be set (ie. to 'test', 'lint', 'docs') + $ waf configure eclipse """ @@ -25,6 +28,8 @@ cdt_bld = oe_cdt + '.build.core' extbuilder_dir = '.externalToolBuilders' extbuilder_name = 'Waf_Builder.launch' +settings_dir = '.settings' +settings_name = 'language.settings.xml' class eclipse(Build.BuildContext): cmd = 'eclipse' @@ -131,9 +136,11 @@ path = p.path_from(self.srcnode) if (path.startswith("/")): - cpppath.append(path) + if path not in cpppath: + cpppath.append(path) else: - workspace_includes.append(path) + if path not in workspace_includes: + workspace_includes.append(path) if is_cc and path not in source_dirs: source_dirs.append(path) @@ -156,6 +163,61 @@ project = self.impl_create_javaproject(javasrcpath, javalibpath) self.write_conf_to_xml('.classpath', project) + # Create editor language settings to have correct standards applied in IDE, as per project configuration + try: + os.mkdir(settings_dir) + except OSError: + pass # Ignore if dir already exists + + lang_settings = Document() + project = lang_settings.createElement('project') + + # Language configurations for C and C++ via cdt + if hasc: + configuration = self.add(lang_settings, project, 'configuration', + {'id' : 'org.eclipse.cdt.core.default.config.1', 'name': 'Default'}) + + extension = self.add(lang_settings, configuration, 'extension', {'point': 'org.eclipse.cdt.core.LanguageSettingsProvider'}) + + provider = self.add(lang_settings, extension, 'provider', + { 'copy-of': 'extension', + 'id': 'org.eclipse.cdt.ui.UserLanguageSettingsProvider'}) + + provider = self.add(lang_settings, extension, 'provider-reference', + { 'id': 'org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider', + 'ref': 'shared-provider'}) + + provider = self.add(lang_settings, extension, 'provider-reference', + { 'id': 'org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider', + 'ref': 'shared-provider'}) + + # C and C++ are kept as separated providers so appropriate flags are used also in mixed projects + if self.env.CC: + provider = self.add(lang_settings, extension, 'provider', + { 'class': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector', + 'console': 'false', + 'id': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector.1', + 'keep-relative-paths' : 'false', + 'name': 'CDT GCC Built-in Compiler Settings', + 'parameter': '%s %s ${FLAGS} -E -P -v -dD "${INPUTS}"'%(self.env.CC0,' '.join(self.env'CFLAGS')), + 'prefer-non-shared': 'true' }) + + self.add(lang_settings, provider, 'language-scope', { 'id': 'org.eclipse.cdt.core.gcc'}) + + if self.env.CXX: + provider = self.add(lang_settings, extension, 'provider', + { 'class': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector', + 'console': 'false', + 'id': 'org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector.2', + 'keep-relative-paths' : 'false', + 'name': 'CDT GCC Built-in Compiler Settings', + 'parameter': '%s %s ${FLAGS} -E -P -v -dD "${INPUTS}"'%(self.env.CXX0,' '.join(self.env'CXXFLAGS')), + 'prefer-non-shared': 'true' }) + self.add(lang_settings, provider, 'language-scope', { 'id': 'org.eclipse.cdt.core.g++'}) + + lang_settings.appendChild(project) + self.write_conf_to_xml('%s%s%s'%(settings_dir, os.path.sep, settings_name), lang_settings) + def impl_create_project(self, executable, appname, hasc, hasjava, haspython, waf_executable): doc = Document() projectDescription = doc.createElement('projectDescription') @@ -341,6 +403,8 @@ addTargetWrap('dist', False) addTargetWrap('install', False) addTargetWrap('check', False) + for addTgt in self.env.ECLIPSE_EXTRA_TARGETS or : + addTargetWrap(addTgt, False) storageModule = self.add(doc, cproject, 'storageModule', {'moduleId': 'cdtBuildSystem', @@ -348,6 +412,12 @@ self.add(doc, storageModule, 'project', {'id': '%s.null.1'%appname, 'name': appname}) + storageModule = self.add(doc, cproject, 'storageModule', + {'moduleId': 'org.eclipse.cdt.core.LanguageSettingsProviders'}) + + storageModule = self.add(doc, cproject, 'storageModule', + {'moduleId': 'scannerConfiguration'}) + doc.appendChild(cproject) return doc
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/gccdeps.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/gccdeps.py
Changed
@@ -29,13 +29,6 @@ # Third-party tools are allowed to add extra names in here with append() supported_compilers = 'gas', 'gcc', 'icc', 'clang' -def scan(self): - if not self.__class__.__name__ in self.env.ENABLE_GCCDEPS: - return super(self.derived_gccdeps, self).scan() - nodes = self.generator.bld.node_deps.get(self.uid(), ) - names = - return (nodes, names) - re_o = re.compile(r"\.o$") re_splitter = re.compile(r'(?<!\\)\s+') # split by space, except when spaces are escaped @@ -61,28 +54,30 @@ else: # Not hashable, assume it is a list and join into a string node_lookup_key = (base_node, os.path.sep.join(path)) + try: - lock.acquire() node = cached_nodesnode_lookup_key except KeyError: - node = base_node.find_resource(path) - cached_nodesnode_lookup_key = node - finally: - lock.release() + # retry with lock on cache miss + with lock: + try: + node = cached_nodesnode_lookup_key + except KeyError: + node = cached_nodesnode_lookup_key = base_node.find_resource(path) + return node def post_run(self): if not self.__class__.__name__ in self.env.ENABLE_GCCDEPS: return super(self.derived_gccdeps, self).post_run() - name = self.outputs0.abspath() - name = re_o.sub('.d', name) + deps_filename = self.outputs0.abspath() + deps_filename = re_o.sub('.d', deps_filename) try: - txt = Utils.readf(name) + deps_txt = Utils.readf(deps_filename) except EnvironmentError: Logs.error('Could not find a .d dependency file, are cflags/cxxflags overwritten?') raise - #os.remove(name) # Compilers have the choice to either output the file's dependencies # as one large Makefile rule: @@ -102,15 +97,16 @@ # So the first step is to sanitize the input by stripping out the left- # hand side of all these lines. After that, whatever remains are the # implicit dependencies of task.outputs0 - txt = '\n'.join(remove_makefile_rule_lhs(line) for line in txt.splitlines()) + deps_txt = '\n'.join(remove_makefile_rule_lhs(line) for line in deps_txt.splitlines()) # Now join all the lines together - txt = txt.replace('\\\n', '') + deps_txt = deps_txt.replace('\\\n', '') - val = txt.strip() - val = x.replace('\\ ', ' ') for x in re_splitter.split(val) if x + dep_paths = deps_txt.strip() + dep_paths = x.replace('\\ ', ' ') for x in re_splitter.split(dep_paths) if x - nodes = + resolved_nodes = + unresolved_names = bld = self.generator.bld # Dynamically bind to the cache @@ -119,39 +115,41 @@ except AttributeError: cached_nodes = bld.cached_nodes = {} - for x in val: + for path in dep_paths: node = None - if os.path.isabs(x): - node = path_to_node(bld.root, x, cached_nodes) + if os.path.isabs(path): + node = path_to_node(bld.root, path, cached_nodes) else: # TODO waf 1.9 - single cwd value - path = getattr(bld, 'cwdx', bld.bldnode) + base_node = getattr(bld, 'cwdx', bld.bldnode) # when calling find_resource, make sure the path does not contain '..' - x = k for k in Utils.split_path(x) if k and k != '.' - while '..' in x: - idx = x.index('..') + path = k for k in Utils.split_path(path) if k and k != '.' + while '..' in path: + idx = path.index('..') if idx == 0: - x = x1: - path = path.parent + path = path1: + base_node = base_node.parent else: - del xidx - del xidx-1 + del pathidx + del pathidx-1 - node = path_to_node(path, x, cached_nodes) + node = path_to_node(base_node, path, cached_nodes) if not node: - raise ValueError('could not find %r for %r' % (x, self)) + raise ValueError('could not find %r for %r' % (path, self)) + if id(node) == id(self.inputs0): # ignore the source file, it is already in the dependencies # this way, successful config tests may be retrieved from the cache continue - nodes.append(node) - Logs.debug('deps: gccdeps for %s returned %s', self, nodes) + resolved_nodes.append(node) - bld.node_depsself.uid() = nodes - bld.raw_depsself.uid() = + Logs.debug('deps: gccdeps for %s returned %s', self, resolved_nodes) + + bld.node_depsself.uid() = resolved_nodes + bld.raw_depsself.uid() = unresolved_names try: del self.cache_sig @@ -160,6 +158,14 @@ Task.Task.post_run(self) +def scan(self): + if not self.__class__.__name__ in self.env.ENABLE_GCCDEPS: + return super(self.derived_gccdeps, self).scan() + + resolved_nodes = self.generator.bld.node_deps.get(self.uid(), ) + unresolved_names = + return (resolved_nodes, unresolved_names) + def sig_implicit_deps(self): if not self.__class__.__name__ in self.env.ENABLE_GCCDEPS: return super(self.derived_gccdeps, self).sig_implicit_deps()
View file
_service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/haxe.py
Added
@@ -0,0 +1,131 @@ +import os, re +from waflib import Utils, Task, Errors +from waflib.TaskGen import extension, taskgen_method, feature +from waflib.Configure import conf + +@conf +def libname_haxe(self, libname): + return libname + +@conf +def check_lib_haxe(self, libname, uselib_store=None): + haxe_libs = node.name for node in self.root.find_node('haxe_libraries').ant_glob() + changed = False + self.start_msg('Checking for library %s' % libname) + if libname + '.hxml' in haxe_libs: + self.end_msg('yes') + else: + changed = True + try: + cmd = self.env.LIX + '+lib', libname + res = self.cmd_and_log(cmd) + if (res): + raise Errors.WafError(res) + else: + self.end_msg('downloaded', color = 'YELLOW') + except Errors.WafError as e: + self.end_msg('no', color = 'RED') + self.fatal('Getting %s has failed' % libname) + + postfix = uselib_store if uselib_store else libname.upper() + self.env'LIB_' + postfix += self.libname_haxe(libname) + return changed + +@conf +def check_libs_haxe(self, libnames, uselib_store=None): + changed = False + for libname in Utils.to_list(libnames): + if self.check_lib_haxe(libname, uselib_store): + changed = True + return changed + +@conf +def ensure_lix_pkg(self, *k, **kw): + if kw.get('compiler') == 'hx': + if isinstance(kw.get('libs'), list) and len(kw.get('libs')): + changed = self.check_libs_haxe(kw.get('libs'), kw.get('uselib_store')) + if changed: + try: + cmd = self.env.LIX + 'download' + res = self.cmd_and_log(cmd) + if (res): + raise Errors.WafError(res) + except Errors.WafError as e: + self.fatal('lix download has failed') + else: + self.check_lib_haxe(kw.get('lib'), kw.get('uselib_store')) + +@conf +def haxe(bld, *k, **kw): + task_gen = bld(*k, **kw) + +class haxe(Task.Task): + vars = 'HAXE', 'HAXE_VERSION', 'HAXEFLAGS' + ext_out = '.hl', '.c', '.h' + + def run(self): + cmd = self.env.HAXE + self.env.HAXEFLAGS + return self.exec_command(cmd, stdout = open(os.devnull, 'w')) + +@taskgen_method +def init_haxe_task(self, node): + def addflags(flags): + self.env.append_value('HAXEFLAGS', flags) + + if node.suffix() == '.hxml': + addflags(self.path.abspath() + '/' + node.name) + else: + addflags('-main', node.name) + addflags('-hl', self.path.get_bld().make_node(self.target).abspath()) + addflags('-cp', self.path.abspath()) + addflags('-D', 'resourcesPath=%s' % getattr(self, 'res', '')) + if hasattr(self, 'use'): + for dep in self.use: + if self.env'LIB_' + dep: + for lib in self.env'LIB_' + dep: addflags('-lib', lib) + +@extension('.hx', '.hxml') +def haxe_file(self, node): + if len(self.source) > 1: + self.bld.fatal('Use separate task generators for multiple files') + + try: + haxetask = self.haxetask + except AttributeError: + haxetask = self.haxetask = self.create_task('haxe') + self.init_haxe_task(node) + + haxetask.inputs.append(node) + haxetask.outputs.append(self.path.get_bld().make_node(self.target)) + +@conf +def find_haxe(self, min_version): + npx = self.env.NPX = self.find_program('npx') + self.env.LIX = npx + 'lix' + npx_haxe = self.env.HAXE = npx + 'haxe' + try: + output = self.cmd_and_log(npx_haxe + '-version') + except Errors.WafError: + haxe_version = None + else: + ver = re.search(r'\d+.\d+.\d+', output).group().split('.') + haxe_version = tuple(int(x) for x in ver) + + self.msg('Checking for haxe version', + haxe_version, haxe_version and haxe_version >= min_version) + if npx_haxe and haxe_version < min_version: + self.fatal('haxe version %r is too old, need >= %r' % (haxe_version, min_version)) + + self.env.HAXE_VERSION = haxe_version + return npx_haxe + +@conf +def check_haxe(self, min_version=(4,1,4)): + if self.env.HAXE_MINVER: + min_version = self.env.HAXE_MINVER + find_haxe(self, min_version) + +def configure(self): + self.env.HAXEFLAGS = + self.check_haxe() + self.add_os_flags('HAXEFLAGS', dup = False)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/msvcdeps.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/msvcdeps.py
Changed
@@ -32,7 +32,6 @@ from waflib.TaskGen import feature, before_method lock = threading.Lock() -nodes = {} # Cache the path -> Node lookup PREPROCESSOR_FLAG = '/showIncludes' INCLUDE_PATTERN = 'Note: including file:' @@ -50,23 +49,47 @@ if taskgen.env.get_flat(flag).find(PREPROCESSOR_FLAG) < 0: taskgen.env.append_value(flag, PREPROCESSOR_FLAG) + +def get_correct_path_case(base_path, path): + ''' + Return a case-corrected version of ``path`` by searching the filesystem for + ``path``, relative to ``base_path``, using the case returned by the filesystem. + ''' + components = Utils.split_path(path) + + corrected_path = '' + if os.path.isabs(path): + corrected_path = components.pop(0).upper() + os.sep + + for part in components: + part = part.lower() + search_path = os.path.join(base_path, corrected_path) + if part == '..': + corrected_path = os.path.join(corrected_path, part) + search_path = os.path.normpath(search_path) + continue + + for item in sorted(os.listdir(search_path)): + if item.lower() == part: + corrected_path = os.path.join(corrected_path, item) + break + else: + raise ValueError("Can't find %r in %r" % (part, search_path)) + + return corrected_path + + def path_to_node(base_node, path, cached_nodes): ''' Take the base node and the path and return a node Results are cached because searching the node tree is expensive The following code is executed by threads, it is not safe, so a lock is needed... ''' - # normalize the path because ant_glob() does not understand - # parent path components (..) + # normalize the path to remove parent path components (..) path = os.path.normpath(path) # normalize the path case to increase likelihood of a cache hit - path = os.path.normcase(path) - - # ant_glob interprets and () characters, so those must be replaced - path = path.replace('', '?').replace('', '?').replace('(', '(').replace(')', ')') - - node_lookup_key = (base_node, path) + node_lookup_key = (base_node, os.path.normcase(path)) try: node = cached_nodesnode_lookup_key @@ -76,8 +99,8 @@ try: node = cached_nodesnode_lookup_key except KeyError: - node_list = base_node.ant_glob(path, ignorecase=True, remove=False, quiet=True, regex=False) - node = cached_nodesnode_lookup_key = node_list0 if node_list else None + path = get_correct_path_case(base_node.abspath(), path) + node = cached_nodesnode_lookup_key = base_node.find_node(path) return node @@ -89,9 +112,9 @@ if getattr(self, 'cached', None): return Task.Task.post_run(self) - bld = self.generator.bld - unresolved_names = resolved_nodes = + unresolved_names = + bld = self.generator.bld # Dynamically bind to the cache try: @@ -124,11 +147,14 @@ continue if id(node) == id(self.inputs0): - # Self-dependency + # ignore the source file, it is already in the dependencies + # this way, successful config tests may be retrieved from the cache continue resolved_nodes.append(node) + Logs.debug('deps: msvcdeps for %s returned %s', self, resolved_nodes) + bld.node_depsself.uid() = resolved_nodes bld.raw_depsself.uid() = unresolved_names
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/msvs.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/msvs.py
Changed
@@ -787,8 +787,12 @@ self.collect_dirs() default_project = getattr(self, 'default_project', None) def sortfun(x): - if x.name == default_project: + # folders should sort to the top + if getattr(x, 'VS_GUID_SOLUTIONFOLDER', None): return '' + # followed by the default project + elif x.name == default_project: + return ' ' return getattr(x, 'path', None) and x.path.win32path() or x.name self.all_projects.sort(key=sortfun)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/swig.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/swig.py
Changed
@@ -17,7 +17,7 @@ SWIG_EXTS = '.swig', '.i' -re_module = re.compile(r'%module(?:\s*\(.*\))?\s+(.+)', re.M) +re_module = re.compile(r'%module(?:\s*\(.*\))?\s+(^\r\n+)', re.M) re_1 = re.compile(r'^%module.*?\s+(\w+)\s*?$', re.M) re_2 = re.compile(r'#%(?:include|import(?:\(module=".*"\))+|python(?:begin|code)) <"(.*)">', re.M)
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/extras/wafcache.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/extras/wafcache.py
Changed
@@ -31,6 +31,7 @@ gsutil cp gs://mybucket/bb/bbbbb/2 build/somefile * WAFCACHE_NO_PUSH: if set, disables pushing to the cache * WAFCACHE_VERBOSITY: if set, displays more detailed cache operations +* WAFCACHE_STATS: if set, displays cache usage statistics on exit File cache specific options: Files are copied using hard links by default; if the cache is located @@ -69,6 +70,7 @@ EVICT_MAX_BYTES = int(os.environ.get('WAFCACHE_EVICT_MAX_BYTES', 10**10)) 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 OK = "ok" re_waf_cmd = re.compile('(?P<src>%{SRC})|(?P<tgt>%{TGT})') @@ -93,6 +95,9 @@ sig = self.signature() ssig = Utils.to_hex(self.uid() + sig) + if WAFCACHE_STATS: + self.generator.bld.cache_reqs += 1 + files_to = node.abspath() for node in self.outputs err = cache_command(ssig, , files_to) if err.startswith(OK): @@ -100,6 +105,8 @@ Logs.pprint('CYAN', ' Fetched %r from cache' % files_to) else: Logs.debug('wafcache: fetched %r from cache', files_to) + if WAFCACHE_STATS: + self.generator.bld.cache_hits += 1 else: if WAFCACHE_VERBOSITY: Logs.pprint('YELLOW', ' No cache entry %s' % files_to) @@ -117,11 +124,17 @@ if WAFCACHE_NO_PUSH or getattr(self, 'cached', None) or not self.outputs: return + files_from = + for node in self.outputs: + path = node.abspath() + if not os.path.isfile(path): + return + files_from.append(path) + bld = self.generator.bld sig = self.signature() ssig = Utils.to_hex(self.uid() + sig) - files_from = node.abspath() for node in self.outputs err = cache_command(ssig, files_from, ) if err.startswith(OK): @@ -129,6 +142,8 @@ Logs.pprint('CYAN', ' Successfully uploaded %s to cache' % files_from) else: Logs.debug('wafcache: Successfully uploaded %r to cache', files_from) + if WAFCACHE_STATS: + self.generator.bld.cache_puts += 1 else: if WAFCACHE_VERBOSITY: Logs.pprint('RED', ' Error caching step results %s: %s' % (files_from, err)) @@ -193,6 +208,10 @@ if getattr(cls, 'nocache', None) or getattr(cls, 'has_cache', False): return + full_name = "%s.%s" % (cls.__module__, cls.__name__) + if full_name in ('waflib.Tools.ccroot.vnum', 'waflib.Build.inst'): + return + m1 = getattr(cls, 'run', None) def run(self): if getattr(self, 'nocache', False): @@ -208,9 +227,6 @@ return m2(self) ret = m2(self) self.put_files_cache() - if hasattr(self, 'chmod'): - for node in self.outputs: - os.chmod(node.abspath(), self.chmod) return ret cls.post_run = post_run cls.has_cache = True @@ -242,6 +258,19 @@ """ Called during the build process to enable file caching """ + 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 + + def printstats(bld): + 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' % + (bld.cache_reqs, bld.cache_hits, hit_ratio, bld.cache_puts) ) + + bld.add_post_fun(printstats) + if process_pool: # already called once return @@ -320,7 +349,10 @@ size = 0 for fname in os.listdir(path): - size += os.lstat(os.path.join(path, fname)).st_size + try: + size += os.lstat(os.path.join(path, fname)).st_size + except OSError: + pass lst.append((os.stat(path).st_mtime, size, path)) lst.sort(key=lambda x: x0) @@ -331,7 +363,7 @@ _, tmp_size, path = lst.pop() tot -= tmp_size - tmp = path + '.tmp' + tmp = path + '.remove' try: shutil.rmtree(tmp) except OSError: @@ -339,12 +371,12 @@ try: os.rename(path, tmp) except OSError: - sys.stderr.write('Could not rename %r to %r' % (path, tmp)) + sys.stderr.write('Could not rename %r to %r\n' % (path, tmp)) else: try: shutil.rmtree(tmp) except OSError: - sys.stderr.write('Could not remove %r' % tmp) + sys.stderr.write('Could not remove %r\n' % tmp) sys.stderr.write("Cache trimmed: %r bytes in %r folders left\n" % (tot, len(lst))) @@ -371,8 +403,8 @@ try: fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB) except EnvironmentError: - sys.stderr.write('another process is running!\n') - pass + if WAFCACHE_VERBOSITY: + sys.stderr.write('wafcache: another cleaning process is running\n') else: # now dow the actual cleanup lru_trim() @@ -443,7 +475,10 @@ else: # attempt trimming if caching was successful: # we may have things to trim! - lru_evict() + try: + lru_evict() + except Exception: + return traceback.format_exc() return OK def copy_from_cache(self, sig, files_from, files_to): @@ -481,7 +516,7 @@ out, err = proc.communicate() if proc.returncode: raise OSError('Error copy %r to %r using: %r (exit %r):\n out:%s\n err:%s' % ( - source, target, cmd, proc.returncode, out.decode(), err.decode())) + source, target, cmd, proc.returncode, out.decode(errors='replace'), err.decode(errors='replace'))) def copy_to_cache(self, sig, files_from, files_to): try:
View file
_service:tar_scm:ldb-2.4.1.tar.gz/third_party/waf/waflib/fixpy2.py -> _service:tar_scm:ldb-2.6.1.tar.gz/third_party/waf/waflib/fixpy2.py
Changed
@@ -56,7 +56,7 @@ @subst('Runner.py') def r4(code): "generator syntax" - return code.replace('next(self.biter)', 'self.biter.next()') + return code.replace('next(self.biter)', 'self.biter.next()').replace('self.daemon = True', 'self.setDaemon(1)') @subst('Context.py') def r5(code):
View file
_service:tar_scm:ldb-2.4.1.tar.gz/wscript -> _service:tar_scm:ldb-2.6.1.tar.gz/wscript
Changed
@@ -1,8 +1,8 @@ #!/usr/bin/env python APPNAME = 'ldb' -# For Samba 4.15.x -VERSION = '2.4.1' +# For Samba 4.17.x +VERSION = '2.6.1' import sys, os
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