]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use attributes from packet in LDAP map tests
authorNick Porter <nick@portercomputing.co.uk>
Thu, 18 Jul 2024 09:10:18 +0000 (10:10 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 18 Jul 2024 09:10:18 +0000 (10:10 +0100)
src/tests/modules/ldap/map.attrs
src/tests/modules/ldap/map.unlang

index 6b9d34f4d9a94fd53d72ef2802955388c5c5d402..36afc136a311873a763ee2bb0440591cccddded4 100644 (file)
@@ -2,9 +2,10 @@
 #  Input packet
 #
 Packet-Type = Access-Request
-User-Name = "mike"
+User-Name = "john"
 User-Password = "mikeymikemike"
 NAS-IP-Address = 6.6.6.6
+NAS-Identifier = "not=ldap(safe"
 
 #
 #  Expected answer
index 3a62f320e63a872b0ef8dfd10e36aa775a87eaba..52d67c38f1b13f6d9c84c8123cd1d68b5b5eb960 100644 (file)
@@ -28,7 +28,7 @@ if (!notfound) {
        test_fail
 }
 
-map ldapldapi "ldapi://%%2Ftmp%%2Fldap%%2Fsocket/ou=people,dc=example,dc=com??sub?(uid=John)" {
+map ldapldapi "ldapi://%%2Ftmp%%2Fldap%%2Fsocket/ou=people,dc=example,dc=com??sub?(uid=%{User-Name})" {
        &Filter-Id := 'displayName'
 }
 
@@ -40,4 +40,15 @@ if !(&Filter-Id == 'John Doe') {
        test_fail
 }
 
+#
+#  Use an attribute in the incoming requests with non "ldap safe" characters which should be escaped
+#
+map ldapldapi "ldapi://%%2Ftmp%%2Fldap%%2Fsocket/ou=people,dc=example,dc=com??sub?(uid=%{NAS-Identifier})" {
+       &Filter-Id := 'displayName'
+}
+
+if (!notfound) {
+       test_fail
+}
+
 test_pass