edit RAD_REQUEST_PROXY_REPLY with perl
Hi, I'm trying to edit the values in RAD_REQUEST_PROXY_REPLY with perl. I've started with the example.pl file, and I'm able to list the first different attributes but I'm not sure how to list all the values, and how to change them. Specifically I want to edit the values of cisco-avpair attributes (which are multiple), replacing specific strings. I don't want to add a new attribute, but to change one or more of the attributes before they are sent to my NAS. Can anyone help me with an example of how to traverse and change these? (btw, I'm using freeradius version 2.1.3) Thanks, Tim
Tim.W wrote:
I'm trying to edit the values in RAD_REQUEST_PROXY_REPLY with perl. I've started with the example.pl file, and I'm able to list the first different attributes but I'm not sure how to list all the values, and how to change them.
This is a Perl question: How do you update values in hashes, and in lists?
Specifically I want to edit the values of cisco-avpair attributes (which are multiple), replacing specific strings. I don't want to add a new attribute, but to change one or more of the attributes before they are sent to my NAS.
Can anyone help me with an example of how to traverse and change these? (btw, I'm using freeradius version 2.1.3)
I suggest buying a Perl book. Alan DeKok.
--On Thursday, January 22, 2009 04:17:09 PM +0100 Alan DeKok <aland@deployingradius.com> wrote:
Tim.W wrote:
I'm trying to edit the values in RAD_REQUEST_PROXY_REPLY with perl. I've started with the example.pl file, and I'm able to list the first different attributes but I'm not sure how to list all the values, and how to change them.
This is a Perl question: How do you update values in hashes, and in lists?
Not entirely. I read two non-Perl problems into this question... (1) At least in the version I looked at, the comments in example.pl are really not clear that the *_REPLY hashes are pre-populated with the existing reply attributes and that these can be changed; it really reads like the hash starts out empty and can only be used to add attributes not already in the reply. (2) The OP seems to be under the impression that a single attribute can simultaneously have more than one value, which I didn't think was the case. If they can, then the question becomes, how, exactly, are multi-valued attributes presented to the perl script? -- Jeff
Jeffrey Hutzelman wrote:
Not entirely. I read two non-Perl problems into this question...
(1) At least in the version I looked at, the comments in example.pl are really not clear that the *_REPLY hashes are pre-populated with the existing reply attributes and that these can be changed; it really reads like the hash starts out empty and can only be used to add attributes not already in the reply.
Patches to clarify this are welcome.
(2) The OP seems to be under the impression that a single attribute can simultaneously have more than one value, which I didn't think was the case. If they can, then the question becomes, how, exactly, are multi-valued attributes presented to the perl script?
Attributes can have multiple values. They are presented as arrays in the hash table. i.e. two of "Vendor-Foo" means that $RAD_REQUEST{"Vendor-Foo"} is an array. Alan DeKok.
Hi, I'm trying to edit the values in RAD_REQUEST_PROXY_REPLY with perl. I've started with the example.pl file, and I'm able to list the first different attributes but I'm not sure how to list all the values, and how to change them. Specifically I want to edit the values of cisco-avpair attributes (which are multiple), replacing specific strings. I don't want to add a new attribute, but to change one or more of the attributes before they are sent to my NAS. Can anyone help me with an example of how to traverse and change these? (btw, I'm using freeradius version 2.1.3) Thanks, Tim
participants (3)
-
Alan DeKok -
Jeffrey Hutzelman -
Tim.W