From: Pierangelo Masarati Date: Mon, 28 Nov 2005 11:34:46 +0000 (+0000) Subject: add dyngroup compare functionality to dynlist X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~660 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=26d802ee538319051b11633e6059047338b43d03;p=openldap add dyngroup compare functionality to dynlist --- diff --git a/doc/man/man5/slapo-dynlist.5 b/doc/man/man5/slapo-dynlist.5 index fc0cb20d2e..166db769d3 100644 --- a/doc/man/man5/slapo-dynlist.5 +++ b/doc/man/man5/slapo-dynlist.5 @@ -57,10 +57,19 @@ occurs for that specific URI. This statement is required. The name of the attributeDescription that will list the DN of the entries resulting from the internal search. This statement is optional and, if present, changes the behavior of the overlay into that of a dynamic group. -The portion of the URI is ignored, and the DNs of all the entries +The portion of the URI must be absent, and the DNs of all the entries resulting from the expansion of the URI are listed as values of this attribute. - +Compares to +.B dynlist-member-ad +attributes of entries with +.B dynlist-oc +objectClass apply as if the DN of the entries resulting from the expansion +of the URI were present in the +.B dynlist-oc +entry as values of the +.B dynlist-member-ad +attributeType. .LP The dynlist overlay may be used with any backend, but it is mainly intended for use with local storage backends. diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index 5ccccaf3b9..3ad2a6bee8 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -503,6 +503,24 @@ dynlist_compare( Operation *op, SlapReply *rs ) int rc; dynlist_sc_t dlc = { 0 }; + if ( op->oq_compare.rs_ava->aa_desc == dli->dli_member_ad ) { + /* This compare is for one of the attributes we're + * interested in. We'll use slapd's existing dyngroup + * evaluator to get the answer we want. + */ + int cache = op->o_do_not_cache; + + op->o_do_not_cache = 1; + rs->sr_err = backend_group( op, NULL, &op->o_req_ndn, + &op->oq_compare.rs_ava->aa_value, dli->dli_oc, dli->dli_ad ); + op->o_do_not_cache = cache; + if ( rs->sr_err == LDAP_SUCCESS ) { + rs->sr_err = LDAP_COMPARE_TRUE; + } + + return SLAP_CB_CONTINUE; + } + dlc.dlc_dli = dli; cb.sc_private = &dlc; cb.sc_response = dynlist_sc_save_entry; diff --git a/tests/scripts/test044-dynlist b/tests/scripts/test044-dynlist index 145432aeca..faf24eeee8 100755 --- a/tests/scripts/test044-dynlist +++ b/tests/scripts/test044-dynlist @@ -288,7 +288,7 @@ CMPDN="cn=Bjorn Jensen,ou=Information Technology Division,ou=People,$BASEDN" echo "Testing list compare..." echo "# Testing list compare..." >> $SEARCHOUT $LDAPCOMPARE -h $LOCALHOST -p $PORT1 \ - "cn=Dynamic List,$LISTDN" "member:$CMPDN" \ + "cn=Dynamic List of Members,$LISTDN" "member:$CMPDN" \ >> $SEARCHOUT 2>&1 RC=$? case $RC in