Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
6809a942
Commit
6809a942
authored
Mar 05, 2021
by
Quanah Gibson-Mount
Browse files
ITS#9051 Regression test
parent
0c8afb03
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
tests/data/regressions/its9051/db.ldif
0 → 100644
View file @
6809a942
This diff is collapsed.
Click to expand it.
tests/data/regressions/its9051/its9051
0 → 100755
View file @
6809a942
#! /bin/sh
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2021 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
$ACCESSLOG
=
accesslogno
;
then
echo
"Accesslog overlay not available, test skipped"
exit
0
fi
XDIR
=
$TESTDIR
/srv
mkdir
-p
$TESTDIR
$SLAPPASSWD
-g
-n
>
$CONFIGPWF
ITS
=
9051
ITSDIR
=
$DATADIR
/regressions/its
$ITS
echo
"Initializing server configuration for provider..."
DBDIR
=
${
XDIR
}
/db
CFDIR
=
${
XDIR
}
/slapd.d
mkdir
-p
${
XDIR
}
$DBDIR
.1
$DBDIR
.2
$CFDIR
.
$CONFFILTER
$BACKEND
<
$ITSDIR
/slapd-provider.ldif
>
$CONFLDIF
$SLAPADD
-F
$CFDIR
-n
0
-l
$CONFLDIF
$SLAPADD
-F
$CFDIR
-q
-b
$BASEDN
-l
$ITSDIR
/db.ldif
KILLPIDS
=
CFDIR
=
${
XDIR
}
/slapd.d
echo
"Starting provider slapd on TCP/IP URI
$URI1
"
$SLAPD
-F
$CFDIR
-h
$URI1
-d
$LVL
>
$LOG1
2>&1 &
PID
=
$!
if
test
$WAIT
!=
0
;
then
echo
PID
$PID
read
foo
fi
KILLPIDS
=
"
$PID
$KILLPIDS
"
sleep
1
echo
"Using ldapsearch to check that provider slapd is running..."
for
i
in
0 1 2 3 4 5
;
do
$LDAPSEARCH
-s
base
-b
""
-H
$URI1
\
'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
echo
"Running ldapsearch to generate log ops..."
$LDAPSEARCH
-D
"
$MANAGERDN
"
-w
$PASSWD
-s
base
-b
$BASEDN
-H
$URI1
\
'objectclass=*'
>
/dev/null 2>&1
RC
=
$?
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed (
$RC
)!"
test
$KILLSERVERS
!=
no
&&
kill
-HUP
$KILLPIDS
exit
$RC
fi
echo
"Changing to read ops only..."
$LDAPMODIFY
-D
cn
=
config
-H
$URI1
-y
$CONFIGPWF
>
$TESTOUT
2>&1
<<
EOF
dn: olcOverlay={0}accesslog,olcDatabase={1}
$BACKEND
,cn=config
changetype: modify
delete: olcAccessLogOps
olcAccessLogOps: writes
EOF
RC
=
$?
if
test
$RC
!=
0
;
then
echo
"ldapmodify failed for server config (
$RC
)!"
test
$KILLSERVERS
!=
no
&&
kill
-HUP
$KILLPIDS
exit
$RC
fi
echo
"Running ldapsearch to generate log ops..."
$LDAPSEARCH
-D
"
$MANAGERDN
"
-w
$PASSWD
-s
base
-b
$BASEDN
-H
$URI1
\
'objectclass=*'
>
/dev/null 2>&1
RC
=
$?
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed (
$RC
)!"
test
$KILLSERVERS
!=
no
&&
kill
-HUP
$KILLPIDS
exit
$RC
fi
echo
"Changing to bind, search, compare ops only..."
$LDAPMODIFY
-D
cn
=
config
-H
$URI1
-y
$CONFIGPWF
>>
$TESTOUT
2>&1
<<
EOF
dn: olcOverlay={0}accesslog,olcDatabase={1}
$BACKEND
,cn=config
changetype: modify
replace: olcAccessLogOps
olcAccessLogOps: bind
olcAccessLogOps: compare
olcAccessLogOps: search
EOF
echo
"Running ldapsearch to generate log ops..."
$LDAPSEARCH
-D
"
$MANAGERDN
"
-w
$PASSWD
-s
base
-b
$BASEDN
-H
$URI1
\
'objectclass=*'
>
/dev/null 2>&1
RC
=
$?
if
test
$RC
!=
0
;
then
echo
"ldapsearch failed (
$RC
)!"
test
$KILLSERVERS
!=
no
&&
kill
-HUP
$KILLPIDS
exit
$RC
fi
echo
"Running ldapcompare to generate log ops..."
$LDAPCOMPARE
-D
"
$MANAGERDN
"
-w
$PASSWD
-H
$URI1
\
"uid=user.2,ou=user,
$BASEDN
"
"uidNumber:1006"
\
>>
$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
"Exporting accesslog database..."
$SLAPCAT
-F
$CFDIR
-b
cn
=
accesslog
-l
$TESTDIR
/accesslogdb.ldif
RC
=
$?
test
$KILLSERVERS
!=
no
&&
kill
-HUP
$KILLPIDS
# 1 root entry, 2 binds, 3 searches, 1 compare
count
=
7
if
test
$RC
!=
0
;
then
echo
">>>>> Test failed"
else
RC
=
`
grep
'^dn:'
$TESTDIR
/accesslogdb.ldif |
wc
-l
`
if
test
$RC
!=
$count
;
then
echo
">>>>> Test failed: expected
$count
entries, got"
$RC
RC
=
1
else
echo
">>>>> Test succeeded"
RC
=
0
fi
fi
test
$KILLSERVERS
!=
no
&&
wait
exit
$RC
tests/data/regressions/its9051/slapd-provider.ldif
0 → 100644
View file @
6809a942
dn: cn=config
objectClass: olcGlobal
cn: config
olcLogLevel: Sync
olcLogLevel: Stats
olcPidFile: @TESTDIR@/slapd.1.pid
olcArgsFile: @TESTDIR@/slapd.1.args
olcServerID: 1
dn: cn=schema,cn=config
objectClass: olcSchemaConfig
cn: schema
include: file://@TESTWD@/@SCHEMADIR@/core.ldif
include: file://@TESTWD@/@SCHEMADIR@/cosine.ldif
include: file://@TESTWD@/@SCHEMADIR@/inetorgperson.ldif
include: file://@TESTWD@/@SCHEMADIR@/misc.ldif
include: file://@TESTWD@/@SCHEMADIR@/nis.ldif
#mod#dn: cn=module{0},cn=config
#mod#objectClass: olcModuleList
#mod#cn: module{0}
#mod#olcModulePath: @TESTWD@/../servers/slapd/back-@BACKEND@/
#mod#olcModuleLoad: {0}back_@BACKEND@.la
#accesslogmod#dn: cn=module{1},cn=config
#accesslogmod#objectClass: olcModuleList
#accesslogmod#cn: module{1}
#accesslogmod#olcModulePath: @TESTWD@/../servers/slapd/overlays/
#accesslogmod#olcModuleLoad: {0}accesslog.la
dn: olcDatabase={-1}frontend,cn=config
objectClass: olcDatabaseConfig
objectClass: olcFrontendConfig
olcDatabase: {-1}frontend
olcAccess: {0}to dn="" by * read
olcAccess: {1}to * by self write by users read by anonymous auth
dn: olcDatabase={0}config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {0}config
olcAccess: {0}to * by * none
olcRootPW:< file://@TESTDIR@/configpw
dn: olcDatabase={1}@BACKEND@,cn=config
objectClass: olcDatabaseConfig
objectClass: olc@BACKEND@Config
olcDatabase: {1}@BACKEND@
olcSuffix: dc=example,dc=com
olcRootDN: cn=manager,dc=example,dc=com
olcRootPW: secret
olcSizeLimit: unlimited
olcTimeLimit: unlimited
#~null~#olcDbDirectory: @TESTDIR@/srv/db.1
#indexdb#olcDbIndex: default eq
#indexdb#olcDbIndex: objectClass
#indexdb#olcDbIndex: entryUUID
#indexdb#olcDbIndex: entryCSN
#indexdb#olcDbIndex: cn eq,sub,approx
#indexdb#olcDbIndex: givenName eq,sub,approx
#indexdb#olcDbIndex: displayname eq,sub,approx
#indexdb#olcDbIndex: uid eq,sub
#indexdb#olcDbIndex: uidNumber eq
#indexdb#olcDbIndex: gidNumber eq
#indexdb#olcDbIndex: mail eq,sub
#indexdb#olcDbIndex: sn eq,sub,approx
#indexdb#olcDbIndex: description eq,sub
#indexdb#olcDbIndex: title eq,sub
#indexdb#olcDbIndex: member
#indexdb#olcDbIndex: ou eq,sub,approx
#indexdb#olcDbIndex: memberUid
#mdb#olcDbMaxSize: 33554432
dn: olcOverlay={0}accesslog,olcDatabase={1}@BACKEND@,cn=config
objectClass: olcOverlayConfig
objectClass: olcAccessLogConfig
olcOverlay: {0}accesslog
olcAccessLogDB: cn=accesslog
olcAccessLogOps: reads
olcAccessLogOps: writes
olcAccessLogPurge: 07+00:00 01+00:00
olcAccessLogSuccess: TRUE
dn: olcDatabase={2}@BACKEND@,cn=config
objectClass: olcDatabaseConfig
objectClass: olc@BACKEND@Config
olcDatabase: {2}@BACKEND@
olcSuffix: cn=accesslog
olcSizeLimit: unlimited
olcTimeLimit: unlimited
olcDbIndex: default eq
olcDbIndex: entryCSN,objectClass,reqEnd,reqResult,reqStart,reqDN
#~null~#olcDbDirectory: @TESTDIR@/srv/db.2
#mdb#olcDbMaxSize: 33554432
dn: olcDatabase={3}monitor,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {3}monitor
olcAccess: {0}to dn.subtree="cn=monitor" by * read
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