summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/ldap_id_enum.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2010-11-26 13:59:32 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-12-07 17:09:19 -0500
commit85abff7f43e8006de2c2fa35612884d377b9a036 (patch)
tree84e36f7e4d1eb807c4bc2d77b74cd755275d7973 /src/providers/ldap/ldap_id_enum.c
parent1d9eec9e868fbc2d996f1030a43675be9a840133 (diff)
downloadsssd-85abff7f43e8006de2c2fa35612884d377b9a036.tar.gz
sssd-85abff7f43e8006de2c2fa35612884d377b9a036.tar.xz
sssd-85abff7f43e8006de2c2fa35612884d377b9a036.zip
ldap: Use USN entries if available.
Otherwise fallback to the default modifyTimestamp indicator
Diffstat (limited to 'src/providers/ldap/ldap_id_enum.c')
-rw-r--r--src/providers/ldap/ldap_id_enum.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index d60519213..f2ac8c6a9 100644
--- a/src/providers/ldap/ldap_id_enum.c
+++ b/src/providers/ldap/ldap_id_enum.c
@@ -426,16 +426,15 @@ static struct tevent_req *enum_users_send(TALLOC_CTX *memctx,
state->ctx = ctx;
state->op = op;
- if (ctx->max_user_timestamp && !purge) {
-
+ if (ctx->srv_opts && ctx->srv_opts->max_user_value && !purge) {
state->filter = talloc_asprintf(state,
"(&(%s=*)(objectclass=%s)(%s>=%s)(!(%s=%s)))",
ctx->opts->user_map[SDAP_AT_USER_NAME].name,
ctx->opts->user_map[SDAP_OC_USER].name,
- ctx->opts->user_map[SDAP_AT_USER_MODSTAMP].name,
- ctx->max_user_timestamp,
- ctx->opts->user_map[SDAP_AT_USER_MODSTAMP].name,
- ctx->max_user_timestamp);
+ ctx->opts->user_map[SDAP_AT_USER_USN].name,
+ ctx->srv_opts->max_user_value,
+ ctx->opts->user_map[SDAP_AT_USER_USN].name,
+ ctx->srv_opts->max_user_value);
} else {
state->filter = talloc_asprintf(state,
"(&(%s=*)(objectclass=%s))",
@@ -479,23 +478,23 @@ static void enum_users_op_done(struct tevent_req *subreq)
struct tevent_req);
struct enum_users_state *state = tevent_req_data(req,
struct enum_users_state);
- char *timestamp;
+ char *usn_value;
int ret;
- ret = sdap_get_users_recv(subreq, state, &timestamp);
+ ret = sdap_get_users_recv(subreq, state, &usn_value);
talloc_zfree(subreq);
if (ret) {
tevent_req_error(req, ret);
return;
}
- if (timestamp) {
- talloc_zfree(state->ctx->max_user_timestamp);
- state->ctx->max_user_timestamp = talloc_steal(state->ctx, timestamp);
+ if (usn_value) {
+ talloc_zfree(state->ctx->srv_opts->max_user_value);
+ state->ctx->srv_opts->max_user_value = talloc_steal(state->ctx, usn_value);
}
- DEBUG(4, ("Users higher timestamp: [%s]\n",
- state->ctx->max_user_timestamp));
+ DEBUG(4, ("Users higher USN value: [%s]\n",
+ state->ctx->srv_opts->max_user_value));
tevent_req_done(req);
}
@@ -530,16 +529,15 @@ static struct tevent_req *enum_groups_send(TALLOC_CTX *memctx,
state->ctx = ctx;
state->op = op;
- if (ctx->max_group_timestamp && !purge) {
-
+ if (ctx->srv_opts && ctx->srv_opts->max_group_value && !purge) {
state->filter = talloc_asprintf(state,
"(&(%s=*)(objectclass=%s)(%s>=%s)(!(%s=%s)))",
ctx->opts->group_map[SDAP_AT_GROUP_NAME].name,
ctx->opts->group_map[SDAP_OC_GROUP].name,
- ctx->opts->group_map[SDAP_AT_GROUP_MODSTAMP].name,
- ctx->max_group_timestamp,
- ctx->opts->group_map[SDAP_AT_GROUP_MODSTAMP].name,
- ctx->max_group_timestamp);
+ ctx->opts->group_map[SDAP_AT_GROUP_USN].name,
+ ctx->srv_opts->max_group_value,
+ ctx->opts->group_map[SDAP_AT_GROUP_USN].name,
+ ctx->srv_opts->max_group_value);
} else {
state->filter = talloc_asprintf(state,
"(&(%s=*)(objectclass=%s))",
@@ -582,23 +580,24 @@ static void enum_groups_op_done(struct tevent_req *subreq)
struct tevent_req);
struct enum_groups_state *state = tevent_req_data(req,
struct enum_groups_state);
- char *timestamp;
+ char *usn_value;
int ret;
- ret = sdap_get_groups_recv(subreq, state, &timestamp);
+ ret = sdap_get_groups_recv(subreq, state, &usn_value);
talloc_zfree(subreq);
if (ret) {
tevent_req_error(req, ret);
return;
}
- if (timestamp) {
- talloc_zfree(state->ctx->max_group_timestamp);
- state->ctx->max_group_timestamp = talloc_steal(state->ctx, timestamp);
+ if (usn_value) {
+ talloc_zfree(state->ctx->srv_opts->max_group_value);
+ state->ctx->srv_opts->max_group_value =
+ talloc_steal(state->ctx, usn_value);
}
- DEBUG(4, ("Groups higher timestamp: [%s]\n",
- state->ctx->max_group_timestamp));
+ DEBUG(4, ("Groups higher USN value: [%s]\n",
+ state->ctx->srv_opts->max_group_value));
tevent_req_done(req);
}