1 Star 0 Fork 49

sun_hai/samba

forked from src-openEuler/samba 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-0015-CVE-2023-0614.patch 39.56 KB
一键复制 编辑 原始数据 按行查看 历史
xh 提交于 2023-04-01 06:13 . fix CVE-2023-0225 CVE-2023-0614 CVE-2023-0922
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
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
---
lib/ldb/common/ldb_pack.c | 129 +---
lib/ldb/include/ldb_module.h | 11 +-
.../tests/ldb_filter_attrs_in_place_test.c | 609 ++++++++----------
3 files changed, 307 insertions(+), 442 deletions(-)
diff --git a/lib/ldb/common/ldb_pack.c b/lib/ldb/common/ldb_pack.c
index f19ac73fa5e..28b9a8dfe07 100644
--- a/lib/ldb/common/ldb_pack.c
+++ b/lib/ldb/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(attrs[i], "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->elements[i];
-
- /*
- * 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; attrs[j]; j++) {
- int cmp = ldb_attr_cmp(el->name, attrs[j]);
+ int cmp = ldb_attr_cmp(msg->elements[i].name, attrs[j]);
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->elements[num_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->elements[i - num_del] = msg->elements[i];
}
- for (j=0;j<el->num_values;j++) {
- el2->values[j] = ldb_val_dup(el2->values, &el->values[j]);
- if (el2->values[j].data == NULL && el->values[j].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/lib/ldb/include/ldb_module.h b/lib/ldb/include/ldb_module.h
index 105093cf38c..4ae381ba5be 100644
--- a/lib/ldb/include/ldb_module.h
+++ b/lib/ldb/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/lib/ldb/tests/ldb_filter_attrs_in_place_test.c b/lib/ldb/tests/ldb_filter_attrs_in_place_test.c
index bef961f8f9c..da333c73c99 100644
--- a/lib/ldb/tests/ldb_filter_attrs_in_place_test.c
+++ b/lib/ldb/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->elements[0]));
+ 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->elements[0].name, "foo");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_int_equal(filtered_msg->elements[0].values[0].length,
+ assert_non_null(msg->dn);
+ assert_int_equal(msg->num_elements, 1);
+ assert_string_equal(msg->elements[0].name, "foo");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
strlen(value));
- assert_memory_equal(filtered_msg->elements[0].values[0].data,
+ assert_memory_equal(msg->elements[0].values[0].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->elements[0].name, "foo");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_int_equal(filtered_msg->elements[0].values[0].length,
+ assert_non_null(msg->dn);
+ assert_int_equal(msg->num_elements, 1);
+ assert_string_equal(msg->elements[0].name, "foo");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
strlen(value));
- assert_memory_equal(filtered_msg->elements[0].values[0].data,
+ assert_memory_equal(msg->elements[0].values[0].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->elements[0].name, "foo");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_int_equal(filtered_msg->elements[0].values[0].length,
+ assert_string_equal(msg->elements[0].name, "foo");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
strlen(value1));
- assert_memory_equal(filtered_msg->elements[0].values[0].data,
+ assert_memory_equal(msg->elements[0].values[0].data,
value1, strlen(value1));
- assert_string_equal(filtered_msg->elements[1].name, "bar");
- assert_int_equal(filtered_msg->elements[1].num_values, 1);
- assert_int_equal(filtered_msg->elements[1].values[0].length,
+ assert_string_equal(msg->elements[1].name, "bar");
+ assert_int_equal(msg->elements[1].num_values, 1);
+ assert_int_equal(msg->elements[1].values[0].length,
strlen(value2));
- assert_memory_equal(filtered_msg->elements[1].values[0].data,
+ assert_memory_equal(msg->elements[1].values[0].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->elements[0].name, "bar");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_int_equal(filtered_msg->elements[0].values[0].length,
+ assert_string_equal(msg->elements[0].name, "bar");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
strlen(value2));
- assert_memory_equal(filtered_msg->elements[0].values[0].data,
+ assert_memory_equal(msg->elements[0].values[0].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->elements[0].name, "bar");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
+ strlen(value1));
+ assert_memory_equal(msg->elements[0].values[0].data,
+ value1, strlen(value1));
+
+ assert_string_equal(msg->elements[1].name, "bar");
+ assert_int_equal(msg->elements[1].num_values, 1);
+ assert_int_equal(msg->elements[1].values[0].length,
+ strlen(value2));
+ assert_memory_equal(msg->elements[1].values[0].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->elements[0].name, "bar");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_int_equal(filtered_msg->elements[0].values[0].length,
+ assert_string_equal(msg->elements[0].name, "bar");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
strlen(value1));
- assert_memory_equal(filtered_msg->elements[0].values[0].data,
+ assert_memory_equal(msg->elements[0].values[0].data,
value1, strlen(value1));
- assert_string_equal(filtered_msg->elements[1].name, "bar");
- assert_int_equal(filtered_msg->elements[1].num_values, 1);
- assert_int_equal(filtered_msg->elements[1].values[0].length,
+ assert_string_equal(msg->elements[1].name, "bar");
+ assert_int_equal(msg->elements[1].num_values, 1);
+ assert_int_equal(msg->elements[1].values[0].length,
strlen(value2));
- assert_memory_equal(filtered_msg->elements[1].values[0].data,
+ assert_memory_equal(msg->elements[1].values[0].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->elements[0].name, "bar");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_int_equal(filtered_msg->elements[0].values[0].length,
+ assert_string_equal(msg->elements[0].name, "bar");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
strlen(value1));
- assert_memory_equal(filtered_msg->elements[0].values[0].data,
+ assert_memory_equal(msg->elements[0].values[0].data,
value1, strlen(value1));
- assert_string_equal(filtered_msg->elements[1].name, "bar");
- assert_int_equal(filtered_msg->elements[1].num_values, 1);
- assert_int_equal(filtered_msg->elements[1].values[0].length,
+ assert_string_equal(msg->elements[1].name, "bar");
+ assert_int_equal(msg->elements[1].num_values, 1);
+ assert_int_equal(msg->elements[1].values[0].length,
strlen(value2));
- assert_memory_equal(filtered_msg->elements[1].values[0].data,
+ assert_memory_equal(msg->elements[1].values[0].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->elements[0].name, "bar");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_int_equal(filtered_msg->elements[0].values[0].length,
+ assert_string_equal(msg->elements[0].name, "bar");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_int_equal(msg->elements[0].values[0].length,
strlen(value1));
- assert_memory_equal(filtered_msg->elements[0].values[0].data,
+ assert_memory_equal(msg->elements[0].values[0].data,
value1, strlen(value1));
- assert_string_equal(filtered_msg->elements[1].name, "bar");
- assert_int_equal(filtered_msg->elements[1].num_values, 1);
- assert_int_equal(filtered_msg->elements[1].values[0].length,
+ assert_string_equal(msg->elements[1].name, "bar");
+ assert_int_equal(msg->elements[1].num_values, 1);
+ assert_int_equal(msg->elements[1].values[0].length,
strlen(value2));
- assert_memory_equal(filtered_msg->elements[1].values[0].data,
+ assert_memory_equal(msg->elements[1].values[0].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->elements[0].name, "distinguishedName");
- assert_int_equal(filtered_msg->elements[0].num_values, 1);
- assert_string_equal(filtered_msg->elements[0].values[0].data,
- ldb_dn_get_linearized(in.dn));
+ assert_int_equal(msg->num_elements, 1);
+
+ assert_non_null(msg->dn);
+ assert_string_equal(msg->elements[0].name, "distinguishedName");
+ assert_int_equal(msg->elements[0].num_values, 1);
+ assert_string_equal(msg->elements[0].values[0].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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sun_hai_10/samba.git
git@gitee.com:sun_hai_10/samba.git
sun_hai_10
samba
samba
master

搜索帮助