]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Check multiple instances of an attribute appear as an array
authorNick Porter <nick@portercomputing.co.uk>
Thu, 19 Sep 2024 14:27:56 +0000 (15:27 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 23 Sep 2024 10:50:27 +0000 (11:50 +0100)
src/tests/modules/perl/auth.attrs
src/tests/modules/perl/test.pl

index 91f0a86e07d865cb3b80e8dc79076d4df16a5052..50be06db0ec5f9bf374a471b772135bd4f4d818b 100644 (file)
@@ -4,6 +4,8 @@
 Packet-Type = Access-Request
 User-Name = "baduser"
 User-Password = "hello"
+Vendor-Specific.Cisco.AVPair = "cisco=madness"
+Vendor-Specific.Cisco.AVPair = "is=crazy"
 
 #
 #  Expected answer
index fdb5562cb593c74d5a1e2328f591b0345a34ed3c..29f37f90b28fa6b11a55ce2a16997fc69fc28ede 100644 (file)
@@ -77,6 +77,10 @@ sub authenticate {
 #                      $RAD_REPLY{'Vendor-Specific.Cisco.h323-credit-amount'} = "1000000";
                        $RAD_REPLY{'Filter-Id'} = 'Everything'
                } else {
+                       # Check we received two values for Cisco.AVPair
+                       if ($RAD_REQUEST{'Vendor-Specific'}{'Cisco'}{'AVPair'}[1] ne 'is=crazy') {
+                               return RLM_MODULE_DISALLOW;
+                       }
 #                      $RAD_REPLY{'Vendor-Specific.Cisco.h323-credit-amount'} = "100";
                        $RAD_REPLY{'Filter-Id'} = 'Hello';
                        $RAD_REQUEST{'User-Name'} = 'tim';