Skip to content

Commit 8039247

Browse files
committed
Add basic test of LDAP profile check_attribute
1 parent 8edf5b7 commit 8039247

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/tests/modules/ldap/module.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ ldap {
278278
attribute = 'radiusProfileDn'
279279
attribute_suspend = "radiusProfileSuspendedDn"
280280
sort_by = 'radiusProfilePriority'
281+
check_attribute = 'radiusProfileCondition'
281282
}
282283

283284
#

src/tests/modules/ldap/xlat_profile.unlang

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,17 @@ if (reply.Reply-Message != 'Guten Tag') {
7171

7272
reply := {}
7373

74+
# Re-run the above with a different user name - the profile with "Guten Tag"
75+
# as the reply message has a condition of User-Name == bob
76+
&User-Name := 'john'
77+
if (!%ldap.profile('cn=nested,ou=profiles,dc=example,dc=com')) {
78+
test_fail
79+
}
80+
81+
if (reply.Reply-Message != 'Good Day') {
82+
test_fail
83+
}
84+
85+
reply := {}
86+
7487
test_pass

src/tests/salt-test-server/salt/ldap/base.ldif

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ objectClass: radiusprofile
128128
cn: child1
129129
radiusAttribute: reply.Reply-Message := 'Guten Tag'
130130
radiusProfilePriority: 2
131+
radiusProfileCondition: User-Name == 'bob'
131132

132133
dn: cn=child2,cn=nested,ou=profiles,dc=example,dc=com
133134
objectClass: freeradiusPolicy

0 commit comments

Comments
 (0)