summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-07 23:53:02 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:02 +0100
commit80c6afa474d8a1e0198832bddfe5da75a9818b29 (patch)
treef318887d71caa3250e8a96c50d6d67d349e4f0fe
parent84c986f9bb2767d8930b6f5d92d34b09b8fabe60 (diff)
downloadsssd-80c6afa474d8a1e0198832bddfe5da75a9818b29.tar.gz
sssd-80c6afa474d8a1e0198832bddfe5da75a9818b29.tar.xz
sssd-80c6afa474d8a1e0198832bddfe5da75a9818b29.zip
Add domain argument to sysdb_has/set_enumerated()
-rw-r--r--src/db/sysdb.c12
-rw-r--r--src/db/sysdb.h2
-rw-r--r--src/providers/ldap/ldap_common.c3
-rw-r--r--src/providers/ldap/ldap_id_enum.c2
-rw-r--r--src/providers/ldap/sdap_reinit.c2
-rw-r--r--src/tests/sysdb-tests.c8
6 files changed, 14 insertions, 15 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 623cf2b52..65a0140f3 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -1492,6 +1492,7 @@ done:
}
errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
bool *has_enumerated)
{
errno_t ret;
@@ -1505,9 +1506,7 @@ errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb,
goto done;
}
- dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
- SYSDB_DOM_BASE,
- sysdb->domain->name);
+ dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, domain->name);
if (!dn) {
ret = ENOMEM;
goto done;
@@ -1521,6 +1520,7 @@ done:
}
errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
bool enumerated)
{
errno_t ret;
@@ -1533,15 +1533,13 @@ errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb,
goto done;
}
- dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
- SYSDB_DOM_BASE,
- sysdb->domain->name);
+ dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, SYSDB_DOM_BASE, domain->name);
if (!dn) {
ret = ENOMEM;
goto done;
}
- ret = sysdb_set_bool(sysdb, dn, sysdb->domain->name,
+ ret = sysdb_set_bool(sysdb, dn, domain->name,
SYSDB_HAS_ENUMERATED, enumerated);
done:
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index de5953c2e..96bbb8d2f 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -806,9 +806,11 @@ errno_t sysdb_set_bool(struct sysdb_ctx *sysdb,
bool value);
errno_t sysdb_has_enumerated(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
bool *has_enumerated);
errno_t sysdb_set_enumerated(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain,
bool enumerated);
errno_t sysdb_remove_attrs(struct sysdb_ctx *sysdb,
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index a97dc34e2..0dcd5a4da 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -767,7 +767,8 @@ int sdap_id_setup_tasks(struct sdap_id_ctx *ctx)
* clients requesting get*ent information won't get an
* immediate reply with no entries
*/
- ret = sysdb_has_enumerated(ctx->be->sysdb, &has_enumerated);
+ ret = sysdb_has_enumerated(ctx->be->sysdb, ctx->be->domain,
+ &has_enumerated);
if (ret != EOK) {
return ret;
}
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index 88036cc26..ecd1a6e75 100644
--- a/src/providers/ldap/ldap_id_enum.c
+++ b/src/providers/ldap/ldap_id_enum.c
@@ -145,7 +145,7 @@ static void ldap_id_enumerate_reschedule(struct tevent_req *req)
* process on the next SSSD service restart (to avoid
* slowing down system boot-up
*/
- ret = sysdb_set_enumerated(ctx->be->sysdb, true);
+ ret = sysdb_set_enumerated(ctx->be->sysdb, ctx->be->domain, true);
if (ret != EOK) {
DEBUG(1, ("Could not mark domain as having enumerated.\n"));
/* This error is non-fatal, so continue */
diff --git a/src/providers/ldap/sdap_reinit.c b/src/providers/ldap/sdap_reinit.c
index 41d102494..dd49c7b89 100644
--- a/src/providers/ldap/sdap_reinit.c
+++ b/src/providers/ldap/sdap_reinit.c
@@ -211,7 +211,7 @@ static void sdap_reinit_cleanup_done(struct tevent_req *subreq)
* process on the next SSSD service restart (to avoid
* slowing down system boot-up
*/
- ret = sysdb_set_enumerated(state->sysdb, true);
+ ret = sysdb_set_enumerated(state->sysdb, state->domain, true);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE, ("Could not mark domain as having "
"enumerated.\n"));
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index ab0cdb968..76d5e483f 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -4224,20 +4224,18 @@ START_TEST(test_sysdb_has_enumerated)
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
- ret = sysdb_has_enumerated(test_ctx->sysdb, &enumerated);
+ ret = sysdb_has_enumerated(test_ctx->sysdb, test_ctx->domain, &enumerated);
fail_if(ret != EOK, "Error [%d][%s] checking enumeration",
ret, strerror(ret));
fail_if(enumerated, "Enumeration should default to false");
- ret = sysdb_set_enumerated(test_ctx->sysdb,
- true);
+ ret = sysdb_set_enumerated(test_ctx->sysdb, test_ctx->domain, true);
fail_if(ret != EOK, "Error [%d][%s] setting enumeration",
ret, strerror(ret));
/* Recheck enumeration status */
- ret = sysdb_has_enumerated(test_ctx->sysdb,
- &enumerated);
+ ret = sysdb_has_enumerated(test_ctx->sysdb, test_ctx->domain, &enumerated);
fail_if(ret != EOK, "Error [%d][%s] checking enumeration",
ret, strerror(ret));