Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
cff36c38
Commit
cff36c38
authored
Jul 12, 1999
by
Kurt Zeilenga
Browse files
Properly search for cn=monitor (to detect running slapd)
parent
fbe63f47
Changes
4
Hide whitespace changes
Inline
Side-by-side
tests/scripts/defines.sh
View file @
cff36c38
LDIF2LDBM
=
../servers/slapd/tools/ldif2ldbm
DATADIR
=
$SRCDIR
/data
PROGDIR
=
./progs
if
test
"
$BACKEND
"
=
"bdb2"
;
then
LDIF2LDBM
=
../servers/slapd/tools/ldif2ldbm-bdb2
CONF
=
$DATADIR
/slapd-bdb2-master.conf
ACLCONF
=
$DATADIR
/slapd-bdb2-acl.conf
MASTERCONF
=
$DATADIR
/slapd-bdb2-repl-master.conf
SLAVECONF
=
$DATADIR
/slapd-bdb2-repl-slave.conf
TIMING
=
"-t"
else
LDIF2LDBM
=
../servers/slapd/tools/ldif2ldbm
CONF
=
$DATADIR
/slapd-master.conf
ACLCONF
=
$DATADIR
/slapd-acl.conf
MASTERCONF
=
$DATADIR
/slapd-repl-master.conf
SLAVECONF
=
$DATADIR
/slapd-repl-slave.conf
fi
if
test
"
$LDAP_PROTO
"
;
then
PROTO
=
"-P
$LDAP_PROTO
"
fi
PASSWDCONF
=
$DATADIR
/slapd-passwd.conf
CLIENTDIR
=
../clients/tools
#CLIENTDIR=/usr/local/bin
SLAPD
=
../servers/slapd/slapd
SLURPD
=
../servers/slurpd/slurpd
LDAPSEARCH
=
../clients/tools/ldapsearch
LDAPMODIFY
=
../clients/tools/ldapmodify
LDAPADD
=
../clients/tools/ldapadd
LDAPSEARCH
=
"
$CLIENTDIR
/ldapsearch
$PROTO
"
LDAPMODIFY
=
"
$CLIENTDIR
/ldapmodify
$PROTO
"
LDAPADD
=
"
$CLIENTDIR
/ldapadd
$PROTO
"
LDAPMODRDN
=
"
$CLIENTDIR
/ldapmodrdn
$PROTO
"
SLAPDTESTER
=
$PROGDIR
/slapd-tester
LVL
=
${
SLAPD_DEBUG
-5
}
ADDR
=
127.0.0.1
PORT
=
9009
SLAVEPORT
=
9010
DBDIR
=
./test-db
REPLDIR
=
./test-repl
CONF
=
./data/slapd-master.conf
ACLCONF
=
./data/slapd-acl.conf
MASTERCONF
=
./data/slapd-repl-master.conf
SLAVECONF
=
./data/slapd-repl-slave.conf
LDIF
=
./data/test.ldif
LDIFORDERED
=
./data/test-ordered.ldif
LDIF
=
$DATADIR
/test.ldif
LDIFORDERED
=
$DATADIR
/test-ordered.ldif
MONITOR
=
"cn=monitor"
BASEDN
=
"o=University of Michigan, c=US"
MANAGERDN
=
"cn=Manager, o=University of Michigan, c=US"
PASSWD
=
secret
BABSDN
=
"cn=Barbara Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US"
BJORNSDN
=
"cn=Bjorn Jensen, ou=Information Technology Division, ou=People, o=University of Michigan, c=US"
JAJDN
=
"cn=James A Jones 1, ou=Alumni Association, ou=People, o=University of Michigan, c=US"
MASTERLOG
=
$DBDIR
/master.log
SLAVELOG
=
$DBDIR
/slave.log
SLURPLOG
=
$DBDIR
/slurp.log
SEARCHOUT
=
$DBDIR
/ldapsearch.out
SEARCHFLT
=
$DBDIR
/ldapsearch.flt
LDIFFLT
=
$DBDIR
/ldif.flt
MASTEROUT
=
$DBDIR
/master.out
SLAVEOUT
=
$DBDIR
/slave.out
TESTOUT
=
$DBDIR
/ldapsearch.out
SEARCHOUTMASTER
=
./data/search.out.master
MODIFYOUTMASTER
=
./data/modify.out.master
ADDDELOUTMASTER
=
./data/adddel.out.master
MODRDNOUTMASTER
=
./data/modrdn.out.master
ACLOUTMASTER
=
./data/acl.out.master
REPLOUTMASTER
=
./data/repl.out.master
MODSRCHFILTERS
=
./data/modify.search.filters
SEARCHOUTMASTER
=
$DATADIR
/search.out.master
MODIFYOUTMASTER
=
$DATADIR
/modify.out.master
ADDDELOUTMASTER
=
$DATADIR
/adddel.out.master
MODRDNOUTMASTER0
=
$DATADIR
/modrdn.out.master.0
MODRDNOUTMASTER1
=
$DATADIR
/modrdn.out.master.1
MODRDNOUTMASTER2
=
$DATADIR
/modrdn.out.master.2
MODRDNOUTMASTER3
=
$DATADIR
/modrdn.out.master.3
ACLOUTMASTER
=
$DATADIR
/acl.out.master
REPLOUTMASTER
=
$DATADIR
/repl.out.master
MODSRCHFILTERS
=
$DATADIR
/modify.search.filters
tests/scripts/test002-populate
View file @
cff36c38
#!/bin/sh
#!
/bin/sh
.
scripts/defines.sh
if
test
$#
-eq
0
;
then
SRCDIR
=
"."
else
SRCDIR
=
$1
;
shift
fi
if
test
$#
-eq
1
;
then
BACKEND
=
$1
;
shift
fi
echo
"running defines.sh
$SRCDIR
$BACKEND
"
.
$SRCDIR
/scripts/defines.sh
echo
"Cleaning up in
$DBDIR
..."
rm
-f
$DBDIR
/
*
rm
-f
$DBDIR
/
[!C]
*
echo
"Starting slapd on TCP/IP port
$PORT
..."
$SLAPD
-f
$CONF
-p
$PORT
-d
1
>
/dev/null
2>&1 &
$SLAPD
-f
$CONF
-p
$PORT
-d
$LVL
$TIMING
>
$MASTERLOG
2>&1 &
PID
=
$!
echo
"Using ldapsearch to check that slapd is running..."
for
i
in
0 1 2 3 4 5
;
do
$LDAPSEARCH
-L
-b
"
$
BASEDN
"
-h
localhost
-p
$PORT
\
'
cn=Monitor
'
>
/dev/null 2>&1
$LDAPSEARCH
-L
-b
"
$
MONITOR
"
-h
localhost
-p
$PORT
\
'
objectclass=*
'
>
/dev/null 2>&1
RC
=
$?
if
[
$RC
=
1
]
;
then
if
test
$RC
=
1
;
then
echo
"Waiting 5 seconds for slapd to start..."
sleep
5
fi
done
echo
"Using ldap
modify
to populate the database..."
$LDAP
MODIFY
-a
-D
"
$MANAGERDN
"
-h
localhost
-p
$PORT
-w
$PASSWD
<
\
echo
"Using ldap
add
to populate the database..."
$LDAP
ADD
-D
"
$MANAGERDN
"
-h
localhost
-p
$PORT
-w
$PASSWD
<
\
$LDIFORDERED
>
/dev/null 2>&1
RC
=
$?
if
[
$RC
!=
0
]
;
then
echo
"ldap
modify
failed!"
if
test
$RC
!=
0
;
then
echo
"ldap
add
failed!"
kill
-HUP
$PID
exit
$RC
fi
echo
"Using ldapsearch to read all the entries..."
$LDAPSEARCH
-L
-S
""
-b
"
$BASEDN
"
-h
localhost
-p
$PORT
\
'objectclass=*'
| egrep
-iv
'^creatorsname:|^createtimestamp:'
>
\
$SEARCHOUT
2>&1
'objectclass=*'
>
$SEARCHOUT
2>&1
kill
-HUP
$PID
if
[
$RC
!=
0
]
;
then
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed!"
exit
$RC
fi
echo
"Comparing retrieved entries to LDIF file used to create database"
cmp
$SEARCHOUT
$LDIF
if
[
$?
!=
0
]
;
then
echo
"Filtering ldapsearch results..."
.
$SRCDIR
/scripts/acfilter.sh <
$SEARCHOUT
>
$SEARCHFLT
echo
"Filtering original ldif used to create database..."
.
$SRCDIR
/scripts/acfilter.sh <
$LDIF
>
$LDIFFLT
echo
"Comparing filter output..."
cmp
$SEARCHFLT
$LDIFFLT
if
test
$?
!=
0
;
then
echo
"comparison failed - database was not created correctly"
exit
1
fi
...
...
tests/scripts/test006-acls
View file @
cff36c38
#!/bin/sh
#!
/bin/sh
.
scripts/defines.sh
if
test
$#
-eq
0
;
then
SRCDIR
=
"."
else
SRCDIR
=
$1
;
shift
fi
if
test
$#
-eq
1
;
then
BACKEND
=
$1
;
shift
fi
echo
"running defines.sh
$SRCDIR
$BACKEND
"
.
$SRCDIR
/scripts/defines.sh
echo
"Cleaning up in
$DBDIR
..."
rm
-f
$DBDIR
/
*
rm
-f
$DBDIR
/
[!C]
*
echo
"Running ldif2ldbm to build slapd database..."
$LDIF2LDBM
-f
$CONF
-i
$LDIF
-e
../servers/slapd/tools
RC
=
$?
if
[
$RC
!=
0
]
;
then
if
test
$RC
!=
0
;
then
echo
"ldif2ldbm failed!"
exit
$RC
fi
echo
"Starting slapd on TCP/IP port
$PORT
..."
$SLAPD
-f
$ACLCONF
-p
$PORT
-d
1
>
/dev/null
2>&1 &
$SLAPD
-f
$ACLCONF
-p
$PORT
-d
$LVL
$TIMING
>
$MASTERLOG
2>&1 &
PID
=
$!
echo
"Testing slapd access control..."
for
i
in
0 1 2 3 4 5
;
do
$LDAPSEARCH
-L
-
S
""
-b
"
$BASEDN
"
-h
localhost
-p
$PORT
\
'
cn=Monitor
'
>
/dev/null 2>&1
$LDAPSEARCH
-L
-
b
"
$MONITOR
"
-h
localhost
-p
$PORT
\
'
objectclass=*
'
>
/dev/null 2>&1
RC
=
$?
if
[
$RC
=
1
]
;
then
if
test
$RC
=
1
;
then
echo
"Waiting 5 seconds for slapd to start..."
sleep
5
fi
done
if
[
$RC
!=
0
]
;
then
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed!"
kill
-HUP
$PID
exit
$RC
...
...
@@ -96,18 +106,24 @@ EOMODS4
echo
"Using ldapsearch to retrieve all the entries..."
$LDAPSEARCH
-L
-S
""
-b
"
$BASEDN
"
-h
localhost
-p
$PORT
\
'objectClass=*'
| egrep
-iv
'^modifytimestamp|^modifiersname'
\
>>
$SEARCHOUT
2>&1
'objectClass=*'
|
.
$SRCDIR
/scripts/acfilter.sh
>>
$SEARCHOUT
2>&1
RC
=
$?
kill
-HUP
$PID
if
[
$RC
!=
0
]
;
then
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed!"
exit
$RC
fi
echo
"Comparing database to reference file"
cmp
$SEARCHOUT
$ACLOUTMASTER
if
[
$?
!=
0
]
;
then
LDIF
=
$ACLOUTMASTER
echo
"Filtering ldapsearch results..."
.
$SRCDIR
/scripts/acfilter.sh <
$SEARCHOUT
>
$SEARCHFLT
echo
"Filtering original ldif used to create database..."
.
$SRCDIR
/scripts/acfilter.sh <
$LDIF
>
$LDIFFLT
echo
"Comparing filter output..."
cmp
$SEARCHFLT
$LDIFFLT
if
test
$?
!=
0
;
then
echo
"comparison failed - modify operations did not complete correctly"
exit
1
fi
...
...
tests/scripts/test007-replication
View file @
cff36c38
#!/bin/sh
#!
/bin/sh
#
# Test replication:
...
...
@@ -10,27 +10,43 @@
# - retrieve database over ldap and compare against expected results
#
.
scripts/defines.sh
if
test
$#
-eq
0
;
then
SRCDIR
=
"."
else
SRCDIR
=
$1
;
shift
fi
if
test
$#
-eq
1
;
then
BACKEND
=
$1
;
shift
fi
echo
"running defines.sh
$SRCDIR
$BACKEND
"
.
$SRCDIR
/scripts/defines.sh
if
test
!
-x
$SLURPD
;
then
echo
">>>>>
$SLURPD
is not executable or do not exist."
echo
">>>>> Test skipped."
exit
0
fi
echo
"Cleaning up in
$DBDIR
..."
rm
-f
$DBDIR
/
*
rm
-f
$DBDIR
/
[!C]
*
echo
"Cleaning up in
$REPLDIR
..."
rm
-f
$REPLDIR
/
*
rm
-f
$REPLDIR
/
[!C]
*
echo
"Starting master slapd on TCP/IP port
$PORT
..."
$SLAPD
-f
$MASTERCONF
-p
$PORT
-d
1
>
/dev/null
2>&1 &
$SLAPD
-f
$MASTERCONF
-p
$PORT
-d
$LVL
$TIMING
>
$MASTERLOG
2>&1 &
PID
=
$!
echo
"Starting slave slapd on TCP/IP port
$SLAVEPORT
..."
$SLAPD
-f
$SLAVECONF
-p
$SLAVEPORT
-d
1
>
/dev/null
2>&1 &
$SLAPD
-f
$SLAVECONF
-p
$SLAVEPORT
-d
$LVL
$TIMING
>
$SLAVELOG
2>&1 &
SLAVEPID
=
$!
echo
"Using ldapsearch to check that master slapd is running..."
for
i
in
0 1 2 3 4 5
;
do
$LDAPSEARCH
-L
-b
"
$
BASEDN
"
-h
localhost
-p
$PORT
\
'
cn=Monitor
'
>
/dev/null 2>&1
$LDAPSEARCH
-L
-b
"
$
MONITOR
"
-h
localhost
-p
$PORT
\
'
objectclass=*
'
>
/dev/null 2>&1
RC
=
$?
if
[
$RC
=
1
]
;
then
if
test
$RC
=
1
;
then
echo
"Waiting 5 seconds for slapd to start..."
sleep
5
fi
...
...
@@ -38,25 +54,25 @@ done
echo
"Using ldapsearch to check that slave slapd is running..."
for
i
in
0 1 2 3 4 5
;
do
$LDAPSEARCH
-L
-b
"
$
BASEDN
"
-h
localhost
-p
$SLAVEPORT
\
'
cn=Monitor
'
>
/dev/null 2>&1
$LDAPSEARCH
-L
-b
"
$
MONITOR
"
-h
localhost
-p
$SLAVEPORT
\
'
objectclass=*
'
>
/dev/null 2>&1
RC
=
$?
if
[
$RC
=
1
]
;
then
if
test
$RC
=
1
;
then
echo
"Waiting 5 seconds for slapd to start..."
sleep
5
fi
done
echo
"Starting slurpd..."
$SLURPD
-f
$MASTERCONF
-d
4
-t
$REPLDIR
>
/dev/null
2>&1 &
$SLURPD
-f
$MASTERCONF
-d
4
-t
$REPLDIR
>
$SLURPLOG
2>&1 &
SLURPPID
=
$!
echo
"Using ldap
modify
to populate the database..."
$LDAP
MODIFY
-a
-D
"
$MANAGERDN
"
-h
localhost
-p
$PORT
-w
$PASSWD
<
\
echo
"Using ldap
add
to populate the database..."
$LDAP
ADD
-D
"
$MANAGERDN
"
-h
localhost
-p
$PORT
-w
$PASSWD
<
\
$LDIFORDERED
>
/dev/null 2>&1
RC
=
$?
if
[
$RC
!=
0
]
;
then
echo
"ldap
modify
failed!"
if
test
$RC
!=
0
;
then
echo
"ldap
add
failed!"
kill
-HUP
$PID
$SLAVEPID
$SLURPPID
exit
$RC
fi
...
...
@@ -123,14 +139,14 @@ changetype: delete
EOMODS
echo
"Waiting 1
0
seconds for slurpd to send changes..."
sleep
1
0
echo
"Waiting 1
5
seconds for slurpd to send changes..."
sleep
1
5
echo
"Using ldapsearch to read all the entries from the master..."
$LDAPSEARCH
-L
-S
""
-b
"
$BASEDN
"
-h
localhost
-p
$PORT
\
'objectclass=*'
>
$MASTEROUT
2>&1
if
[
$RC
!=
0
]
;
then
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed!"
kill
-HUP
$PID
$SLAVEPID
$SLURPPID
exit
$RC
...
...
@@ -140,7 +156,7 @@ echo "Using ldapsearch to read all the entries from the slave..."
$LDAPSEARCH
-L
-S
""
-b
"
$BASEDN
"
-h
localhost
-p
$SLAVEPORT
\
'objectclass=*'
>
$SLAVEOUT
2>&1
if
[
$RC
!=
0
]
;
then
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed!"
kill
-HUP
$PID
$SLAVEPID
$SLURPPID
exit
$RC
...
...
@@ -148,9 +164,18 @@ fi
kill
-HUP
$PID
$SLAVEPID
$SLURPPID
SEARCHOUT
=
$MASTEROUT
LDIF
=
$SLAVEOUT
echo
"Filtering ldapsearch results..."
.
$SRCDIR
/scripts/acfilter.sh <
$SEARCHOUT
>
$SEARCHFLT
echo
"Filtering original ldif used to create database..."
.
$SRCDIR
/scripts/acfilter.sh <
$LDIF
>
$LDIFFLT
echo
"Comparing retrieved entries from master and slave..."
cmp
$MASTEROUT
$SLAVEOUT
if
[
$?
!=
0
]
;
then
cmp
$SEARCHFLT
$LDIFFLT
if
test
$?
!=
0
;
then
echo
"test failed - master and slave databases differ"
exit
1
fi
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment