Skip to content

Commit

Permalink
Split out group tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Jul 8, 2015
1 parent 9e10a18 commit a419926
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 17 deletions.
8 changes: 0 additions & 8 deletions src/tests/modules/ldap/auth.unlang
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ if ("%{pairs:reply:}" == "") {
test_fail
}


if (LDAP-Group == "foo") {
test_pass
}
else {
test_fail
}

ldap.post-auth

update {
Expand Down
15 changes: 15 additions & 0 deletions src/tests/modules/ldap/groups_rfc2307bis.attrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Input packet
#
User-Name = "john"
User-Password = "password"
NAS-IP-Address = 1.2.3.5

#
# Expected answer
#
Response-Packet-Type == Access-Accept
Idle-Timeout == 3600
Session-Timeout == 7200
Acct-Interim-Interval == 1800
Framed-IP-Netmask == "255.255.0.0"
41 changes: 41 additions & 0 deletions src/tests/modules/ldap/groups_rfc2307bis.unlang
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# Run the "ldap" module
#
ldap

#
# Resolve using group name attribute
#
if (LDAP-Group == 'foo') {
test_pass
}
else {
test_fail
}

#
# Resolve using group DN
#
if (LDAP-Group == 'cn=foo,ou=groups,dc=example,dc=com') {
test_pass
}
else {
test_fail
}

#
# Check we have these values cached
#
if (&LDAP-Cached-Membership[*] == 'foo') {
test_pass
}
else {
test_fail
}

if (&LDAP-Cached-Membership[*] == 'cn=foo,ou=groups,dc=example,dc=com') {
test_pass
}
else {
test_fail
}
17 changes: 8 additions & 9 deletions src/tests/modules/ldap/module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ ldap {
#
user {
# Where to start searching in the tree for users
base_dn = 'ou=people,dc=example,dc=com'
#base_dn = 'ou=people,${..base_dn}'
base_dn = "ou=people,${..base_dn}"

# Filter for user objects, should be specific enough
# to identify a single user object.
Expand Down Expand Up @@ -199,14 +198,14 @@ ldap {
#
group {
# Where to start searching in the tree for groups
base_dn = 'ou=groups,dc=example,dc=com'
base_dn = "ou=groups,${..base_dn}"

# Filter for group objects, should match all available
# group objects a user might be a member of.
filter = '(objectClass=groupOfNames)'

# Search scope, may be 'base', 'one', sub' or 'children'
# scope = 'sub'
scope = 'sub'

# Attribute that uniquely identifies a group.
# Is used when converting group DNs to group
Expand All @@ -224,7 +223,7 @@ ldap {
# Unless a conversion between group name and group DN is
# needed, there's no requirement for the group objects
# referenced to actually exist.
# membership_attribute = 'memberOf'
membership_attribute = 'memberOf'

# If cacheable_name or cacheable_dn are enabled,
# all group information for the user will be
Expand All @@ -240,13 +239,13 @@ ldap {
# the type that matches the format of your check items
# i.e. if your groups are specified as DNs then enable
# cacheable_dn else enable cacheable_name.
# cacheable_name = 'no'
# cacheable_dn = 'no'
cacheable_name = yes
cacheable_dn = yes

# Override the normal cache attribute (<inst>-LDAP-Group)
# and create a custom attribute. This can help if multiple
# module instances are used in fail-over.
# cache_attribute = 'LDAP-Cached-Membership'
cache_attribute = 'LDAP-Cached-Membership'
}

#
Expand All @@ -273,7 +272,7 @@ ldap {
#
client {
# Where to start searching in the tree for clients
base_dn = 'ou=people,dc=example,dc=com'
base_dn = "ou=clients,${..base_dn}"

#
# Filter to match client objects
Expand Down

0 comments on commit a419926

Please sign in to comment.