]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9038 Update test028 to test this is enforced
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 19 Jun 2019 16:47:32 +0000 (18:47 +0200)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 20 Jun 2019 18:03:18 +0000 (18:03 +0000)
tests/data/idassert.out
tests/data/slapd-idassert.conf
tests/data/test-idassert1.ldif
tests/scripts/test028-idassert

index 53d76bb2e2e2e32282c92af775d371cb40f50e20..fa51c25d62b397940d8fd7fe8f29c15bab7cab17 100644 (file)
@@ -4,6 +4,11 @@ objectClass: dcObject
 o: Example, Inc.
 dc: example
 
+dn: cn=Manager,o=Example,c=US
+objectClass: inetOrgPerson
+cn: Manager
+sn: Parson
+
 dn: ou=People,o=Example,c=US
 objectClass: organizationalUnit
 ou: People
index 88d66a36f51a32e03cdd5cde4672cbc345018e30..561c5ccc46e0059689cef5665b3d517887323b59 100644 (file)
@@ -36,6 +36,7 @@ argsfile      @TESTDIR@/slapd.1.args
 #######################################################################
 
 authz-policy   both
+authz-regexp   "^uid=manager,.+" "cn=Manager,dc=example,dc=com"
 authz-regexp   "^uid=admin/([^,]+),.+" "ldap:///ou=Admin,dc=example,dc=com??sub?(cn=$1)"
 authz-regexp   "^uid=it/([^,]+),.+" "ldap:///ou=People,dc=example,dc=it??sub?(uid=$1)"
 authz-regexp   "^uid=(us/)?([^,]+),.+" "ldap:///ou=People,dc=example,dc=com??sub?(uid=$2)"
index 063d6ec450bbddc23da31cffa658b4f3dbb9ecea..3ccbd1a220b5da68ffe24aa680265ebc7866c992 100644 (file)
@@ -4,6 +4,12 @@ objectClass: dcObject
 o: Example, Inc.
 dc: example
 
+dn: cn=Manager,dc=example,dc=com
+objectClass: inetOrgPerson
+cn: Manager
+sn: Parson
+userPassword: secret
+
 dn: ou=People,dc=example,dc=com
 objectClass: organizationalUnit
 ou: People
index b1e16744a55dd6109fea9bc6f7188d573f42ae57..9e5e107247ec24f9ccdd564fca77e2b2acefcf60 100755 (executable)
@@ -191,6 +191,17 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
+AUTHZID="u:it/jaj"
+echo "Checking another DB's rootdn can't assert identity from another DB..."
+$LDAPWHOAMI -h $LOCALHOST -p $PORT1 -D "$MANAGERDN" -w $PASSWD -e\!"authzid=$AUTHZID"
+
+RC=$?
+if test $RC != 1 ; then
+    echo "ldapwhoami should have failed ($RC)!"
+    test $KILLSERVERS != no && kill -HUP $KILLPIDS
+    exit $RC
+fi
+
 ID="uid=jaj,ou=People,dc=example,dc=it"
 BASE="o=Example,c=US"
 echo "Testing ldapsearch as $ID for \"$BASE\"..."
@@ -231,6 +242,19 @@ if test $USE_SASL != "no" ; then
                exit $RC
        fi
 
+       ID="manager"
+       AUTHZID="u:it/jaj"
+       echo "Checking another DB's rootdn can't assert in another (with SASL bind this time)..."
+       $LDAPSASLWHOAMI -h $LOCALHOST -p $PORT1 \
+               -Q -U "$ID" -w $PASSWD -Y $MECH -X $AUTHZID
+
+       RC=$?
+       if test $RC != 50 ; then
+               echo "ldapwhoami should have failed ($RC)!"
+               test $KILLSERVERS != no && kill -HUP $KILLPIDS
+               exit $RC
+       fi
+
        echo "Filtering ldapsearch results..."
        $LDIFFILTER < $SEARCHOUT > $SEARCHFLT
        echo "Filtering original ldif used to create database..."