summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-09-03 12:34:07 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-17 16:02:20 +0200
commit219781d47052000eb0a016b665f5c381a48df3cb (patch)
treec25ef3a4ea03554db137cdad572c70ed1245f0ab /src
parent115241b0eeedd033d34d9721a896f031140944d7 (diff)
downloadsssd-219781d47052000eb0a016b665f5c381a48df3cb.tar.gz
sssd-219781d47052000eb0a016b665f5c381a48df3cb.tar.xz
sssd-219781d47052000eb0a016b665f5c381a48df3cb.zip
simple access test: initialize be_ctx for all tests
Recent simple access provider patches started using be_ctx during access check. This caused segfault in unit tests, since be_ctx wasn't initialized. Resolves: https://fedorahosted.org/sssd/ticket/2034
Diffstat (limited to 'src')
-rw-r--r--src/tests/simple_access-tests.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/tests/simple_access-tests.c b/src/tests/simple_access-tests.c
index a7a7e276d..aaf757871 100644
--- a/src/tests/simple_access-tests.c
+++ b/src/tests/simple_access-tests.c
@@ -127,6 +127,21 @@ void setup_simple(void)
test_ctx->sysdb = test_ctx->ctx->domain->sysdb;
test_ctx->ctx->domain->case_sensitive = true;
test_ctx->ctx->domain->mpg = false; /* Simulate an LDAP domain better */
+
+ /* be_ctx */
+ test_ctx->be_ctx = talloc_zero(test_ctx, struct be_ctx);
+ fail_if(test_ctx->be_ctx == NULL, "Unable to setup be_ctx");
+
+ test_ctx->be_ctx->cdb = test_ctx->confdb;
+ test_ctx->be_ctx->ev = test_ctx->ev;
+ test_ctx->be_ctx->conf_path = "config/domain/LOCAL";
+ test_ctx->be_ctx->domain = test_ctx->ctx->domain;
+
+ test_ctx->ctx->be_ctx = test_ctx->be_ctx;
+
+ ret = sss_names_init(test_ctx->ctx->domain, test_ctx->confdb,
+ "LOCAL", &test_ctx->be_ctx->domain->names);
+ fail_if(ret != EOK, "Unable to setup domain names (%d)", ret);
}
void teardown_simple(void)
@@ -148,7 +163,7 @@ void setup_simple_group(void)
* g1 and g2 respectively */
ret = sysdb_add_group(test_ctx->sysdb, test_ctx->ctx->domain,
"pvt", 999, NULL, 0, 0);
- fail_if(ret != EOK, "Could not add private group");
+ fail_if(ret != EOK, "Could not add private group %s", strerror(ret));
ret = sysdb_store_user(test_ctx->sysdb, test_ctx->ctx->domain,
"u1", NULL, 123, 999, "u1", "/home/u1",
@@ -204,21 +219,7 @@ void teardown_simple_group(void)
void setup_simple_init(void)
{
- errno_t ret;
-
setup_simple();
-
- test_ctx->be_ctx = talloc_zero(test_ctx, struct be_ctx);
- fail_if(test_ctx->be_ctx == NULL, "Unable to setup be_ctx");
-
- test_ctx->be_ctx->cdb = test_ctx->confdb;
- test_ctx->be_ctx->ev = test_ctx->ev;
- test_ctx->be_ctx->conf_path = "config/domain/LOCAL";
- test_ctx->be_ctx->domain = test_ctx->ctx->domain;
-
- ret = sss_names_init(test_ctx->ctx->domain, test_ctx->confdb,
- "LOCAL", &test_ctx->be_ctx->domain->names);
- fail_if(ret != EOK, "Unable to setup domain names (%d)", ret);
}
void teardown_simple_init(void)