]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
More testing of nested attribute data in Perl
authorNick Porter <nick@portercomputing.co.uk>
Thu, 19 Sep 2024 14:29:43 +0000 (15:29 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 23 Sep 2024 10:53:35 +0000 (11:53 +0100)
src/tests/modules/perl/auth.unlang
src/tests/modules/perl/test.pl

index 661c394db477a8dfc5247aa7448735c1c3a679c7..a6a43171049313e710693f4d235321c130c11572 100644 (file)
@@ -15,6 +15,10 @@ if !(&reply.Reply-Message == "Denied access by rlm_perl function") {
 #  User will not be rejected - an xlat will be called setting a reply attribute
 &User-Name := 'bob'
 
+# Add two instances of a TLV - will result in an array of hashes in Perl
+&Vendor-Specific.3GPP2.Remote-IP = { &Address = 192.168.1.1, &Mask = 24 }
+&request.Vendor-Specific.3GPP2 += { &Remote-IP = { &Address = 172.16.1.1, &Mask = 16 } }
+
 perl.authenticate
 
 if (!ok) {
@@ -25,7 +29,7 @@ if (!ok) {
 #if !(&reply.Vendor-Specific.Cisco.h323-credit-amount == 100) {
 #    test_fail
 #}
-if !(&reply.Filter-Id == 'Hello') {
+if (&reply.Filter-Id != 'Hello 127.0.0.1 172.16.1.1') {
        test_fail
 }
 # Verify that the change to the request and control lists are
index 2f37e1b645095304c1c48e7d5b2d865d0d49d921..7e92e335fa79470f96566838a779bb92dafda347 100644 (file)
@@ -62,7 +62,7 @@ sub authorize {
 # Function to handle authenticate
 sub authenticate {
        # For debugging purposes only
-#      log_request_attributes();
+       log_request_attributes();
 
        if ($RAD_REQUEST{'User-Name'} =~ /^baduser/i) {
                # Reject user and tell him why
@@ -85,7 +85,7 @@ sub authenticate {
                                return RLM_MODULE_REJECT;
                        }
 #                      $RAD_REPLY{'Vendor-Specific.Cisco.h323-credit-amount'} = "100";
-                       $RAD_REPLY{'Filter-Id'} = 'Hello';
+                       $RAD_REPLY{'Filter-Id'} = 'Hello '.$RAD_REQUEST{'Net'}{'Src'}{'IP'}.' '.$RAD_REQUEST{'Vendor-Specific'}{'3GPP2'}{'Remote-IP'}[1]{'Address'};
                        $RAD_REQUEST{'User-Name'} = 'tim';
                        $RAD_CONFIG{'NAS-Identifier'} = 'dummy';
                }