From: Nick Porter Date: Thu, 19 Sep 2024 14:29:43 +0000 (+0100) Subject: More testing of nested attribute data in Perl X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc43424a1c3a60bf0c063327df115f3724da82e0;p=thirdparty%2Ffreeradius-server.git More testing of nested attribute data in Perl --- diff --git a/src/tests/modules/perl/auth.unlang b/src/tests/modules/perl/auth.unlang index 661c394db47..a6a43171049 100644 --- a/src/tests/modules/perl/auth.unlang +++ b/src/tests/modules/perl/auth.unlang @@ -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 diff --git a/src/tests/modules/perl/test.pl b/src/tests/modules/perl/test.pl index 2f37e1b6450..7e92e335fa7 100644 --- a/src/tests/modules/perl/test.pl +++ b/src/tests/modules/perl/test.pl @@ -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'; }