--- /dev/null
+string test_string
+
+#
+# Run the "ldap" module
+#
+ldap
+
+#IP address is defined in cn=profile2
+if !(&control.Framed-IP-Address == 1.2.3.6) {
+ test_fail
+}
+
+# IP netmask defined in cn=reply,cn=profile2
+if (!(&reply.Framed-IP-Netmask == 255.255.192.0)) {
+ test_fail
+}
+
+if (!(&reply.Acct-Interim-Interval == 7200)) {
+ test_fail
+}
+
+# Attempt a bind authentication
+ldap.authenticate
+
+ldap.send
+
+&test_string := %ldap("ldap://$ENV{TEST_SERVER}/uid=peter,ou=people,dc=example,dc=com?description")
+
+if (!(&test_string == "User %{User-Name} authenticated")) {
+ test_fail
+}
+
+test_pass
&reply := {}
}
+if (!%ldap.profile('cn=profile3,ou=profiles,dc=example,dc=com')) {
+ test_fail
+}
+
+if (!((&reply.Framed-IP-Netmask == 255.255.192.0) && \
+ (&reply.Acct-Interim-Interval == 7200) && \
+ (&request.Service-Type == ::Framed-User) && \
+ (&control.Framed-IP-Address == 1.2.3.6) && \
+ (&control.Reply-Message == 'Salut'))) {
+ test_fail
+}
+
+&control := {}
+&reply := {}
+
test_pass
radiusControlAttribute: Framed-IP-Address := 1.2.3.5
radiusControlAttribute: Reply-Message := "Bonjour"
+dn: cn=profile3,ou=profiles,dc=example,dc=com
+objectClass: freeradiusPolicy
+objectClass: radiusprofile
+cn: profile3
+radiusRequestAttribute: Service-Type := 'Framed-User'
+radiusControlAttribute: Framed-IP-Address := 1.2.3.6
+radiusControlAttribute: Reply-Message := "Salut"
+
+dn: cn=reply,cn=profile3,ou=profiles,dc=example,dc=com
+objectClass: freeradiusPolicy
+objectClass: radiusprofile
+cn: reply
+radiusReplyAttribute: Framed-IP-Netmask := 255.255.192.0
+radiusReplyAttribute: Acct-Interim-Interval := 7200
+
dn: cn=suspended,ou=profiles,dc=example,dc=com
objectClass: freeradiusPolicy
objectClass: radiusprofile
radiusProfileDN: cn=profile1,ou=profiles,dc=example,dc=com
dialupAccess: enabled
+dn: uid=peter,ou=people,dc=example,dc=com
+objectClass: inetOrgPerson
+objectClass: posixAccount
+objectClass: shadowAccount
+objectClass: radiusprofile
+uid: peter
+sn: Parker
+givenName: Peter
+cn: Peter Parker
+displayName: Peter Parker
+userPassword: letmein
+uidNumber: 102
+gidNumber: 102
+homeDirectory: /home/peter
+radiusProfileDN: cn=profile3,ou=profiles,dc=example,dc=com
+dialupAccess: enabled
+
dn: uid=bob,ou=people,dc=example,dc=com
objectClass: inetOrgPerson
objectClass: posixAccount