summaryrefslogtreecommitdiff
path: root/src/providers/ldap/sdap_reinit.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-01-07 23:00:22 -0500
committerJakub Hrozek <jhrozek@redhat.com>2013-01-15 10:53:02 +0100
commit044868b388b4e47499f12a9105310b247bbe1ce2 (patch)
treea8e503edd07bdbd598dbc02c448d138520907e29 /src/providers/ldap/sdap_reinit.c
parenta703ed242523c145133f522085ee3180452b3743 (diff)
downloadsssd-044868b388b4e47499f12a9105310b247bbe1ce2.tar.gz
sssd-044868b388b4e47499f12a9105310b247bbe1ce2.tar.bz2
sssd-044868b388b4e47499f12a9105310b247bbe1ce2.zip
Add domain arg to sysdb_search_users()
Diffstat (limited to 'src/providers/ldap/sdap_reinit.c')
-rw-r--r--src/providers/ldap/sdap_reinit.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/providers/ldap/sdap_reinit.c b/src/providers/ldap/sdap_reinit.c
index 4c75f6c3..cc836ae5 100644
--- a/src/providers/ldap/sdap_reinit.c
+++ b/src/providers/ldap/sdap_reinit.c
@@ -29,12 +29,15 @@
#include "db/sysdb_services.h"
struct sdap_reinit_cleanup_state {
+ struct sss_domain_info *domain;
struct sysdb_ctx *sysdb;
};
-static errno_t sdap_reinit_clear_usn(struct sysdb_ctx *sysdb);
+static errno_t sdap_reinit_clear_usn(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain);
static void sdap_reinit_cleanup_done(struct tevent_req *subreq);
-static errno_t sdap_reinit_delete_records(struct sysdb_ctx *sysdb);
+static errno_t sdap_reinit_delete_records(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain);
struct tevent_req* sdap_reinit_cleanup_send(TALLOC_CTX *mem_ctx,
struct be_ctx *be_ctx,
@@ -61,6 +64,7 @@ struct tevent_req* sdap_reinit_cleanup_send(TALLOC_CTX *mem_ctx,
}
state->sysdb = be_ctx->domain->sysdb;
+ state->domain = be_ctx->domain;
if (!be_ctx->domain->enumerate) {
/* enumeration is disabled, this whole process is meaningless */
@@ -68,7 +72,7 @@ struct tevent_req* sdap_reinit_cleanup_send(TALLOC_CTX *mem_ctx,
goto immediately;
}
- ret = sdap_reinit_clear_usn(state->sysdb);
+ ret = sdap_reinit_clear_usn(state->sysdb, state->domain);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Unable to clear USN attributes [%d]: %s\n",
ret, strerror(ret)));
@@ -115,7 +119,8 @@ static void sdap_delete_msgs_usn(struct sysdb_ctx *sysdb,
}
}
-static errno_t sdap_reinit_clear_usn(struct sysdb_ctx *sysdb)
+static errno_t sdap_reinit_clear_usn(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain)
{
TALLOC_CTX *tmp_ctx = NULL;
bool in_transaction = false;
@@ -138,7 +143,8 @@ static errno_t sdap_reinit_clear_usn(struct sysdb_ctx *sysdb)
in_transaction = true;
/* reset users' usn */
- ret = sysdb_search_users(tmp_ctx, sysdb, "", attrs, &msgs_num, &msgs);
+ ret = sysdb_search_users(tmp_ctx, sysdb, domain,
+ "", attrs, &msgs_num, &msgs);
if (ret != EOK) {
goto done;
}
@@ -211,7 +217,7 @@ static void sdap_reinit_cleanup_done(struct tevent_req *subreq)
/* This error is non-fatal, so continue */
}
- ret = sdap_reinit_delete_records(state->sysdb);
+ ret = sdap_reinit_delete_records(state->sysdb, state->domain);
if (ret != EOK) {
goto fail;
}
@@ -239,7 +245,8 @@ static void sdap_delete_msgs_dn(struct sysdb_ctx *sysdb,
}
}
-static errno_t sdap_reinit_delete_records(struct sysdb_ctx *sysdb)
+static errno_t sdap_reinit_delete_records(struct sysdb_ctx *sysdb,
+ struct sss_domain_info *domain)
{
TALLOC_CTX *tmp_ctx = NULL;
bool in_transaction = false;
@@ -262,7 +269,7 @@ static errno_t sdap_reinit_delete_records(struct sysdb_ctx *sysdb)
in_transaction = true;
/* purge untouched users */
- ret = sysdb_search_users(tmp_ctx, sysdb, "(!("SYSDB_USN"=*))",
+ ret = sysdb_search_users(tmp_ctx, sysdb, domain, "(!("SYSDB_USN"=*))",
attrs, &msgs_num, &msgs);
if (ret != EOK) {
goto done;