]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add fallthrough to LDAP tests
authorNick Porter <nick@portercomputing.co.uk>
Thu, 27 Feb 2025 13:51:04 +0000 (13:51 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 27 Feb 2025 13:51:27 +0000 (13:51 +0000)
src/tests/modules/ldap/module.conf
src/tests/modules/ldap/xlat_profile.unlang
src/tests/salt-test-server/salt/ldap/base.ldif

index 15c42c9a22c788dd3861895277d7b12becf0ca29..8ee20162a232507da75a68b9de48aff1a45eeba3 100644 (file)
@@ -279,6 +279,7 @@ ldap {
                attribute_suspend = "radiusProfileSuspendedDn"
                sort_by = 'radiusProfilePriority'
                check_attribute = 'radiusProfileCondition'
+               fallthrough_attribute = 'radiusProfileFallthrough'
        }
 
        #
index ba0a67cf5294a5011ab13af3a7fd9cada56afd55..0f33744b7b6f285a01f3b775bb7f3befa3672a91 100644 (file)
@@ -71,6 +71,18 @@ if (reply.Reply-Message != 'Guten Tag') {
 
 reply := {}
 
+# Test fallthrough processing.
+if (!%ldap.profile('cn=nested2,ou=profiles,dc=example,dc=com')) {
+       test_fail
+}
+
+# fallthrough condition should mean only the second profile will be applied
+if (reply.Reply-Message != 'Good Day') {
+       test_fail
+}
+
+reply := {}
+
 # Re-run the above with a different user name - the profile with "Guten Tag"
 # as the reply message has a condition of User-Name == bob
 &User-Name := 'john'
@@ -84,4 +96,15 @@ if (reply.Reply-Message != 'Good Day') {
 
 reply := {}
 
+if (!%ldap.profile('cn=nested2,ou=profiles,dc=example,dc=com')) {
+       test_fail
+}
+
+# fallthrough condition should mean only the first profile is applied
+if (reply.Reply-Message != 'Guten Tag') {
+       test_fail
+}
+
+reply := {}
+
 test_pass
index 5db1d8e18d2c182f3e8d017bac3000c0311c3df7..d3335cd0cf0a6485f9b0f16266d3ba717cad2314 100644 (file)
@@ -119,7 +119,6 @@ radiusReplyAttribute: Reply-Message := 'User-Suspended'
 
 dn: cn=nested,ou=profiles,dc=example,dc=com
 objectClass: freeradiusPolicy
-objectClass: radiusprofile
 cn: nested
 
 dn: cn=child1,cn=nested,ou=profiles,dc=example,dc=com
@@ -144,6 +143,25 @@ cn: child3
 radiusAttribute: reply.Reply-Message = 'Buna Ziua'
 radiusProfilePriority: 3
 
+dn: cn=nested2,ou=profiles,dc=example,dc=com
+objectClass: freeradiusPolicy
+cn: nested2
+
+dn: cn=child1,cn=nested2,ou=profiles,dc=example,dc=com
+objectClass: freeradiusPolicy
+objectClass: radiusprofile
+cn: child1
+radiusAttribute: reply.Reply-Message := 'Guten Tag'
+radiusProfilePriority: 1
+radiusProfileFallthrough: User-Name == 'bob'
+
+dn: cn=child2,cn=nested2,ou=profiles,dc=example,dc=com
+objectClass: freeradiusPolicy
+objectClass: radiusprofile
+cn: child2
+radiusAttribute: reply.Reply-Message := 'Good Day'
+radiusProfilePriority: 2
+
 dn: uid=adminuser,ou=people,dc=example,dc=com
 objectClass: inetOrgPerson
 uid: adminuser