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

Memberof pieces

parent abc83dc4
......@@ -529,6 +529,7 @@ BUILD_DENYOP=no
BUILD_DYNGROUP=no
BUILD_DYNLIST=no
BUILD_LASTMOD=no
BUILD_MEMBEROF=no
BUILD_PPOLICY=no
BUILD_PROXYCACHE=no
BUILD_REFINT=no
......@@ -2912,6 +2913,7 @@ dnl overlays
AC_SUBST(BUILD_DYNGROUP)
AC_SUBST(BUILD_DYNLIST)
AC_SUBST(BUILD_LASTMOD)
AC_SUBST(BUILD_MEMBEROF)
AC_SUBST(BUILD_PPOLICY)
AC_SUBST(BUILD_PROXYCACHE)
AC_SUBST(BUILD_REFINT)
......
# Search the entire database...
dn: cn=Baby Herman,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Baby Herman
sn: Herman
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: cn=Cartoonia,ou=Groups,dc=example,dc=com
objectClass: groupOfNames
cn: Cartoonia
member: cn=Roger Rabbit,ou=People,dc=example,dc=com
member: cn=Baby Herman,ou=People,dc=example,dc=com
dn: dc=example,dc=com
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
dn: ou=Groups,dc=example,dc=com
objectClass: organizationalUnit
ou: Groups
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
dn: cn=Roger Rabbit,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Roger Rabbit
sn: Rabbit
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
# Re-search the entire database...
dn: cn=Baby Herman,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Baby Herman
sn: Herman
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: cn=Cartoonia,ou=Groups,dc=example,dc=com
objectClass: groupOfNames
cn: Cartoonia
member: cn=Roger Rabbit,ou=People,dc=example,dc=com
member: cn=Baby Herman,ou=People,dc=example,dc=com
member: cn=Jessica Rabbit,ou=People,dc=example,dc=com
dn: dc=example,dc=com
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
dn: ou=Groups,dc=example,dc=com
objectClass: organizationalUnit
ou: Groups
dn: cn=Jessica Rabbit,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Jessica Rabbit
sn: Rabbit
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
dn: cn=Roger Rabbit,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Roger Rabbit
sn: Rabbit
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
# Re-search the entire database...
dn: cn=Baby Herman,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Baby Herman
sn: Herman
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: cn=Cartoonia,ou=Groups,dc=example,dc=com
objectClass: groupOfNames
cn: Cartoonia
member: cn=Roger Rabbit,ou=People,dc=example,dc=com
member: cn=Baby Herman,ou=People,dc=example,dc=com
member: cn=Jessica Rabbit,ou=People,dc=example,dc=com
member: cn=Cartoonia,ou=Groups,dc=example,dc=com
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: dc=example,dc=com
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
dn: ou=Groups,dc=example,dc=com
objectClass: organizationalUnit
ou: Groups
dn: cn=Jessica Rabbit,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Jessica Rabbit
sn: Rabbit
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
dn: cn=Roger Rabbit,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Roger Rabbit
sn: Rabbit
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
# Re-search the entire database...
dn: cn=Cartoonia,ou=Groups,dc=example,dc=com
objectClass: groupOfNames
cn: Cartoonia
member: cn=Roger Rabbit,ou=People,dc=example,dc=com
member: cn=Jessica Rabbit,ou=People,dc=example,dc=com
member: cn=Cartoonia,ou=Groups,dc=example,dc=com
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: dc=example,dc=com
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
dn: ou=Groups,dc=example,dc=com
objectClass: organizationalUnit
ou: Groups
dn: cn=Jessica Rabbit,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Jessica Rabbit
sn: Rabbit
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
dn: cn=Roger Rabbit,ou=People,dc=example,dc=com
objectClass: inetOrgPerson
cn: Roger Rabbit
sn: Rabbit
memberOf: cn=Cartoonia,ou=Groups,dc=example,dc=com
include @SCHEMADIR@/core.schema
include @SCHEMADIR@/cosine.schema
include @SCHEMADIR@/inetorgperson.schema
include @SCHEMADIR@/openldap.schema
#mod#modulepath ../servers/slapd/back-@BACKEND@/
#mod#moduleload back_@BACKEND@.la
#monitormod#modulepath ../servers/slapd/back-monitor/
#monitormod#moduleload back_monitor.la
#monitor#database monitor
database config
include @TESTDIR@/configpw.conf
......@@ -36,6 +36,7 @@ AC_sql=sql@BUILD_SQL@
AC_accesslog=accesslog@BUILD_ACCESSLOG@
AC_dds=dds@BUILD_DDS@
AC_dynlist=dynlist@BUILD_DYNLIST@
AC_memberof=memberof@BUILD_MEMBEROF@
AC_pcache=pcache@BUILD_PROXYCACHE@
AC_ppolicy=ppolicy@BUILD_PPOLICY@
AC_refint=refint@BUILD_REFINT@
......@@ -63,9 +64,9 @@ if test "${AC_meta}" = "metamod" && test "${AC_LIBS_DYNAMIC}" = "static" ; then
fi
export AC_bdb AC_hdb AC_ldap AC_meta AC_monitor AC_relay AC_sql \
AC_accesslog AC_dynlist AC_pcache AC_ppolicy AC_refint AC_retcode \
AC_rwm AC_unique AC_syncprov AC_translucent AC_valsort \
AC_dds \
AC_accesslog AC_dds AC_dynlist AC_memberof AC_pcache AC_ppolicy \
AC_refint AC_retcode AC_rwm AC_unique AC_syncprov AC_translucent \
AC_valsort \
AC_WITH_SASL AC_WITH_TLS AC_WITH_MODULES_ENABLED AC_ACI_ENABLED \
AC_THREADS AC_LIBS_DYNAMIC
......
......@@ -30,6 +30,7 @@ BACKSQL=${AC_sql-sqlno}
ACCESSLOG=${AC_accesslog-accesslogno}
DDS=${AC_dds-ddsno}
DYNLIST=${AC_dynlist-dynlistno}
MEMBEROF=${AC_memberof-memberofno}
PROXYCACHE=${AC_pcache-pcacheno}
PPOLICY=${AC_ppolicy-ppolicyno}
REFINT=${AC_refint-refintno}
......@@ -124,6 +125,7 @@ PLSRMASTERCONF=$DATADIR/slapd-syncrepl-multiproxy.conf
DDSCONF=$DATADIR/slapd-dds.conf
PASSWDCONF=$DATADIR/slapd-passwd.conf
UNDOCONF=$DATADIR/slapd-config-undo.conf
NAKEDCONF=$DATADIR/slapd-config-naked.conf
DYNAMICCONF=$DATADIR/slapd-dynamic.ldif
......@@ -236,14 +238,14 @@ SQLADD=$DATADIR/sql-add.ldif
MONITOR=""
REFDN="c=US"
BASEDN="dc=example,dc=com"
MANAGERDN="cn=Manager,dc=example,dc=com"
UPDATEDN="cn=Replica,dc=example,dc=com"
MANAGERDN="cn=Manager,$BASEDN"
UPDATEDN="cn=Replica,$BASEDN"
PASSWD=secret
BABSDN="cn=Barbara Jensen,ou=Information Technology DivisioN,OU=People,dc=example,dc=com"
BJORNSDN="cn=Bjorn Jensen,ou=Information Technology DivisioN,OU=People,dc=example,dc=com"
JAJDN="cn=James A Jones 1,ou=Alumni Association,ou=People,dc=example,dc=com"
JOHNDDN="cn=John Doe,ou=Information Technology Division,ou=People,dc=example,dc=com"
MELLIOTDN="cn=Mark Elliot,ou=Alumni Association,ou=People,dc=example,dc=com"
BABSDN="cn=Barbara Jensen,ou=Information Technology DivisioN,OU=People,$BASEDN"
BJORNSDN="cn=Bjorn Jensen,ou=Information Technology DivisioN,OU=People,$BASEDN"
JAJDN="cn=James A Jones 1,ou=Alumni Association,ou=People,$BASEDN"
JOHNDDN="cn=John Doe,ou=Information Technology Division,ou=People,$BASEDN"
MELLIOTDN="cn=Mark Elliot,ou=Alumni Association,ou=People,$BASEDN"
REFINTDN="cn=Manager,o=refint"
RETCODEDN="ou=RetCodes,$BASEDN"
UNIQUEDN="cn=Manager,o=unique"
......@@ -252,7 +254,7 @@ TRANSLUCENTROOT="o=translucent"
TRANSLUCENTUSER="ou=users,o=translucent"
TRANSLUCENTDN="uid=binder,o=translucent"
TRANSLUCENTPASSWD="bindtest"
METABASEDN="ou=Meta,dc=example,dc=com"
METABASEDN="ou=Meta,$BASEDN"
METAMANAGERDN="cn=Manager,$METABASEDN"
VALSORTDN="cn=Manager,o=valsort"
VALSORTBASEDN="o=valsort"
......@@ -325,6 +327,7 @@ SUBTREERENAMEOUT=$DATADIR/subtree-rename.out
ACIOUT=$DATADIR/aci.out
DYNLISTOUT=$DATADIR/dynlist.out
DDSOUT=$DATADIR/dds.out
MEMBEROFOUT=$DATADIR/memberof.out
SHTOOL="$SRCDIR/../build/shtool"
# Just in case we linked the binaries dynamically
......
#! /bin/sh
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2007 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
echo "running defines.sh"
. $SRCDIR/scripts/defines.sh
if test $MEMBEROF = memberofno; then
echo "Memberof overlay not available, test skipped"
exit 0
fi
mkdir -p $TESTDIR $DBDIR1 $TESTDIR/confdir
$SLAPPASSWD -g -n >$CONFIGPWF
echo "rootpw `$SLAPPASSWD -T $CONFIGPWF`" >$TESTDIR/configpw.conf
echo "Starting slapd on TCP/IP port $PORT1..."
. $CONFFILTER $BACKEND $MONITORDB < $NAKEDCONF > $CONF1
$SLAPD -f $CONF1 -F $TESTDIR/confdir -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
if test $WAIT != 0 ; then
echo PID $PID
read foo
fi
KILLPIDS="$PID"
sleep 1
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
'objectclass=*' > /dev/null 2>&1
RC=$?
if test $RC = 0 ; then
break
fi
echo "Waiting 5 seconds for slapd to start..."
sleep 5
done
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
cat /dev/null > $TESTOUT
if [ "$MEMBEROF" = memberofmod ]; then
echo "Inserting memberof overlay on producer..."
$LDAPADD -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
dn: cn=module,cn=config
objectClass: olcModuleList
cn: module
olcModulePath: ../servers/slapd/overlays
olcModuleLoad: memberof.la
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed for moduleLoad ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
fi
echo "Running ldapadd to build slapd config database..."
$LDAPADD -h $LOCALHOST -p $PORT1 -D 'cn=config' -w `cat $CONFIGPWF` \
>> $TESTOUT 2>&1 <<EOF
dn: olcDatabase={1}$BACKEND,cn=config
objectClass: olcDatabaseConfig
objectClass: olc${BACKEND}Config
olcDatabase: {1}$BACKEND
olcSuffix: $BASEDN
olcRootDN: cn=Manager,$BASEDN
olcRootPW:: c2VjcmV0
olcMonitoring: TRUE
olcDbDirectory: $TESTDIR/db.1.a/
olcDbCacheSize: 1000
olcDbIndex: objectClass eq
olcDbIndex: cn pres,eq,sub
olcDbIndex: uid pres,eq,sub
olcDbIndex: sn pres,eq,sub
olcDbMode: 384
# {0}memberof, {1}$BACKEND, config
dn: olcOverlay={0}memberof,olcDatabase={1}$BACKEND,cn=config
objectClass: olcOverlayConfig
objectClass: olcMemberOf
olcOverlay: {0}memberof
olcMemberOfRefInt: TRUE
olcMemberOfGroupOC: groupOfNames
olcMemberOfMemberAD: member
olcMemberOfMemberOfAD: memberOf
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Running ldapadd to build slapd database..."
$LDAPADD -h $LOCALHOST -p $PORT1 \
-D "cn=Manager,$BASEDN" -w secret \
>> $TESTOUT 2>&1 << EOF
dn: $BASEDN
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
dn: ou=People,$BASEDN
objectClass: organizationalUnit
ou: People
dn: ou=Groups,$BASEDN
objectClass: organizationalUnit
ou: Groups
dn: cn=Roger Rabbit,ou=People,$BASEDN
objectClass: inetOrgPerson
cn: Roger Rabbit
sn: Rabbit
dn: cn=Baby Herman,ou=People,$BASEDN
objectClass: inetOrgPerson
cn: Baby Herman
sn: Herman
dn: cn=Cartoonia,ou=Groups,$BASEDN
objectClass: groupOfNames
cn: Cartoonia
member: cn=Roger Rabbit,ou=People,$BASEDN
member: cn=Baby Herman,ou=People,$BASEDN
EOF
RC=$?
if test $RC != 0 ; then
echo "ldapadd failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Search the entire database..."
echo "# Search the entire database..." >> $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
echo "Running ldapmodify to add a member..."
$LDAPMODIFY -h $LOCALHOST -p $PORT1 \
-D "cn=Manager,$BASEDN" -w secret \
>> $TESTOUT 2>&1 << EOF
dn: cn=Jessica Rabbit,ou=People,$BASEDN
changetype: add
objectClass: inetOrgPerson
cn: Jessica Rabbit
sn: Rabbit
dn: cn=Cartoonia,ou=Groups,$BASEDN
changetype: modify
add: member
member: cn=Jessica Rabbit,ou=People,$BASEDN
EOF
echo "Re-search the entire database..."
echo "# Re-search the entire database..." >> $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
echo "Running ldapmodify to add self..."
$LDAPMODIFY -h $LOCALHOST -p $PORT1 \
-D "cn=Manager,$BASEDN" -w secret \
>> $TESTOUT 2>&1 << EOF
dn: cn=Cartoonia,ou=Groups,$BASEDN
changetype: modify
add: member
member: cn=Cartoonia,ou=Groups,$BASEDN
EOF
echo "Re-search the entire database..."
echo "# Re-search the entire database..." >> $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
echo "Running ldapdelete to remove a member..."
$LDAPMODIFY -h $LOCALHOST -p $PORT1 \
-D "cn=Manager,$BASEDN" -w secret \
>> $TESTOUT 2>&1 << EOF
dn: cn=Baby Herman,ou=People,$BASEDN
changetype: delete
EOF
echo "Re-search the entire database..."
echo "# Re-search the entire database..." >> $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
LDIF=$MEMBEROFOUT
echo "Filtering ldapsearch results..."
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
echo "Filtering original ldif used to create database..."
. $LDIFFILTER < $LDIF > $LDIFFLT
echo "Comparing filter output..."
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
if test $? != 0 ; then
echo "Comparison failed"
exit 1
fi
echo ">>>>> Test succeeded"
test $KILLSERVERS != no && wait
exit 0
Supports Markdown
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