mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
rework SQL tests invocation; improve all tests
This commit is contained in:
parent
23cbd59126
commit
b68129fc39
@ -19,11 +19,13 @@ SUBDIRS= progs
|
|||||||
BUILD_BDB=@BUILD_BDB@
|
BUILD_BDB=@BUILD_BDB@
|
||||||
BUILD_HDB=@BUILD_HDB@
|
BUILD_HDB=@BUILD_HDB@
|
||||||
BUILD_LDBM=@BUILD_LDBM@
|
BUILD_LDBM=@BUILD_LDBM@
|
||||||
|
BUILD_SQL=@BUILD_SQL@
|
||||||
|
|
||||||
test tests:
|
test tests:
|
||||||
@$(MAKE) bdb
|
@$(MAKE) bdb
|
||||||
@$(MAKE) hdb
|
@$(MAKE) hdb
|
||||||
@$(MAKE) ldbm
|
@$(MAKE) ldbm
|
||||||
|
@$(MAKE) sql
|
||||||
|
|
||||||
bdb test-bdb: bdb-$(BUILD_BDB)
|
bdb test-bdb: bdb-$(BUILD_BDB)
|
||||||
bdb-no:
|
bdb-no:
|
||||||
@ -49,6 +51,14 @@ ldbm-yes ldbm-mod: FORCE
|
|||||||
@echo "Initiating LDAP tests for LDBM..."
|
@echo "Initiating LDAP tests for LDBM..."
|
||||||
@$(RUN) -b ldbm all
|
@$(RUN) -b ldbm all
|
||||||
|
|
||||||
|
sql test-sql: sql-$(BUILD_SQL)
|
||||||
|
sql-no:
|
||||||
|
@echo "run configure with --enable-sql"
|
||||||
|
|
||||||
|
sql-yes sql-mod: FORCE
|
||||||
|
@echo "Initiating LDAP tests for SQL..."
|
||||||
|
@$(RUN) -b sql sql-all
|
||||||
|
|
||||||
clean-local: FORCE
|
clean-local: FORCE
|
||||||
-$(RM) -r testrun *leak *gmon *core
|
-$(RM) -r testrun *leak *gmon *core
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ verify basic functionality of the LDAP libraries, slapd, and slurpd.
|
|||||||
To run BDB tests, type "make bdb".
|
To run BDB tests, type "make bdb".
|
||||||
To run HDB tests, type "make hdb".
|
To run HDB tests, type "make hdb".
|
||||||
To run LDBM tests, type "make ldbm".
|
To run LDBM tests, type "make ldbm".
|
||||||
|
To run SQL tests, define SLAPD_USE_SQL=<rdbms> and type
|
||||||
|
"make sql"; define SLAPD_USE_SQLWRITE=yes
|
||||||
|
to enable write tests as well.
|
||||||
|
|
||||||
The test scripts depends on a number of tools commonly available on
|
The test scripts depends on a number of tools commonly available on
|
||||||
Unix (and Unix-like) systems. While attempts have been made to make
|
Unix (and Unix-like) systems. While attempts have been made to make
|
||||||
|
@ -44,8 +44,8 @@ access to *
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
database sql
|
database sql
|
||||||
suffix "o=Example,c=RU"
|
suffix "dc=example,dc=com"
|
||||||
rootdn "cn=Manager,o=Example,c=RU"
|
rootdn "cn=Manager,dc=example,dc=com"
|
||||||
rootpw secret
|
rootpw secret
|
||||||
dbname example
|
dbname example
|
||||||
dbuser manager
|
dbuser manager
|
||||||
|
339
tests/data/sql-read.out
Normal file
339
tests/data/sql-read.out
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
# Testing search...
|
||||||
|
dn: documentTitle=book1,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract1
|
||||||
|
documentTitle: book1
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
documentIdentifier: document 1
|
||||||
|
|
||||||
|
dn: documentTitle=book2,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract2
|
||||||
|
documentTitle: book2
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentIdentifier: document 2
|
||||||
|
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
dn: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Torvlobnor Puzdoy
|
||||||
|
sn: Puzdoy
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
givenName: Torvlobnor
|
||||||
|
telephoneNumber: 545-4563
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
||||||
|
# Testing exact search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing substrings initial search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing substrings any search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing substrings final search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing approx search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing extensible filter search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing search for telephoneNumber...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing AND search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing AND search on objectClass...
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
# Testing OR search...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
# Testing OR search on objectClass...
|
||||||
|
dn: documentTitle=book1,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract1
|
||||||
|
documentTitle: book1
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
documentIdentifier: document 1
|
||||||
|
|
||||||
|
dn: documentTitle=book2,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract2
|
||||||
|
documentTitle: book2
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentIdentifier: document 2
|
||||||
|
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
# Testing NOT search...
|
||||||
|
dn: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Torvlobnor Puzdoy
|
||||||
|
sn: Puzdoy
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
givenName: Torvlobnor
|
||||||
|
telephoneNumber: 545-4563
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
||||||
|
# Testing NOT search on objectClass...
|
||||||
|
dn: documentTitle=book1,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract1
|
||||||
|
documentTitle: book1
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
documentIdentifier: document 1
|
||||||
|
|
||||||
|
dn: documentTitle=book2,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract2
|
||||||
|
documentTitle: book2
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentIdentifier: document 2
|
||||||
|
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
# Testing NOT search on "auxiliary" objectClass...
|
||||||
|
dn: documentTitle=book1,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract1
|
||||||
|
documentTitle: book1
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentAuthor: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
documentIdentifier: document 1
|
||||||
|
|
||||||
|
dn: documentTitle=book2,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract2
|
||||||
|
documentTitle: book2
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentIdentifier: document 2
|
||||||
|
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
dn: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Torvlobnor Puzdoy
|
||||||
|
sn: Puzdoy
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
givenName: Torvlobnor
|
||||||
|
telephoneNumber: 545-4563
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
||||||
|
# Testing NOT search on sn...
|
||||||
|
# Testing attribute inheritance in filter...
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
# Testing objectClass inheritance in filter...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
|
||||||
|
dn: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Torvlobnor Puzdoy
|
||||||
|
sn: Puzdoy
|
||||||
|
seeAlso: documentTitle=book1,dc=example,dc=com
|
||||||
|
givenName: Torvlobnor
|
||||||
|
telephoneNumber: 545-4563
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
||||||
|
# Testing "auxiliary" objectClass in filter...
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
||||||
|
# Testing hasSubordinates in filter...
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
||||||
|
# Testing attribute inheritance in requested attributes...
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
givenName: Mitya
|
||||||
|
|
||||||
|
# Testing objectClass in requested attributes...
|
||||||
|
dn: documentTitle=book1,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
|
||||||
|
dn: documentTitle=book2,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
|
||||||
|
dn: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
||||||
|
# Testing operational attributes in request...
|
||||||
|
dn: documentTitle=book1,dc=example,dc=com
|
||||||
|
structuralObjectClass: document
|
||||||
|
subschemaSubentry: cn=Subschema
|
||||||
|
hasSubordinates: FALSE
|
||||||
|
|
||||||
|
dn: documentTitle=book2,dc=example,dc=com
|
||||||
|
structuralObjectClass: document
|
||||||
|
subschemaSubentry: cn=Subschema
|
||||||
|
hasSubordinates: FALSE
|
||||||
|
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
structuralObjectClass: organization
|
||||||
|
subschemaSubentry: cn=Subschema
|
||||||
|
hasSubordinates: TRUE
|
||||||
|
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
structuralObjectClass: inetOrgPerson
|
||||||
|
subschemaSubentry: cn=Subschema
|
||||||
|
hasSubordinates: FALSE
|
||||||
|
|
||||||
|
dn: cn=Torvlobnor Puzdoy,dc=example,dc=com
|
||||||
|
structuralObjectClass: inetOrgPerson
|
||||||
|
subschemaSubentry: cn=Subschema
|
||||||
|
hasSubordinates: FALSE
|
||||||
|
|
||||||
|
# refldap://localhost/dc=example,dc=com??sub
|
||||||
|
|
64
tests/data/sql-write.out
Normal file
64
tests/data/sql-write.out
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
dn: documentTitle=book2,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: abstract2
|
||||||
|
documentTitle: book2
|
||||||
|
documentAuthor: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
|
||||||
|
documentIdentifier: document 2
|
||||||
|
|
||||||
|
dn: documentTitle=War and Peace,dc=example,dc=com
|
||||||
|
objectClass: document
|
||||||
|
description: Historical novel
|
||||||
|
documentTitle: War and Peace
|
||||||
|
documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
|
||||||
|
documentIdentifier: document 3
|
||||||
|
|
||||||
|
dn: dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: Example
|
||||||
|
dc: example
|
||||||
|
|
||||||
|
dn: dc=subnet,dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: SubNet
|
||||||
|
dc: subnet
|
||||||
|
|
||||||
|
dn: o=Another Org,dc=example,dc=com
|
||||||
|
objectClass: organization
|
||||||
|
o: Another Org
|
||||||
|
|
||||||
|
dn: cn=Mitya Kovalev,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Mitya Kovalev
|
||||||
|
sn: Kovalev
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
givenName: Mitya
|
||||||
|
telephoneNumber: 332-2334
|
||||||
|
telephoneNumber: 222-3234
|
||||||
|
telephoneNumber: +1 800 123 4567
|
||||||
|
|
||||||
|
dn: cn=Lev Tolstoij,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Lev Tolstoij
|
||||||
|
sn: Tolstoij
|
||||||
|
seeAlso: documentTitle=book2,dc=example,dc=com
|
||||||
|
seeAlso: documentTitle=War and Peace,dc=example,dc=com
|
||||||
|
givenName: Lev
|
||||||
|
telephoneNumber: +39 02 XXXX ZZZZ
|
||||||
|
telephoneNumber: +39 333 ZZZ 1234
|
||||||
|
|
||||||
|
dn: cn=Some One,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
objectClass: simpleSecurityObject
|
||||||
|
cn: Some One
|
||||||
|
sn: One
|
||||||
|
givenName: Some
|
||||||
|
|
||||||
|
dn: cn=SubNet User,dc=subnet,dc=example,dc=com
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: SubNet User
|
||||||
|
sn: User
|
||||||
|
givenName: SubNet
|
||||||
|
|
@ -1,212 +0,0 @@
|
|||||||
# Testing search...
|
|
||||||
dn: documentTitle=book1,o=Example,c=RU
|
|
||||||
objectClass: document
|
|
||||||
description: abstract1
|
|
||||||
documentTitle: book1
|
|
||||||
documentAuthor: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
documentAuthor: cn=Torvlobnor Puzdoy,o=Example,c=RU
|
|
||||||
documentIdentifier: document 1
|
|
||||||
|
|
||||||
dn: documentTitle=book2,o=Example,c=RU
|
|
||||||
objectClass: document
|
|
||||||
description: abstract2
|
|
||||||
documentTitle: book2
|
|
||||||
documentAuthor: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
documentIdentifier: document 2
|
|
||||||
|
|
||||||
dn: o=Example,c=RU
|
|
||||||
objectClass: organization
|
|
||||||
o: Example
|
|
||||||
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
dn: cn=Torvlobnor Puzdoy,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
cn: Torvlobnor Puzdoy
|
|
||||||
sn: Puzdoy
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
givenName: Torvlobnor
|
|
||||||
telephoneNumber: 545-4563
|
|
||||||
|
|
||||||
# refldap://localhost/o=Example,c=RU??sub
|
|
||||||
|
|
||||||
# Testing exact search...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
# Testing substrings initial search...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
# Testing substrings any search...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
# Testing substrings final search...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
# Testing approx search...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
# Testing extensible filter search...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
# Testing attribute inheritance in filter...
|
|
||||||
dn: o=Example,c=RU
|
|
||||||
objectClass: organization
|
|
||||||
o: Example
|
|
||||||
|
|
||||||
# Testing objectClass inheritance in filter...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
dn: cn=Torvlobnor Puzdoy,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
cn: Torvlobnor Puzdoy
|
|
||||||
sn: Puzdoy
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
givenName: Torvlobnor
|
|
||||||
telephoneNumber: 545-4563
|
|
||||||
|
|
||||||
# refldap://localhost/o=Example,c=RU??sub
|
|
||||||
|
|
||||||
# Testing "auxiliary" objectClass in filter...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
|
|
||||||
# Testing hasSubordinates in filter...
|
|
||||||
dn: o=Example,c=RU
|
|
||||||
objectClass: organization
|
|
||||||
o: Example
|
|
||||||
|
|
||||||
# refldap://localhost/o=Example,c=RU??sub
|
|
||||||
|
|
||||||
# Testing attribute inheritance in requested attributes...
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
givenName: Mitya
|
|
||||||
|
|
||||||
# Testing objectClass in requested attributes...
|
|
||||||
dn: documentTitle=book1,o=Example,c=RU
|
|
||||||
objectClass: document
|
|
||||||
|
|
||||||
dn: documentTitle=book2,o=Example,c=RU
|
|
||||||
objectClass: document
|
|
||||||
|
|
||||||
dn: o=Example,c=RU
|
|
||||||
objectClass: organization
|
|
||||||
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
|
|
||||||
dn: cn=Torvlobnor Puzdoy,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
|
|
||||||
# refldap://localhost/o=Example,c=RU??sub
|
|
||||||
|
|
||||||
# Testing operational attributes in request...
|
|
||||||
dn: documentTitle=book1,o=Example,c=RU
|
|
||||||
structuralObjectClass: document
|
|
||||||
subschemaSubentry: cn=Subschema
|
|
||||||
hasSubordinates: FALSE
|
|
||||||
|
|
||||||
dn: documentTitle=book2,o=Example,c=RU
|
|
||||||
structuralObjectClass: document
|
|
||||||
subschemaSubentry: cn=Subschema
|
|
||||||
hasSubordinates: FALSE
|
|
||||||
|
|
||||||
dn: o=Example,c=RU
|
|
||||||
structuralObjectClass: organization
|
|
||||||
subschemaSubentry: cn=Subschema
|
|
||||||
hasSubordinates: TRUE
|
|
||||||
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
structuralObjectClass: inetOrgPerson
|
|
||||||
subschemaSubentry: cn=Subschema
|
|
||||||
hasSubordinates: FALSE
|
|
||||||
|
|
||||||
dn: cn=Torvlobnor Puzdoy,o=Example,c=RU
|
|
||||||
structuralObjectClass: inetOrgPerson
|
|
||||||
subschemaSubentry: cn=Subschema
|
|
||||||
hasSubordinates: FALSE
|
|
||||||
|
|
||||||
# refldap://localhost/o=Example,c=RU??sub
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
dn: documentTitle=book1,o=Example,c=RU
|
|
||||||
objectClass: document
|
|
||||||
description: abstract1
|
|
||||||
documentTitle: book1
|
|
||||||
documentAuthor: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
documentAuthor: cn=Pierangelo Masarati,o=Example,c=RU
|
|
||||||
documentIdentifier: document 1
|
|
||||||
|
|
||||||
dn: documentTitle=book2,o=Example,c=RU
|
|
||||||
objectClass: document
|
|
||||||
description: abstract2
|
|
||||||
documentTitle: book2
|
|
||||||
documentAuthor: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
documentAuthor: cn=Pierangelo Masarati,o=Example,c=RU
|
|
||||||
documentIdentifier: document 2
|
|
||||||
|
|
||||||
dn: o=Example,c=RU
|
|
||||||
objectClass: organization
|
|
||||||
o: Example
|
|
||||||
|
|
||||||
dn: o=Another Org,o=Example,c=RU
|
|
||||||
objectClass: organization
|
|
||||||
o: Another Org
|
|
||||||
|
|
||||||
dn: cn=Mitya Kovalev,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
objectClass: posixAccount
|
|
||||||
cn: Mitya Kovalev
|
|
||||||
sn: Kovalev
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Mitya
|
|
||||||
telephoneNumber: 332-2334
|
|
||||||
telephoneNumber: 222-3234
|
|
||||||
telephoneNumber: +1 800 123 4567
|
|
||||||
|
|
||||||
# refldap://localhost/o=Example,c=RU??sub
|
|
||||||
|
|
||||||
dn: cn=Pierangelo Masarati,o=Example,c=RU
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
cn: Pierangelo Masarati
|
|
||||||
sn: Masarati
|
|
||||||
seeAlso: documentTitle=book1,o=Example,c=RU
|
|
||||||
seeAlso: documentTitle=book2,o=Example,c=RU
|
|
||||||
givenName: Pierangelo
|
|
||||||
telephoneNumber: +39 02 XXXX ZZZZ
|
|
||||||
telephoneNumber: +39 333 ZZZ 1234
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
|||||||
SHTOOL="$SRCDIR/../build/shtool"
|
SHTOOL="$SRCDIR/../build/shtool"
|
||||||
TB=`$SHTOOL echo -e "%B"`
|
TB=`$SHTOOL echo -e "%B"`
|
||||||
TN=`$SHTOOL echo -e "%b"`
|
TN=`$SHTOOL echo -e "%b"`
|
||||||
|
SLEEPTIME=10
|
||||||
|
|
||||||
echo ">>>>> Executing all LDAP tests for $BACKEND"
|
echo ">>>>> Executing all LDAP tests for $BACKEND"
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ for CMD in $SRCDIR/scripts/test*; do
|
|||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ">>>>> waiting 10 seconds for things to exit"
|
echo ">>>>> waiting $SLEEPTIME seconds for things to exit"
|
||||||
sleep 10
|
sleep $SLEEPTIME
|
||||||
echo ""
|
echo ""
|
||||||
done
|
done
|
||||||
|
@ -222,8 +222,8 @@ IDASSERTOUT=$DATADIR/idassert.out
|
|||||||
LDAPGLUEOUT=$DATADIR/ldapglue.out
|
LDAPGLUEOUT=$DATADIR/ldapglue.out
|
||||||
LDAPGLUEANONYMOUSOUT=$DATADIR/ldapglueanonymous.out
|
LDAPGLUEANONYMOUSOUT=$DATADIR/ldapglueanonymous.out
|
||||||
RELAYOUT=$DATADIR/relay.out
|
RELAYOUT=$DATADIR/relay.out
|
||||||
SQLMASTER=$DATADIR/sqlmaster.out
|
SQLREAD=$DATADIR/sql-read.out
|
||||||
SQLMODS=$DATADIR/sqlmods.out
|
SQLWRITE=$DATADIR/sql-write.out
|
||||||
|
|
||||||
# Just in case we linked the binaries dynamically
|
# Just in case we linked the binaries dynamically
|
||||||
LD_LIBRARY_PATH=`pwd`/../libraries:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH
|
LD_LIBRARY_PATH=`pwd`/../libraries:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH
|
||||||
|
53
tests/scripts/sql-all
Executable file
53
tests/scripts/sql-all
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# $OpenLDAP$
|
||||||
|
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||||
|
##
|
||||||
|
## Copyright 1998-2004 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>.
|
||||||
|
|
||||||
|
SHTOOL="$SRCDIR/../build/shtool"
|
||||||
|
TB=`$SHTOOL echo -e "%B"`
|
||||||
|
TN=`$SHTOOL echo -e "%b"`
|
||||||
|
SLEEPTIME=10
|
||||||
|
|
||||||
|
echo "### SQL tests require the sql backend, a properly configured"
|
||||||
|
echo "### ODBC and a database poulated with data from the applicable"
|
||||||
|
echo "### servers/slapd/back-sql/rdbms_depend/* files."
|
||||||
|
echo "### Set SLAPD_USE_SQL to the desired RDBMS to enable this test;"
|
||||||
|
echo "### Supported RDBMSes are: mysql,postgres"
|
||||||
|
echo "### Set SLAPD_USE_SQLWRITE=yes to enable the write tests"
|
||||||
|
echo "### See servers/slapd/back-sql/rdbms_depend/README for more "
|
||||||
|
echo "### details on how to set up the RDBMS and the ODBC"
|
||||||
|
|
||||||
|
echo ">>>>> Executing all LDAP tests for $BACKEND"
|
||||||
|
|
||||||
|
for CMD in $SRCDIR/scripts/sql-test*; do
|
||||||
|
# remove cruft from prior test
|
||||||
|
if test $PRESERVE = yes ; then
|
||||||
|
/bin/rm -rf testrun/db.*
|
||||||
|
else
|
||||||
|
/bin/rm -rf testrun
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ">>>>> Starting ${TB}`basename $CMD`${TN} ..."
|
||||||
|
$CMD
|
||||||
|
RC=$?
|
||||||
|
if test $RC -eq 0 ; then
|
||||||
|
echo ">>>>> $CMD completed ${TB}OK${TN}."
|
||||||
|
else
|
||||||
|
echo ">>>>> $CMD ${TB}failed${TN} (exit $RC)"
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ">>>>> waiting $SLEEPTIME seconds for things to exit"
|
||||||
|
sleep $SLEEPTIME
|
||||||
|
echo ""
|
||||||
|
done
|
@ -16,15 +16,6 @@
|
|||||||
echo "running defines.sh"
|
echo "running defines.sh"
|
||||||
. $SRCDIR/scripts/defines.sh
|
. $SRCDIR/scripts/defines.sh
|
||||||
|
|
||||||
echo "### This test requires the sql backend, a properly configured"
|
|
||||||
echo "### ODBC and a database poulated with data from the applicable"
|
|
||||||
echo "### servers/slapd/back-sql/rdbms_depend/* files."
|
|
||||||
echo "### Set SLAPD_USE_SQL to the desired RDBMS to enable this test;"
|
|
||||||
echo "### Supported RDBMSes are: mysql,postgres"
|
|
||||||
echo "### Set SLAPD_USE_SQLWRITE=yes to enable the write test"
|
|
||||||
echo "### See servers/slapd/back-sql/rdbms_depend/README for more "
|
|
||||||
echo "### details on how to set up the RDBMS and the ODBC"
|
|
||||||
|
|
||||||
if test $BACKSQL = "sqlno" ; then
|
if test $BACKSQL = "sqlno" ; then
|
||||||
echo "SQL backend not available, test skipped"
|
echo "SQL backend not available, test skipped"
|
||||||
exit 0
|
exit 0
|
||||||
@ -47,7 +38,7 @@ if test $WAIT != 0 ; then
|
|||||||
fi
|
fi
|
||||||
KILLPIDS="$PID"
|
KILLPIDS="$PID"
|
||||||
|
|
||||||
echo "Testing SQL backend operations..."
|
echo "Testing SQL backend read operations..."
|
||||||
for i in 0 1 2 3 4 5; do
|
for i in 0 1 2 3 4 5; do
|
||||||
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
|
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
|
||||||
'objectclass=*' > /dev/null 2>&1
|
'objectclass=*' > /dev/null 2>&1
|
||||||
@ -65,10 +56,10 @@ if test $RC != 0 ; then
|
|||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BASEDN="o=Example,c=RU"
|
BASEDN="dc=example,dc=com"
|
||||||
BINDDN="cn=Mitya Kovalev,${BASEDN}"
|
BINDDN="cn=Mitya Kovalev,${BASEDN}"
|
||||||
BINDPW="mit"
|
BINDPW="mit"
|
||||||
echo "Testing bind..."
|
echo -n "Testing correct bind... "
|
||||||
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $BINDPW
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $BINDPW
|
||||||
RC=$?
|
RC=$?
|
||||||
if test $RC != 0 ; then
|
if test $RC != 0 ; then
|
||||||
@ -77,6 +68,15 @@ if test $RC != 0 ; then
|
|||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -n "Testing incorrect bind (should fail)... "
|
||||||
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w "XXX"
|
||||||
|
RC=$?
|
||||||
|
if test $RC == 0 ; then
|
||||||
|
echo "ldapwhoami should have failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Testing search..."
|
echo "Testing search..."
|
||||||
echo "# Testing search..." > $SEARCHOUT
|
echo "# Testing search..." > $SEARCHOUT
|
||||||
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" >> $SEARCHOUT 2>&1
|
||||||
@ -160,6 +160,115 @@ if test $RC != 0 ; then
|
|||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Testing search for telephoneNumber..."
|
||||||
|
echo "# Testing search for telephoneNumber..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
"(telephoneNumber=3322334)" >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing AND search..."
|
||||||
|
echo "# Testing AND search..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
"(&(sn=kovalev)(givenName=mitya))" >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing AND search on objectClass..."
|
||||||
|
echo "# Testing AND search on objectClass..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
"(&(objectClass=organization)(objectClass=dcObject))" >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing OR search..."
|
||||||
|
echo "# Testing OR search..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
"(|(sn=kovalev)(givenName=mitya))" >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing OR search on objectClass..."
|
||||||
|
echo "# Testing OR search on objectClass..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
"(|(objectClass=document)(objectClass=organization))" >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing NOT search..."
|
||||||
|
echo "# Testing NOT search..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
'(!(sn=kovalev))' >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing NOT search on objectClass..."
|
||||||
|
echo "# Testing NOT search on objectClass..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
'(!(objectClass=inetOrgPerson))' >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing NOT search on \"auxiliary\" objectClass..."
|
||||||
|
echo "# Testing NOT search on \"auxiliary\" objectClass..." >> $SEARCHOUT
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
'(!(objectClass=dcObject))' >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
#### Needs work...
|
||||||
|
echo "Testing NOT presence search... (disabled)"
|
||||||
|
###echo "# Testing NOT search on sn..." >> $SEARCHOUT
|
||||||
|
###$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
### '(!(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 attribute inheritance in filter..."
|
echo "Testing attribute inheritance in filter..."
|
||||||
echo "# Testing attribute inheritance in filter..." >> $SEARCHOUT
|
echo "# Testing attribute inheritance in filter..." >> $SEARCHOUT
|
||||||
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
@ -187,7 +296,7 @@ fi
|
|||||||
echo "Testing \"auxiliary\" objectClass in filter..."
|
echo "Testing \"auxiliary\" objectClass in filter..."
|
||||||
echo "# Testing \"auxiliary\" objectClass in filter..." >> $SEARCHOUT
|
echo "# Testing \"auxiliary\" objectClass in filter..." >> $SEARCHOUT
|
||||||
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
"(objectClass=posixAccount)" >> $SEARCHOUT 2>&1
|
"(objectClass=dcObject)" >> $SEARCHOUT 2>&1
|
||||||
|
|
||||||
RC=$?
|
RC=$?
|
||||||
if test $RC != 0 ; then
|
if test $RC != 0 ; then
|
||||||
@ -244,143 +353,76 @@ if test $RC != 0 ; then
|
|||||||
exit $RC
|
exit $RC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -n "Testing compare (should be TRUE)... "
|
||||||
|
$LDAPCOMPARE -h $LOCALHOST -p $PORT1 "$BINDDN" \
|
||||||
|
"sn:kovalev" >> $TESTOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
case $RC in
|
||||||
|
6)
|
||||||
|
echo "TRUE"
|
||||||
|
;;
|
||||||
|
5) echo "FALSE!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
;;
|
||||||
|
*) echo "failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo -n "Testing compare (should be FALSE)... "
|
||||||
|
$LDAPCOMPARE -h $LOCALHOST -p $PORT1 "$BINDDN" \
|
||||||
|
"cn:foobar" >> $TESTOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
case $RC in
|
||||||
|
6)
|
||||||
|
echo "TRUE!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
;;
|
||||||
|
5) echo "FALSE"
|
||||||
|
;;
|
||||||
|
*) echo "failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo -n "Testing compare (should be UNDEFINED)... "
|
||||||
|
$LDAPCOMPARE -h $LOCALHOST -p $PORT1 "$BINDDN" \
|
||||||
|
"o:example" >> $TESTOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
case $RC in
|
||||||
|
6)
|
||||||
|
echo "TRUE!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
;;
|
||||||
|
5) echo "FALSE!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
;;
|
||||||
|
*) echo "failed ($RC)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "Filtering ldapsearch results..."
|
echo "Filtering ldapsearch results..."
|
||||||
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
||||||
echo "Filtering original ldif..."
|
echo "Filtering original ldif..."
|
||||||
. $LDIFFILTER < $SQLMASTER > $LDIFFLT
|
. $LDIFFILTER < $SQLREAD > $LDIFFLT
|
||||||
echo "Comparing filter output..."
|
echo "Comparing filter output..."
|
||||||
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
|
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
|
||||||
|
|
||||||
if test $? != 0 ; then
|
if test $? != 0 ; then
|
||||||
echo "comparison failed - SQL master search didn't succeed"
|
echo "comparison failed - SQL search didn't succeed"
|
||||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Testing modify, add, and delete..."
|
|
||||||
if test "${RDBMSWRITE}" != "yes"; then
|
|
||||||
echo "write test disabled; set SLAPD_USE_SQLWRITE=yes to enable"
|
|
||||||
else
|
|
||||||
case ${RDBMS} in
|
|
||||||
# list here the RDBMSes whose mapping allows writes
|
|
||||||
postgres)
|
|
||||||
MANAGERDN="cn=Manager,${BASEDN}"
|
|
||||||
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
|
||||||
-h $LOCALHOST -p $PORT1 > \
|
|
||||||
$TESTOUT 2>&1 << EOMODS
|
|
||||||
version: 1
|
|
||||||
|
|
||||||
dn: cn=Mitya Kovalev,${BASEDN}
|
|
||||||
changetype: modify
|
|
||||||
add: telephoneNumber
|
|
||||||
telephoneNumber: +1 800 123 4567
|
|
||||||
-
|
|
||||||
|
|
||||||
dn: cn=Pierangelo Masarati,${BASEDN}
|
|
||||||
changetype: add
|
|
||||||
objectClass: inetOrgPerson
|
|
||||||
cn: Pierangelo Masarati
|
|
||||||
sn: Masarati
|
|
||||||
givenName: Pierangelo
|
|
||||||
telephoneNumber: +39 02 XXXX YYYY
|
|
||||||
telephoneNumber: +39 02 XXXX ZZZZ
|
|
||||||
|
|
||||||
dn: cn=Pierangelo Masarati,${BASEDN}
|
|
||||||
changetype: modify
|
|
||||||
delete: telephoneNumber
|
|
||||||
telephoneNumber: +39 02 XXXX YYYY
|
|
||||||
-
|
|
||||||
add: telephoneNumber
|
|
||||||
telephoneNumber: +39 333 ZZZ 1234
|
|
||||||
-
|
|
||||||
|
|
||||||
dn: cn=Torvlobnor Puzdoy,${BASEDN}
|
|
||||||
changetype: delete
|
|
||||||
|
|
||||||
dn: o=An Org,${BASEDN}
|
|
||||||
changetype: add
|
|
||||||
objectClass: organization
|
|
||||||
o: An Org
|
|
||||||
|
|
||||||
dn: o=An Org,${BASEDN}
|
|
||||||
changetype: modrdn
|
|
||||||
newrdn: o=Another Org
|
|
||||||
deleteoldrdn: 1
|
|
||||||
|
|
||||||
dn: documentTitle=book1,${BASEDN}
|
|
||||||
changetype: modify
|
|
||||||
add: documentAuthor
|
|
||||||
documentAuthor: cn=Pierangelo Masarati,${BASEDN}
|
|
||||||
-
|
|
||||||
|
|
||||||
dn: documentTitle=book2,${BASEDN}
|
|
||||||
changetype: modify
|
|
||||||
add: documentAuthor
|
|
||||||
documentAuthor: cn=Pierangelo Masarati,${BASEDN}
|
|
||||||
-
|
|
||||||
|
|
||||||
EOMODS
|
|
||||||
|
|
||||||
RC=$?
|
|
||||||
if test $RC != 0 ; then
|
|
||||||
echo "ldapmodify failed ($RC)!"
|
|
||||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
||||||
exit $RC
|
|
||||||
fi
|
|
||||||
|
|
||||||
NEWPW="newsecret"
|
|
||||||
echo "Testing passwd change..."
|
|
||||||
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
|
||||||
-D "${BINDDN}" -w ${BINDPW} -s ${NEWPW} \
|
|
||||||
"$BINDDN" >> $TESTOUT 2>&1
|
|
||||||
|
|
||||||
RC=$?
|
|
||||||
if test $RC != 0 ; then
|
|
||||||
echo "ldappasswd failed ($RC)!"
|
|
||||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
||||||
exit $RC
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Testing bind with new secret..."
|
|
||||||
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $NEWPW
|
|
||||||
RC=$?
|
|
||||||
if test $RC != 0 ; then
|
|
||||||
echo "ldapwhoami failed ($RC)!"
|
|
||||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
||||||
exit $RC
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using ldapsearch to retrieve all the entries..."
|
|
||||||
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
|
||||||
"objectClass=*" > $SEARCHOUT 2>&1
|
|
||||||
|
|
||||||
RC=$?
|
|
||||||
if test $RC != 0 ; then
|
|
||||||
echo "ldapsearch failed ($RC)!"
|
|
||||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
||||||
exit $RC
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Filtering ldapsearch results..."
|
|
||||||
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
|
||||||
echo "Filtering modified ldif..."
|
|
||||||
. $LDIFFILTER < $SQLMODS > $LDIFFLT
|
|
||||||
echo "Comparing filter output..."
|
|
||||||
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
|
|
||||||
|
|
||||||
if test $? != 0 ; then
|
|
||||||
echo "comparison failed - SQL mods search didn't succeed"
|
|
||||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "apparently ${RDBMS} does not support writes; skipping..."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
|
||||||
echo ">>>>> Test succeeded"
|
echo ">>>>> Test succeeded"
|
322
tests/scripts/sql-test900-write
Executable file
322
tests/scripts/sql-test900-write
Executable file
@ -0,0 +1,322 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# $OpenLDAP$
|
||||||
|
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
||||||
|
##
|
||||||
|
## Copyright 1998-2004 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 $BACKSQL = "sqlno" ; then
|
||||||
|
echo "SQL backend not available, test skipped"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $RDBMS = "rdbmsno" ; then
|
||||||
|
echo "SQL test not requested, test skipped"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "${RDBMSWRITE}" != "yes"; then
|
||||||
|
echo "write test disabled for ${RDBMS}; set SLAPD_USE_SQLWRITE=yes to enable"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $TESTDIR
|
||||||
|
|
||||||
|
echo "Starting slapd on TCP/IP port $PORT1..."
|
||||||
|
. $CONFFILTER $BACKEND $MONITORDB < $SQLCONF > $CONF1
|
||||||
|
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
|
||||||
|
PID=$!
|
||||||
|
if test $WAIT != 0 ; then
|
||||||
|
echo PID $PID
|
||||||
|
read foo
|
||||||
|
fi
|
||||||
|
KILLPIDS="$PID"
|
||||||
|
|
||||||
|
echo "Testing SQL backend write operations..."
|
||||||
|
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
|
||||||
|
|
||||||
|
BASEDN="dc=example,dc=com"
|
||||||
|
case ${RDBMS} in
|
||||||
|
# list here the RDBMSes whose mapping allows writes
|
||||||
|
postgres)
|
||||||
|
MANAGERDN="cn=Manager,${BASEDN}"
|
||||||
|
echo "Testing add..."
|
||||||
|
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||||
|
-h $LOCALHOST -p $PORT1 > \
|
||||||
|
$TESTOUT 2>&1 << EOMODS
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
# Adding an organization...
|
||||||
|
dn: o=An Org,${BASEDN}
|
||||||
|
changetype: add
|
||||||
|
objectClass: organization
|
||||||
|
o: An Org
|
||||||
|
|
||||||
|
# Adding an organization with an "auxiliary" objectClass..
|
||||||
|
dn: dc=subnet,${BASEDN}
|
||||||
|
changetype: add
|
||||||
|
objectClass: organization
|
||||||
|
objectClass: dcObject
|
||||||
|
o: SubNet
|
||||||
|
dc: subnet
|
||||||
|
|
||||||
|
# Adding a person...
|
||||||
|
dn: cn=Lev Tolstoij,${BASEDN}
|
||||||
|
changetype: add
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: Lev Tolstoij
|
||||||
|
sn: Tolstoij
|
||||||
|
givenName: Lev
|
||||||
|
telephoneNumber: +39 02 XXXX YYYY
|
||||||
|
telephoneNumber: +39 02 XXXX ZZZZ
|
||||||
|
|
||||||
|
# Adding a person with an "auxiliary" objectClass...
|
||||||
|
dn: cn=Some One,${BASEDN}
|
||||||
|
changetype: add
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
objectClass: simpleSecurityObject
|
||||||
|
cn: Some One
|
||||||
|
sn: One
|
||||||
|
givenName: Some
|
||||||
|
telephoneNumber: +1 800 900 1234
|
||||||
|
telephoneNumber: +1 800 900 1235
|
||||||
|
userPassword: someone
|
||||||
|
|
||||||
|
# Adding a person in another subtree...
|
||||||
|
dn: cn=SubNet User,dc=subnet,${BASEDN}
|
||||||
|
changetype: add
|
||||||
|
objectClass: inetOrgPerson
|
||||||
|
cn: SubNet User
|
||||||
|
sn: User
|
||||||
|
givenName: SubNet
|
||||||
|
|
||||||
|
# Adding a document...
|
||||||
|
dn: documentTitle=War and Peace,${BASEDN}
|
||||||
|
changetype: add
|
||||||
|
objectClass: document
|
||||||
|
description: Historical novel
|
||||||
|
documentTitle: War and Peace
|
||||||
|
documentAuthor: cn=Lev Tolstoij,dc=example,dc=com
|
||||||
|
documentIdentifier: document 3
|
||||||
|
|
||||||
|
EOMODS
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapmodify failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing modify..."
|
||||||
|
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||||
|
-h $LOCALHOST -p $PORT1 > \
|
||||||
|
$TESTOUT 2>&1 << EOMODS
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
# Deleting all telephone numbers...
|
||||||
|
dn: cn=Some One,${BASEDN}
|
||||||
|
changetype: modify
|
||||||
|
delete: telephoneNumber
|
||||||
|
-
|
||||||
|
|
||||||
|
# Adding a telephone number...
|
||||||
|
dn: cn=Mitya Kovalev,${BASEDN}
|
||||||
|
changetype: modify
|
||||||
|
add: telephoneNumber
|
||||||
|
telephoneNumber: +1 800 123 4567
|
||||||
|
-
|
||||||
|
|
||||||
|
# Deleting a specific telephone number and adding a new one...
|
||||||
|
dn: cn=Lev Tolstoij,${BASEDN}
|
||||||
|
changetype: modify
|
||||||
|
delete: telephoneNumber
|
||||||
|
telephoneNumber: +39 02 XXXX YYYY
|
||||||
|
-
|
||||||
|
add: telephoneNumber
|
||||||
|
telephoneNumber: +39 333 ZZZ 1234
|
||||||
|
-
|
||||||
|
|
||||||
|
# Adding an author to a document...
|
||||||
|
dn: documentTitle=book1,${BASEDN}
|
||||||
|
changetype: modify
|
||||||
|
add: documentAuthor
|
||||||
|
documentAuthor: cn=Lev Tolstoij,${BASEDN}
|
||||||
|
-
|
||||||
|
|
||||||
|
# Adding an author to another document...
|
||||||
|
dn: documentTitle=book2,${BASEDN}
|
||||||
|
changetype: modify
|
||||||
|
add: documentAuthor
|
||||||
|
documentAuthor: cn=Lev Tolstoij,${BASEDN}
|
||||||
|
-
|
||||||
|
|
||||||
|
# Adding an "auxiliary" objectClass...
|
||||||
|
dn: cn=Mitya Kovalev,${BASEDN}
|
||||||
|
changetype: modify
|
||||||
|
add: objectClass
|
||||||
|
objectClass: simpleSecurityObject
|
||||||
|
-
|
||||||
|
|
||||||
|
# Deleting an "auxiliary" objectClass...
|
||||||
|
dn: cn=Some One,${BASEDN}
|
||||||
|
changetype: modify
|
||||||
|
delete: objectClass
|
||||||
|
objectClass: simpleSecurityObject
|
||||||
|
-
|
||||||
|
delete: userPassword
|
||||||
|
-
|
||||||
|
|
||||||
|
EOMODS
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapmodify failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing delete..."
|
||||||
|
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||||
|
-h $LOCALHOST -p $PORT1 > \
|
||||||
|
$TESTOUT 2>&1 << EOMODS
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
# Deleting a person...
|
||||||
|
dn: cn=Torvlobnor Puzdoy,${BASEDN}
|
||||||
|
changetype: delete
|
||||||
|
|
||||||
|
# Deleting a document...
|
||||||
|
dn: documentTitle=book1,dc=example,dc=com
|
||||||
|
changetype: delete
|
||||||
|
|
||||||
|
# Deleting a person with an "auxiliary" objectClass...
|
||||||
|
dn: cn=Akakiy Zinberstein,dc=example,dc=com
|
||||||
|
changetype: delete
|
||||||
|
|
||||||
|
EOMODS
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapmodify failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Testing rename..."
|
||||||
|
$LDAPMODIFY -v -c -D "$MANAGERDN" -w $PASSWD \
|
||||||
|
-h $LOCALHOST -p $PORT1 > \
|
||||||
|
$TESTOUT 2>&1 << EOMODS
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
# Renaming an organization
|
||||||
|
dn: o=An Org,${BASEDN}
|
||||||
|
changetype: modrdn
|
||||||
|
newrdn: o=Another Org
|
||||||
|
deleteoldrdn: 1
|
||||||
|
|
||||||
|
EOMODS
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapmodify failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
BINDDN="cn=Mitya Kovalev,${BASEDN}"
|
||||||
|
BINDPW="mit"
|
||||||
|
NEWPW="newsecret"
|
||||||
|
echo "Testing passwd change..."
|
||||||
|
$LDAPPASSWD -h $LOCALHOST -p $PORT1 \
|
||||||
|
-D "${BINDDN}" -w ${BINDPW} -s ${NEWPW} \
|
||||||
|
"$BINDDN" >> $TESTOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldappasswd failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Testing bind with new secret... "
|
||||||
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $NEWPW
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapwhoami failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
BINDDN="cn=Some One,${BASEDN}"
|
||||||
|
BINDPW="someone"
|
||||||
|
echo -n "Testing bind with newly added user... "
|
||||||
|
$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$BINDDN" -w $BINDPW
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapwhoami failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using ldapsearch to retrieve all the entries..."
|
||||||
|
$LDAPSEARCH -h $LOCALHOST -p $PORT1 -b "$BASEDN" \
|
||||||
|
"objectClass=*" > $SEARCHOUT 2>&1
|
||||||
|
|
||||||
|
RC=$?
|
||||||
|
if test $RC != 0 ; then
|
||||||
|
echo "ldapsearch failed ($RC)!"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit $RC
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Filtering ldapsearch results..."
|
||||||
|
. $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
|
||||||
|
echo "Filtering modified ldif..."
|
||||||
|
. $LDIFFILTER < $SQLWRITE > $LDIFFLT
|
||||||
|
echo "Comparing filter output..."
|
||||||
|
$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
|
||||||
|
|
||||||
|
if test $? != 0 ; then
|
||||||
|
echo "comparison failed - SQL mods search didn't succeed"
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "apparently ${RDBMS} does not support writes; skipping..."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
test $KILLSERVERS != no && kill -HUP $KILLPIDS
|
||||||
|
|
||||||
|
echo ">>>>> Test succeeded"
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user