Commit 49856f61 authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#5717

parent 76a91e7f
......@@ -37,6 +37,7 @@ OpenLDAP 2.4.12 Engineering
Fixed slapd-sql fault on NULL fields (ITS#5653)
Fixed slapo-accesslog entryCSN generation on purge (ITS#5694)
Fixed slapo-constraint string termination (ITS#5609)
Fixed slapo-dynlist expansion with mapped attributes (ITS#5717)
Fixed slapo-memberof internal operations DN (ITS#5622)
Fixed slapo-pcache attrset crash (ITS#5665)
Fixed slapo-pcache caching with invalid schema (ITS#5680)
......
......@@ -306,7 +306,9 @@ dynlist_sc_update( Operation *op, SlapReply *rs )
ad = a->a_desc;
for ( dlm = dlc->dlc_dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
if ( dlm->dlm_member_ad == a->a_desc ) {
ad = dlm->dlm_mapped_ad;
if ( dlm->dlm_mapped_ad ) {
ad = dlm->dlm_mapped_ad;
}
break;
}
}
......@@ -369,8 +371,8 @@ dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
/* Don't generate member list if it wasn't requested */
for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
if ( userattrs ||
ad_inlist( dlm->dlm_member_ad, rs->sr_attrs ) )
AttributeDescription *ad = dlm->dlm_mapped_ad ? dlm->dlm_mapped_ad : dlm->dlm_member_ad;
if ( userattrs || ad_inlist( ad, rs->sr_attrs ) )
break;
}
if ( dli->dli_dlm && !dlm )
......@@ -421,7 +423,6 @@ dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
int i, j;
struct berval dn;
int rc;
dynlist_map_t *dlm;
BER_BVZERO( &o.o_req_dn );
BER_BVZERO( &o.o_req_ndn );
......@@ -498,17 +499,42 @@ dynlist_prepare_entry( Operation *op, SlapReply *rs, dynlist_info_t *dli )
if ( o.ors_attrs[j].an_desc != NULL &&
is_at_operational( o.ors_attrs[j].an_desc->ad_type ) )
{
if ( !opattrs && !ad_inlist( o.ors_attrs[j].an_desc, rs->sr_attrs ) )
{
if ( !opattrs ) {
continue;
}
if ( !ad_inlist( o.ors_attrs[j].an_desc, rs->sr_attrs ) ) {
/* lookup if mapped -- linear search,
* not very efficient unless list
* is very short */
for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
if ( dlm->dlm_member_ad == o.ors_attrs[j].an_desc ) {
break;
}
}
if ( dlm == NULL ) {
continue;
}
}
} else {
if ( !userattrs &&
o.ors_attrs[j].an_desc != NULL &&
!ad_inlist( o.ors_attrs[j].an_desc, rs->sr_attrs ) )
{
continue;
/* lookup if mapped -- linear search,
* not very efficient unless list
* is very short */
for ( dlm = dli->dli_dlm; dlm; dlm = dlm->dlm_next ) {
if ( dlm->dlm_member_ad == o.ors_attrs[j].an_desc ) {
break;
}
}
if ( dlm == NULL ) {
continue;
}
}
}
}
......
......@@ -71,6 +71,83 @@ UNDEFINED
# Testing list compare with manageDSAit...
FALSE
# Testing list search of all (mapped) attrs...
dn: cn=Dynamic List,ou=Dynamic Lists,dc=example,dc=com
objectClass: groupOfURLs
cn: Dynamic List
memberURL: ldap:///ou=People,dc=example,dc=com?cn,mail?sub?(objectClass=person
)
sn: Barbara Jensen
sn: Babs Jensen
sn: Bjorn Jensen
sn: Biiff Jensen
sn: Dorothy Stevens
sn: Dot Stevens
sn: James A Jones 1
sn: James Jones
sn: Jim Jones
sn: James A Jones 2
sn: Jane Doe
sn: Jane Alverson
sn: Jennifer Smith
sn: Jen Smith
sn: John Doe
sn: Jonathon Doe
sn: Mark Elliot
sn: Mark A Elliot
sn: Ursula Hampster
mail: bjensen@mailgw.example.com
mail: bjorn@mailgw.example.com
mail: dots@mail.alumni.example.com
mail: jaj@mail.alumni.example.com
mail: jjones@mailgw.example.com
mail: jdoe@woof.net
mail: jen@mail.alumni.example.com
mail: johnd@mailgw.example.com
mail: melliot@mail.alumni.example.com
mail: uham@mail.alumni.example.com
# Testing list search of a (mapped) listed attr...
dn: cn=Dynamic List,ou=Dynamic Lists,dc=example,dc=com
sn: Barbara Jensen
sn: Babs Jensen
sn: Bjorn Jensen
sn: Biiff Jensen
sn: Dorothy Stevens
sn: Dot Stevens
sn: James A Jones 1
sn: James Jones
sn: Jim Jones
sn: James A Jones 2
sn: Jane Doe
sn: Jane Alverson
sn: Jennifer Smith
sn: Jen Smith
sn: John Doe
sn: Jonathon Doe
sn: Mark Elliot
sn: Mark A Elliot
sn: Ursula Hampster
# Testing list search of a (n unmapped) listed attr...
dn: cn=Dynamic List,ou=Dynamic Lists,dc=example,dc=com
mail: bjensen@mailgw.example.com
mail: bjorn@mailgw.example.com
mail: dots@mail.alumni.example.com
mail: jaj@mail.alumni.example.com
mail: jjones@mailgw.example.com
mail: jdoe@woof.net
mail: jen@mail.alumni.example.com
mail: johnd@mailgw.example.com
mail: melliot@mail.alumni.example.com
mail: uham@mail.alumni.example.com
# Testing list compare (mapped attrs) ...
TRUE
# Testing list compare (mapped attrs; should return FALSE)...
FALSE
# Testing list search of all attrs...
dn: cn=Dynamic List of Members,ou=Dynamic Lists,dc=example,dc=com
objectClass: groupOfURLs
......
......@@ -244,6 +244,116 @@ case $RC in
esac
echo "" >> $SEARCHOUT
echo "Reconfiguring slapd..."
$LDAPMODIFY -x -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF > \
$TESTOUT 2>&1 << EOMODS
version: 1
dn: olcOverlay={0}dynlist,olcDatabase={2}$BACKEND,cn=config
changetype: modify
delete: olcDLattrSet
olcDLattrSet: {0}
-
add: olcDLattrSet
olcDLattrSet: groupOfURLs memberURL sn:cn mail
-
EOMODS
echo "==========================================================" >> $LOG1
echo "Testing attribute mapping"
echo "Testing list search of all (mapped) attrs..."
echo "# Testing list search of all (mapped) attrs..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
'(cn=Dynamic List)' '*' \
>> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing list search of a (mapped) listed attr..."
echo "# Testing list search of a (mapped) listed attr..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
'(cn=Dynamic List)' sn \
>> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing list search of a (n unmapped) listed attr..."
echo "# Testing list search of a (n unmapped) listed attr..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$LISTDN" -h $LOCALHOST -p $PORT1 \
'(cn=Dynamic List)' mail \
>> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing list compare (mapped attrs) ..."
echo "# Testing list compare (mapped attrs) ..." >> $SEARCHOUT
$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
"cn=Dynamic List,$LISTDN" "sn:Bjorn Jensen" \
>> $SEARCHOUT 2>&1
RC=$?
case $RC in
5)
echo "ldapcompare returned FALSE ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
;;
6)
echo "ldapcompare returned TRUE ($RC)"
;;
0)
echo "ldapcompare returned success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1
;;
*)
echo "ldapcompare failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
;;
esac
echo "" >> $SEARCHOUT
echo "Testing list compare (mapped attrs; should return FALSE)..."
echo "# Testing list compare (mapped attrs; should return FALSE)..." >> $SEARCHOUT
$LDAPCOMPARE -h $LOCALHOST -p $PORT1 \
"cn=Dynamic List,$LISTDN" "sn:FALSE" \
>> $SEARCHOUT 2>&1
RC=$?
case $RC in
5)
echo "ldapcompare returned FALSE ($RC)"
;;
6)
echo "ldapcompare returned TRUE ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
;;
0)
echo "ldapcompare returned success ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit -1
;;
*)
echo "ldapcompare failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
;;
esac
echo "" >> $SEARCHOUT
echo "Reconfiguring slapd..."
$LDAPMODIFY -x -D cn=config -h $LOCALHOST -p $PORT1 -y $CONFIGPWF > \
$TESTOUT 2>&1 << EOMODS
......@@ -255,6 +365,7 @@ olcDLattrSet: {0}
-
add: olcDLattrSet
olcDLattrSet: groupOfURLs memberURL member
-
EOMODS
echo "==========================================================" >> $LOG1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment