Skip to content

Commit ec82850

Browse files
committed
Test profile sorting in LDAP
1 parent 1de606e commit ec82850

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

src/tests/modules/ldap/module.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ ldap {
277277
# will override this setting at run-time.
278278
attribute = 'radiusProfileDn'
279279
attribute_suspend = "radiusProfileSuspendedDn"
280+
sort_by = 'radiusProfilePriority'
280281
}
281282

282283
#

src/tests/modules/ldap/xlat_profile.unlang

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,17 @@ if (!((reply.Framed-IP-Netmask == 255.255.192.0) && \
5858
control := {}
5959
reply := {}
6060

61+
# Test profile sort order.
62+
if (!%ldap.profile('cn=nested,ou=profiles,dc=example,dc=com')) {
63+
test_fail
64+
}
65+
66+
# Reply-Message will be set, overwritten and then unchanged by the
67+
# profiles, when processed in the correct sequence - leaving this value.
68+
if (reply.Reply-Message != 'Guten Tag') {
69+
test_fail
70+
}
71+
72+
reply := {}
73+
6174
test_pass

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,32 @@ objectClass: radiusprofile
117117
cn: suspended
118118
radiusReplyAttribute: Reply-Message := 'User-Suspended'
119119

120+
dn: cn=nested,ou=profiles,dc=example,dc=com
121+
objectClass: freeradiusPolicy
122+
objectClass: radiusprofile
123+
cn: nested
124+
125+
dn: cn=child1,cn=nested,ou=profiles,dc=example,dc=com
126+
objectClass: freeradiusPolicy
127+
objectClass: radiusprofile
128+
cn: child1
129+
radiusAttribute: reply.Reply-Message := 'Guten Tag'
130+
radiusProfilePriority: 2
131+
132+
dn: cn=child2,cn=nested,ou=profiles,dc=example,dc=com
133+
objectClass: freeradiusPolicy
134+
objectClass: radiusprofile
135+
cn: child2
136+
radiusAttribute: reply.Reply-Message := 'Good Day'
137+
radiusProfilePriority: 1
138+
139+
dn: cn=child3,cn=nested,ou=profiles,dc=example,dc=com
140+
objectClass: freeradiusPolicy
141+
objectClass: radiusprofile
142+
cn: child3
143+
radiusAttribute: reply.Reply-Message = 'Buna Ziua'
144+
radiusProfilePriority: 3
145+
120146
dn: uid=adminuser,ou=people,dc=example,dc=com
121147
objectClass: inetOrgPerson
122148
uid: adminuser

0 commit comments

Comments
 (0)