diff options
author | Pavel Březina <pbrezina@redhat.com> | 2016-02-18 14:25:18 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-03-14 17:34:21 +0100 |
commit | af820c9fc6aa1768e2e6b0df78fb489dbb1b28d0 (patch) | |
tree | 0d26d25e5d32bc2663f98cbf28cfc75a4807193f /src/tests/common_dom.c | |
parent | 9fc9365da3ff8e52814b7924d65c68eef72c484d (diff) | |
download | sssd-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>
Diffstat (limited to 'src/tests/common_dom.c')
-rw-r--r-- | src/tests/common_dom.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tests/common_dom.c b/src/tests/common_dom.c index 24d1f5a8a..1d4800179 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>.+$))|" \ |