diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2016-05-18 14:30:28 +0200 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-06-23 13:40:11 +0200 |
commit | dd285415d7a8d8376207960cfa3e977524c3b98c (patch) | |
tree | 38d848dcdc43045ef5d781665b0a28bf85bffd7b /src/tests | |
parent | 13d7df10bf4d76c333a9169f9fcbeb891d870351 (diff) | |
download | sssd-dd285415d7a8d8376207960cfa3e977524c3b98c.tar.gz sssd-dd285415d7a8d8376207960cfa3e977524c3b98c.tar.xz sssd-dd285415d7a8d8376207960cfa3e977524c3b98c.zip |
SYSDB: Search the timestamp caches in addition to the sysdb cache
When a sysdb entry is searched, the sysdb cache is consulted first
for users or groups. If an entry is found in the sysdb cache, the
attributes from the timestamp cache are merged to return the full and
up-to-date set of attributes.
The merging is done with a single BASE search which is a direct lookup
into the underlying key-value database, so it should be relatively fast.
More complex merging is done only for enumeration by filter which is
currently done only via the IFP back end and should be quite
infrequent, so I hope we can justify a more complex merging there.
Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/cmocka/test_sysdb_sudo.c | 4 | ||||
-rw-r--r-- | src/tests/common.h | 2 | ||||
-rw-r--r-- | src/tests/common_dom.c | 16 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/tests/cmocka/test_sysdb_sudo.c b/src/tests/cmocka/test_sysdb_sudo.c index 7289454a4..97f80d7e5 100644 --- a/src/tests/cmocka/test_sysdb_sudo.c +++ b/src/tests/cmocka/test_sysdb_sudo.c @@ -23,9 +23,11 @@ #include <setjmp.h> #include <cmocka.h> #include <popt.h> +#include <ldb_module.h> #include "tests/cmocka/common_mock.h" #include "src/db/sysdb_sudo.h" +#include "src/db/sysdb_private.h" #define TESTS_PATH "tp_" BASE_FILE_STEM #define TEST_CONF_DB "test_sysdb_sudorules.ldb" @@ -138,6 +140,7 @@ static int test_sysdb_setup(void **state) create_groups(test_ctx->tctx->dom); create_users(test_ctx->tctx->dom); + reset_ldb_errstrings(test_ctx->tctx->dom); check_leaks_push(test_ctx); *state = (void *)test_ctx; @@ -710,7 +713,6 @@ int main(int argc, const char *argv[]) cmocka_unit_test_setup_teardown(test_sudo_get_filter, test_sysdb_setup, test_sysdb_teardown), - /* sysdb_get_sudo_user_info() */ cmocka_unit_test_setup_teardown(test_get_sudo_user_info, test_sysdb_setup, diff --git a/src/tests/common.h b/src/tests/common.h index c9b3815cd..b49cfea9b 100644 --- a/src/tests/common.h +++ b/src/tests/common.h @@ -84,6 +84,8 @@ struct sss_test_conf_param { struct sss_test_ctx *create_ev_test_ctx(TALLOC_CTX *mem_ctx); +void reset_ldb_errstrings(struct sss_domain_info *dom); + struct sss_test_ctx * create_multidom_test_ctx(TALLOC_CTX *mem_ctx, const char *tests_path, diff --git a/src/tests/common_dom.c b/src/tests/common_dom.c index 615b613c8..f1a92cc99 100644 --- a/src/tests/common_dom.c +++ b/src/tests/common_dom.c @@ -173,6 +173,14 @@ done: return ret; } +void reset_ldb_errstrings(struct sss_domain_info *dom) +{ + ldb_reset_err_string(sysdb_ctx_get_ldb(dom->sysdb)); + if (dom->sysdb->ldb_ts) { + ldb_reset_err_string(dom->sysdb->ldb_ts); + } +} + static errno_t mock_domain(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, @@ -191,12 +199,7 @@ mock_domain(TALLOC_CTX *mem_ctx, goto done; } - /* reset ldb error if any */ - ldb_reset_err_string(sysdb_ctx_get_ldb(domain->sysdb)); - - if (domain->sysdb->ldb_ts != NULL) { - ldb_reset_err_string(domain->sysdb->ldb_ts); - } + reset_ldb_errstrings(domain); /* init with an AD-style regex to be able to test flat name */ ret = sss_names_init_from_args(domain, @@ -378,6 +381,7 @@ void test_multidom_suite_cleanup(const char *tests_path, } talloc_zfree(sysdb_path); + } } |