[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Wed Apr 19 17:44:02 UTC 2017
The branch, master has been updated
via 9f7ed6b autobuild: Do not require cmocka to be installed for samba-libs to build
via 3d049f2 ldb:tests: Unit test the ldb_rename() operation
via a05fda2 ldb:tests: Add tests for case insensitive searches
via f44c082 ldb:tests: unit test for ldb_search()
via 68a0033 ldb:tests: Add a modify test
via 5113116 ldb:tests: Add a test for ldb transactions
via dddac9f ldb:tests: Add a basic delete test
via b423c3e ldb:tests: Add a basic search test
via dbe1dd5 ldb:tests: A rudimentary ldb_add() test
via b49ee16 ldb:tests: Build a ldb test for the tdb backend
via 15ad5de ldb:tests: Add a simple cmocka test for ldb_connect()
via 317f3c6 ldb: Clarify LDB_MODULES_PATH is used
via 1a90b55 ldb_tdb: Remove unused function parameter
via 1c7c4b4 ldb_tdb: Remove unused function parameter
via 9d4168e ldb_tdb: Remove unused function ltdb_add_attr_results
from d58481b s3-tests: assignement in shell shall have no spaces around equal sign
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9f7ed6b82c68592dc32590dea3a0752ce6e69896
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed Apr 19 22:44:24 2017 +1200
autobuild: Do not require cmocka to be installed for samba-libs to build
cmocka does not have an install target, but is a depencency of ldb for the tests
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Wed Apr 19 19:43:15 CEST 2017 on sn-devel-144
commit 3d049f2aadf88e969f905c50f8f62ca01f502822
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Wed Oct 7 18:07:13 2015 +0200
ldb:tests: Unit test the ldb_rename() operation
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit a05fda2f3f6e2506a400b3516371c634399c27dd
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Tue Nov 24 20:12:43 2015 +0100
ldb:tests: Add tests for case insensitive searches
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit f44c0827eb984c5edb175438dfd35fb60ffdc3f3
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Thu May 14 22:49:00 2015 +0200
ldb:tests: unit test for ldb_search()
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit 68a00330af394eb66eefffa6839d2046bae3bcf8
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Sat Oct 3 20:43:45 2015 +0200
ldb:tests: Add a modify test
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit 5113116a8359c4f79d6925b36f046289390b69d5
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Fri Sep 25 07:02:12 2015 +0200
ldb:tests: Add a test for ldb transactions
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit dddac9fc3c640500a54ea463a2c6ca5e81bae731
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Tue Jan 20 12:11:34 2015 +0100
ldb:tests: Add a basic delete test
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit b423c3e8d5f7defe015d95ed1e792b5c44116615
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Sat May 2 15:01:13 2015 +0200
ldb:tests: Add a basic search test
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit dbe1dd5fab98d84b79439b713544d756eadf50de
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Tue Sep 15 22:39:08 2015 +0200
ldb:tests: A rudimentary ldb_add() test
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit b49ee16b9cdb1e8b80d0027996733d20745bc754
Author: Andreas Schneider <asn at samba.org>
Date: Fri Oct 2 11:36:50 2015 +0200
ldb:tests: Build a ldb test for the tdb backend
Pair-Programmed-With: Andrew Bartlet <abartlet at samba.org>
Signed-off-by: Andreas Schneider <asn at samba.org>
Signed-off-by: Andrew Bartlet <abartlet at samba.org>
commit 15ad5de6aa72955042ff43548448c7a9e0c5d373
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Sat Jan 17 18:06:09 2015 +0100
ldb:tests: Add a simple cmocka test for ldb_connect()
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit 317f3c6f3d3a39e778b2f8f832c8fb3b7be2f841
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Fri Jan 16 18:52:48 2015 +0100
ldb: Clarify LDB_MODULES_PATH is used
Make it (hopefully more) clear where modules are loaded from.
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit 1a90b55da6477ad594d3ae9d378b1ec5f6b64ed3
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Mon Feb 2 15:48:47 2015 +0100
ldb_tdb: Remove unused function parameter
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit 1c7c4b474c601bf419b17af49ac4d7ef22444ea4
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Mon Feb 2 15:33:24 2015 +0100
ldb_tdb: Remove unused function parameter
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
commit 9d4168e745884bcfd05f828895b44669f9351738
Author: Jakub Hrozek <jakub.hrozek at posteo.se>
Date: Mon May 11 22:24:01 2015 +0200
ldb_tdb: Remove unused function ltdb_add_attr_results
Signed-off-by: Jakub Hrozek <jakub.hrozek at posteo.se>
Reviewed-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Andrew Bartlet <abartlet at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/ldb/include/ldb.h | 4 +
lib/ldb/ldb_tdb/ldb_search.c | 134 ----
lib/ldb/ldb_tdb/ldb_tdb.c | 14 +-
lib/ldb/ldb_tdb/ldb_tdb.h | 6 -
lib/ldb/tests/ldb_mod_op_test.c | 1540 +++++++++++++++++++++++++++++++++++++++
lib/ldb/wscript | 25 +-
script/autobuild.py | 2 +-
7 files changed, 1575 insertions(+), 150 deletions(-)
create mode 100644 lib/ldb/tests/ldb_mod_op_test.c
Changeset truncated at 500 lines:
diff --git a/lib/ldb/include/ldb.h b/lib/ldb/include/ldb.h
index afcf9eb..1160a48 100644
--- a/lib/ldb/include/ldb.h
+++ b/lib/ldb/include/ldb.h
@@ -1056,6 +1056,10 @@ int ldb_global_init(void);
\param mem_ctx pointer to a talloc memory context. Pass NULL if there is
no suitable context available.
+ \note The LDB modules will be loaded from directory specified by the environment
+ variable LDB_MODULES_PATH. If the variable is not specified, the compiled-in default
+ is used.
+
\return pointer to ldb_context that should be free'd (using talloc_free())
at the end of the program.
*/
diff --git a/lib/ldb/ldb_tdb/ldb_search.c b/lib/ldb/ldb_tdb/ldb_search.c
index 373855f..53355e0 100644
--- a/lib/ldb/ldb_tdb/ldb_search.c
+++ b/lib/ldb/ldb_tdb/ldb_search.c
@@ -109,102 +109,6 @@ static int msg_add_distinguished_name(struct ldb_message *msg)
}
/*
- add all elements from one message into another
- */
-static int msg_add_all_elements(struct ldb_module *module, struct ldb_message *ret,
- const struct ldb_message *msg)
-{
- struct ldb_context *ldb;
- unsigned int i;
- int check_duplicates = (ret->num_elements != 0);
-
- ldb = ldb_module_get_ctx(module);
-
- if (msg_add_distinguished_name(ret) != 0) {
- return -1;
- }
-
- for (i=0;i<msg->num_elements;i++) {
- const struct ldb_schema_attribute *a;
- a = ldb_schema_attribute_by_name(ldb, msg->elements[i].name);
- if (a->flags & LDB_ATTR_FLAG_HIDDEN) {
- continue;
- }
- if (msg_add_element(ret, &msg->elements[i],
- check_duplicates) != 0) {
- return -1;
- }
- }
-
- return 0;
-}
-
-
-/*
- pull the specified list of attributes from a message
- */
-static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module,
- TALLOC_CTX *mem_ctx,
- const struct ldb_message *msg,
- const char * const *attrs)
-{
- struct ldb_message *ret;
- unsigned int i;
-
- ret = talloc(mem_ctx, struct ldb_message);
- if (!ret) {
- return NULL;
- }
-
- ret->dn = ldb_dn_copy(ret, msg->dn);
- if (!ret->dn) {
- talloc_free(ret);
- return NULL;
- }
-
- ret->num_elements = 0;
- ret->elements = NULL;
-
- if (!attrs) {
- if (msg_add_all_elements(module, ret, msg) != 0) {
- talloc_free(ret);
- return NULL;
- }
- return ret;
- }
-
- for (i=0;attrs[i];i++) {
- struct ldb_message_element *el;
-
- if (strcmp(attrs[i], "*") == 0) {
- if (msg_add_all_elements(module, ret, msg) != 0) {
- talloc_free(ret);
- return NULL;
- }
- continue;
- }
-
- if (ldb_attr_cmp(attrs[i], "distinguishedName") == 0) {
- if (msg_add_distinguished_name(ret) != 0) {
- return NULL;
- }
- continue;
- }
-
- el = ldb_msg_find_element(msg, attrs[i]);
- if (!el) {
- continue;
- }
- if (msg_add_element(ret, el, 1) != 0) {
- talloc_free(ret);
- return NULL;
- }
- }
-
- return ret;
-}
-
-/*
search the database for a single simple dn.
return LDB_ERR_NO_SUCH_OBJECT on record-not-found
and LDB_SUCCESS on success
@@ -346,44 +250,6 @@ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_mes
}
/*
- add a set of attributes from a record to a set of results
- return 0 on success, -1 on failure
-*/
-int ltdb_add_attr_results(struct ldb_module *module,
- TALLOC_CTX *mem_ctx,
- struct ldb_message *msg,
- const char * const attrs[],
- unsigned int *count,
- struct ldb_message ***res)
-{
- struct ldb_message *msg2;
- struct ldb_message **res2;
-
- /* pull the attributes that the user wants */
- msg2 = ltdb_pull_attrs(module, mem_ctx, msg, attrs);
- if (!msg2) {
- return -1;
- }
-
- /* add to the results list */
- res2 = talloc_realloc(mem_ctx, *res, struct ldb_message *, (*count)+2);
- if (!res2) {
- talloc_free(msg2);
- return -1;
- }
-
- (*res) = res2;
-
- (*res)[*count] = talloc_move(*res, &msg2);
- (*res)[(*count)+1] = NULL;
- (*count)++;
-
- return 0;
-}
-
-
-
-/*
filter the specified list of attributes from a message
removing not requested attrs from the new message constructed.
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index 6b1187e..c0d7a1a 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -526,8 +526,7 @@ static int find_element(const struct ldb_message *msg, const char *name)
returns 0 on success, -1 on failure (and sets errno)
*/
-static int ltdb_msg_add_element(struct ldb_context *ldb,
- struct ldb_message *msg,
+static int ltdb_msg_add_element(struct ldb_message *msg,
struct ldb_message_element *el)
{
struct ldb_message_element *e2;
@@ -571,7 +570,6 @@ static int ltdb_msg_add_element(struct ldb_context *ldb,
delete all elements having a specified attribute name
*/
static int msg_delete_attribute(struct ldb_module *module,
- struct ldb_context *ldb,
struct ldb_message *msg, const char *name)
{
unsigned int i;
@@ -638,7 +636,7 @@ static int msg_delete_element(struct ldb_module *module,
}
if (matched) {
if (el->num_values == 1) {
- return msg_delete_attribute(module, ldb, msg, name);
+ return msg_delete_attribute(module, msg, name);
}
ret = ltdb_index_del_value(module, msg->dn, el, i);
@@ -773,7 +771,7 @@ int ltdb_modify_internal(struct ldb_module *module,
/* Checks if element already exists */
idx = find_element(msg2, el->name);
if (idx == -1) {
- if (ltdb_msg_add_element(ldb, msg2, el) != 0) {
+ if (ltdb_msg_add_element(msg2, el) != 0) {
ret = LDB_ERR_OTHER;
goto done;
}
@@ -901,7 +899,7 @@ int ltdb_modify_internal(struct ldb_module *module,
}
/* Delete the attribute if it exists in the DB */
- if (msg_delete_attribute(module, ldb, msg2,
+ if (msg_delete_attribute(module, msg2,
el->name) != 0) {
ret = LDB_ERR_OTHER;
goto done;
@@ -909,7 +907,7 @@ int ltdb_modify_internal(struct ldb_module *module,
}
/* Recreate it with the new values */
- if (ltdb_msg_add_element(ldb, msg2, el) != 0) {
+ if (ltdb_msg_add_element(msg2, el) != 0) {
ret = LDB_ERR_OTHER;
goto done;
}
@@ -930,7 +928,7 @@ int ltdb_modify_internal(struct ldb_module *module,
if (msg->elements[i].num_values == 0) {
/* Delete the whole attribute */
- ret = msg_delete_attribute(module, ldb, msg2,
+ ret = msg_delete_attribute(module, msg2,
msg->elements[i].name);
if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&
control_permissive) {
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.h b/lib/ldb/ldb_tdb/ldb_tdb.h
index 7caedeb..26ae68e 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -102,12 +102,6 @@ int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name,
void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg,
unsigned int unpack_flags);
-int ltdb_add_attr_results(struct ldb_module *module,
- TALLOC_CTX *mem_ctx,
- struct ldb_message *msg,
- const char * const attrs[],
- unsigned int *count,
- struct ldb_message ***res);
int ltdb_filter_attrs(TALLOC_CTX *mem_ctx,
const struct ldb_message *msg, const char * const *attrs,
struct ldb_message **filtered_msg);
diff --git a/lib/ldb/tests/ldb_mod_op_test.c b/lib/ldb/tests/ldb_mod_op_test.c
new file mode 100644
index 0000000..e609d3a
--- /dev/null
+++ b/lib/ldb/tests/ldb_mod_op_test.c
@@ -0,0 +1,1540 @@
+/*
+ * 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 <setjmp.h>
+#include <cmocka.h>
+
+#include <cmocka.h>
+
+#include <errno.h>
+#include <unistd.h>
+#include <talloc.h>
+#include <ldb.h>
+#include <string.h>
+#include <ctype.h>
+
+#define DEFAULT_BE "tdb"
+
+#ifndef TEST_BE
+#define TEST_BE DEFAULT_BE
+#endif /* TEST_BE */
+
+struct ldbtest_ctx {
+ struct tevent_context *ev;
+ struct ldb_context *ldb;
+
+ const char *dbfile;
+ const char *lockfile; /* lockfile is separate */
+
+ const char *dbpath;
+};
+
+static void unlink_old_db(struct ldbtest_ctx *test_ctx)
+{
+ int ret;
+
+ errno = 0;
+ ret = unlink(test_ctx->lockfile);
+ if (ret == -1 && errno != ENOENT) {
+ fail();
+ }
+
+ errno = 0;
+ ret = unlink(test_ctx->dbfile);
+ if (ret == -1 && errno != ENOENT) {
+ fail();
+ }
+}
+
+static int ldbtest_noconn_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);
+
+ test_ctx->dbfile = talloc_strdup(test_ctx, "apitest.ldb");
+ assert_non_null(test_ctx->dbfile);
+
+ test_ctx->lockfile = talloc_asprintf(test_ctx, "%s-lock",
+ test_ctx->dbfile);
+ assert_non_null(test_ctx->lockfile);
+
+ test_ctx->dbpath = talloc_asprintf(test_ctx,
+ TEST_BE"://%s", test_ctx->dbfile);
+ assert_non_null(test_ctx->dbpath);
+
+ unlink_old_db(test_ctx);
+ *state = test_ctx;
+ return 0;
+}
+
+static int ldbtest_noconn_teardown(void **state)
+{
+ struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+ struct ldbtest_ctx);
+
+ unlink_old_db(test_ctx);
+ talloc_free(test_ctx);
+ return 0;
+}
+
+static void test_connect(void **state)
+{
+ struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+ struct ldbtest_ctx);
+ int ret;
+
+ ret = ldb_connect(test_ctx->ldb, test_ctx->dbpath, 0, NULL);
+ assert_int_equal(ret, 0);
+}
+
+static int ldbtest_setup(void **state)
+{
+ struct ldbtest_ctx *test_ctx;
+ int ret;
+
+ ldbtest_noconn_setup((void **) &test_ctx);
+
+ ret = ldb_connect(test_ctx->ldb, test_ctx->dbpath, 0, NULL);
+ assert_int_equal(ret, 0);
+
+ *state = test_ctx;
+ return 0;
+}
+
+static int ldbtest_teardown(void **state)
+{
+ struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+ struct ldbtest_ctx);
+ ldbtest_noconn_teardown((void **) &test_ctx);
+ return 0;
+}
+
+static void test_ldb_add(void **state)
+{
+ int ret;
+ struct ldb_message *msg;
+ struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+ struct ldbtest_ctx);
+ TALLOC_CTX *tmp_ctx;
+
+ tmp_ctx = talloc_new(test_ctx);
+ assert_non_null(tmp_ctx);
+
+ msg = ldb_msg_new(tmp_ctx);
+ assert_non_null(msg);
+
+ msg->dn = ldb_dn_new_fmt(msg, test_ctx->ldb, "dc=test");
+ assert_non_null(msg->dn);
+
+ ret = ldb_msg_add_string(msg, "cn", "test_cn_val");
+ assert_int_equal(ret, 0);
+
+ ret = ldb_add(test_ctx->ldb, msg);
+ assert_int_equal(ret, 0);
+
+ talloc_free(tmp_ctx);
+}
+
+static void test_ldb_search(void **state)
+{
+ int ret;
+ struct ldb_message *msg;
+ struct ldbtest_ctx *test_ctx = talloc_get_type_abort(*state,
+ struct ldbtest_ctx);
+ TALLOC_CTX *tmp_ctx;
+ struct ldb_dn *basedn;
+ struct ldb_dn *basedn2;
+ struct ldb_result *result = NULL;
+
+ tmp_ctx = talloc_new(test_ctx);
+ assert_non_null(tmp_ctx);
+
+ basedn = ldb_dn_new_fmt(tmp_ctx, test_ctx->ldb, "dc=test");
+ assert_non_null(basedn);
+
+ ret = ldb_search(test_ctx->ldb, tmp_ctx, &result, basedn,
+ LDB_SCOPE_BASE, NULL, NULL);
+ assert_int_equal(ret, 0);
+ assert_non_null(result);
+ assert_int_equal(result->count, 0);
+
+ msg = ldb_msg_new(tmp_ctx);
+ assert_non_null(msg);
+
+ msg->dn = basedn;
+ assert_non_null(msg->dn);
+
+ ret = ldb_msg_add_string(msg, "cn", "test_cn_val1");
+ assert_int_equal(ret, 0);
+
+ ret = ldb_add(test_ctx->ldb, msg);
+ assert_int_equal(ret, 0);
+
+ basedn2 = ldb_dn_new_fmt(tmp_ctx, test_ctx->ldb, "dc=test2");
+ assert_non_null(basedn2);
+
+ msg = ldb_msg_new(tmp_ctx);
+ assert_non_null(msg);
+
+ msg->dn = basedn2;
+ assert_non_null(msg->dn);
+
+ ret = ldb_msg_add_string(msg, "cn", "test_cn_val2");
+ assert_int_equal(ret, 0);
+
+ ret = ldb_add(test_ctx->ldb, msg);
+ assert_int_equal(ret, 0);
+
+ ret = ldb_search(test_ctx->ldb, tmp_ctx, &result, basedn,
+ LDB_SCOPE_BASE, NULL, NULL);
+ assert_int_equal(ret, 0);
+ assert_non_null(result);
+ assert_int_equal(result->count, 1);
+ assert_string_equal(ldb_dn_get_linearized(result->msgs[0]->dn),
+ ldb_dn_get_linearized(basedn));
+
+ ret = ldb_search(test_ctx->ldb, tmp_ctx, &result, basedn2,
+ LDB_SCOPE_BASE, NULL, NULL);
+ assert_int_equal(ret, 0);
+ assert_non_null(result);
+ assert_int_equal(result->count, 1);
+ assert_string_equal(ldb_dn_get_linearized(result->msgs[0]->dn),
+ ldb_dn_get_linearized(basedn2));
+
+ talloc_free(tmp_ctx);
+}
+
+static int base_search_count(struct ldbtest_ctx *test_ctx, const char *entry_dn)
+{
+ TALLOC_CTX *tmp_ctx;
+ struct ldb_dn *basedn;
+ struct ldb_result *result = NULL;
+ int ret;
+ int count;
+
+ tmp_ctx = talloc_new(test_ctx);
+ assert_non_null(tmp_ctx);
+
+ basedn = ldb_dn_new_fmt(tmp_ctx, test_ctx->ldb, "%s", entry_dn);
+ assert_non_null(basedn);
+
+ ret = ldb_search(test_ctx->ldb, tmp_ctx, &result, basedn,
+ LDB_SCOPE_BASE, NULL, NULL);
+ assert_int_equal(ret, LDB_SUCCESS);
--
Samba Shared Repository
More information about the samba-cvs
mailing list