Test updating memberof config works

This commit is contained in:
Ondřej Kuzník 2019-01-11 15:15:07 +00:00
parent 054c91335b
commit 8dea22af7e
2 changed files with 93 additions and 1 deletions

View File

@ -294,3 +294,48 @@ cn: person2
sn: person2 sn: person2
memberOfB: cn=group2,ou=Groups,dc=example,dc=com memberOfB: cn=group2,ou=Groups,dc=example,dc=com
# Re-search the entire database after updating memberof configuration...
dn: dc=example,dc=com
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
dn: cn=group1,ou=Groups,dc=example,dc=com
objectClass: groupA
cn: group1
memberA: cn=person1,ou=People,dc=example,dc=com
memberA: cn=person2,ou=People,dc=example,dc=com
dn: cn=group2,ou=Groups,dc=example,dc=com
objectClass: groupB
cn: group2
memberB: cn=person1,ou=People,dc=example,dc=com
memberB: cn=person2,ou=People,dc=example,dc=com
dn: ou=Groups,dc=example,dc=com
objectClass: organizationalUnit
ou: Groups
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
dn: cn=person1,ou=People,dc=example,dc=com
objectClass: person
objectClass: groupMemberA
objectClass: groupMemberB
cn: person1
sn: person1
memberOfB: cn=group2,ou=Groups,dc=example,dc=com
memberOfC: cn=group1,ou=Groups,dc=example,dc=com
dn: cn=person2,ou=People,dc=example,dc=com
objectClass: person
objectClass: groupMemberA
objectClass: groupMemberB
cn: person2
sn: person2
memberOfB: cn=group2,ou=Groups,dc=example,dc=com
memberOfC: cn=group1,ou=Groups,dc=example,dc=com

View File

@ -94,10 +94,12 @@ olcAttributeTypes: ( 1.3.6.1.4.1.4754.31.1.3
NAME 'memberB' SUP distinguishedName ) NAME 'memberB' SUP distinguishedName )
olcAttributeTypes: ( 1.3.6.1.4.1.4754.31.1.4 olcAttributeTypes: ( 1.3.6.1.4.1.4754.31.1.4
NAME 'memberOfB' SUP distinguishedName ) NAME 'memberOfB' SUP distinguishedName )
olcAttributeTypes: ( 1.3.6.1.4.1.4754.31.1.5
NAME 'memberOfC' SUP distinguishedName )
olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.1 olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.1
NAME 'groupA' SUP top STRUCTURAL MUST cn MAY memberA ) NAME 'groupA' SUP top STRUCTURAL MUST cn MAY memberA )
olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.2 olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.2
NAME 'groupMemberA' SUP top AUXILIARY MAY memberOfA ) NAME 'groupMemberA' SUP top AUXILIARY MAY ( memberOfA $ memberOfC ) )
olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.3 olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.3
NAME 'groupB' SUP top STRUCTURAL MUST cn MAY memberB ) NAME 'groupB' SUP top STRUCTURAL MUST cn MAY memberB )
olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.4 olcObjectClasses: ( 1.3.6.1.4.1.4754.31.2.4
@ -391,6 +393,51 @@ if test $RC != 0 ; then
exit $RC exit $RC
fi fi
echo "Running ldapmodify to reconfigure the schema used..."
$LDAPADD -h $LOCALHOST -p $PORT1 -D 'cn=config' -w `cat $CONFIGPWF` \
>> $TESTOUT 2>&1 <<EOF
dn: olcOverlay={1}memberof,olcDatabase={1}$BACKEND,cn=config
changetype: modify
replace: olcMemberOfMemberOfAD
olcMemberOfMemberOfAD: memberOfC
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Updating groups to expose the new setting..."
$LDAPMODIFY -h $LOCALHOST -p $PORT1 \
-D "cn=Manager,$BASEDN" -w secret \
>> $TESTOUT 2>&1 <<EOF
dn: cn=group1,ou=Groups,$BASEDN
changetype: modify
add: memberA
memberA: cn=person1,ou=People,$BASEDN
memberA: cn=person2,ou=People,$BASEDN
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapmodify failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Re-search the entire database..."
echo "# Re-search the entire database after updating memberof configuration..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(objectClass=*)' '*' memberOf >> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS test $KILLSERVERS != no && kill -HUP $KILLPIDS
LDIF=$MEMBEROFOUT LDIF=$MEMBEROFOUT