From: Nick Porter Date: Wed, 29 Jan 2025 15:37:28 +0000 (+0000) Subject: Add basic test of LDAP profile check_attribute X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80392474b8c6aba69ca9e0a90d65fdda8fd04d2e;p=thirdparty%2Ffreeradius-server.git Add basic test of LDAP profile check_attribute --- diff --git a/src/tests/modules/ldap/module.conf b/src/tests/modules/ldap/module.conf index 3f1a58d2de5..15c42c9a22c 100644 --- a/src/tests/modules/ldap/module.conf +++ b/src/tests/modules/ldap/module.conf @@ -278,6 +278,7 @@ ldap { attribute = 'radiusProfileDn' attribute_suspend = "radiusProfileSuspendedDn" sort_by = 'radiusProfilePriority' + check_attribute = 'radiusProfileCondition' } # diff --git a/src/tests/modules/ldap/xlat_profile.unlang b/src/tests/modules/ldap/xlat_profile.unlang index aa62c1b38f1..ba0a67cf529 100644 --- a/src/tests/modules/ldap/xlat_profile.unlang +++ b/src/tests/modules/ldap/xlat_profile.unlang @@ -71,4 +71,17 @@ if (reply.Reply-Message != 'Guten Tag') { 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' +if (!%ldap.profile('cn=nested,ou=profiles,dc=example,dc=com')) { + test_fail +} + +if (reply.Reply-Message != 'Good Day') { + test_fail +} + +reply := {} + test_pass diff --git a/src/tests/salt-test-server/salt/ldap/base.ldif b/src/tests/salt-test-server/salt/ldap/base.ldif index b7d7235b2b8..5db1d8e18d2 100644 --- a/src/tests/salt-test-server/salt/ldap/base.ldif +++ b/src/tests/salt-test-server/salt/ldap/base.ldif @@ -128,6 +128,7 @@ objectClass: radiusprofile cn: child1 radiusAttribute: reply.Reply-Message := 'Guten Tag' radiusProfilePriority: 2 +radiusProfileCondition: User-Name == 'bob' dn: cn=child2,cn=nested,ou=profiles,dc=example,dc=com objectClass: freeradiusPolicy