summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2016-02-18 14:25:18 +0100
committerJakub Hrozek <jhrozek@redhat.com>2016-03-14 17:34:21 +0100
commitaf820c9fc6aa1768e2e6b0df78fb489dbb1b28d0 (patch)
tree0d26d25e5d32bc2663f98cbf28cfc75a4807193f
parent9fc9365da3ff8e52814b7924d65c68eef72c484d (diff)
downloadsssd-af820c9fc6aa1768e2e6b0df78fb489dbb1b28d0.tar.gz
sssd-af820c9fc6aa1768e2e6b0df78fb489dbb1b28d0.tar.xz
sssd-af820c9fc6aa1768e2e6b0df78fb489dbb1b28d0.zip
mock domain: reset ldb errors
After ldb connect ldb context contains the following error: "NULL Base DN invalid for a base search" This comes from internal ldb function ldb_set_default_dns() which runs base search on NULL dn to discover records similar to what rootDSE provides. However, tdb backend considers this an error and sets the message above. This may break memory leak checks in tests when we do push/pop on test_ctx which is a indirect parent of ldb_context. The error message is allocated when push is called but it is freed by other ldb queries and therefore not preset during the push phase and thus the leak check fails. Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r--Makefile.am4
-rw-r--r--src/tests/common_dom.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 9e6438e9..f5d0400c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1429,7 +1429,9 @@ libsss_test_common_la_SOURCES = \
src/tests/common.c
libsss_test_common_la_LIBADD = \
$(TALLOC_LIBS) \
- $(TEVENT_LIBS)
+ $(TEVENT_LIBS) \
+ $(LDB_LIBS) \
+ $(NULL)
if HAVE_CHECK
libsss_test_common_la_SOURCES += \
diff --git a/src/tests/common_dom.c b/src/tests/common_dom.c
index 24d1f5a8..1d480017 100644
--- a/src/tests/common_dom.c
+++ b/src/tests/common_dom.c
@@ -22,6 +22,7 @@
#include <talloc.h>
#include <errno.h>
+#include <ldb_module.h>
#include "tests/common.h"
@@ -188,6 +189,9 @@ mock_domain(TALLOC_CTX *mem_ctx,
goto done;
}
+ /* reset ldb error if any */
+ ldb_reset_err_string(sysdb_ctx_get_ldb(domain->sysdb));
+
/* init with an AD-style regex to be able to test flat name */
ret = sss_names_init_from_args(domain,
"(((?P<domain>[^\\\\]+)\\\\(?P<name>.+$))|" \