Net::Radius::Server::Set::Replace - Perform replacements on the RADIUS response
use Net::Radius::Server::Base qw/:set/;
use Net::Radius::Server::Set::Replace;
my $replace = Net::Radius::Server::Set::Replace->new
({
result => NRS_SET_RESPOND,
vsattr => [
[ 'Cisco', 'cisco-avpair' => qr/datum=foo/ => 'bad=baz' ],
],
attr => [
[ 'Reply-Message', qr/Login Succesful/ => "Welcome home!!!\r\n\r\n",
'Reply-Message', qr/Invalid/ => "Go away stranger\r\n\r\n",
],
]});
my $replace_sub = $set->mk;
"Net::Radius::Server::Set::Replace" provides a
simple mechanism allowing changes to be made to RADIUS packets.
See "Net::Radius::Server::Set"
for general usage guidelines. The relevant attributes that control the
matching of RADIUS requests are:
- "attr"
- Takes a listref containing groups of three elements: The first is the name
of the attribute to replace. The second, is the replacement condition. It
must be true in order for the replacement to be completed. The third
element is the value to be stored in the named attribute.
The replacement condition can be of any of the following
types:
- scalar
- An exact match will be attempted.
- regexp
- The value of the attribute must match the given regexp.
- NetAddr::IP
- The value of the attribute must be convertible into a
NetAddr::IP(3) subnet. In this case, the comparison matches if the
given NetAddr::IP(3) range contains the current attribute.
The comparison does not match if the attribute value cannot be
converted into a NetAddr::IP(3) object.
- "result"
- The result of the invocation of this set method. See
"Net::Radius::Server::Set" for more
information. The example shown in the synopsis would cause an inmediate
return of the packet. Other set methods after the current one won't be
called at all.
- "vsattr"
- Just as "attr", but dealing with
"Net::Radius::Packet->set_vsattr()"
instead.
$Log$
Revision 1.4 2006/12/14 16:33:17 lem
Rules and methods will only report failures in log level 3 and
above. Level 4 report success and failure, for deeper debugging
Revision 1.3 2006/12/14 15:52:25 lem
Fix CVS tags
Perl(1), NetAddr::IP(3), Net::Radius::Server(3),
Net::Radius::Server::Set(3), Net::Radius::Packet(3).
Luis E. Muñoz, <luismunoz@cpan.org>
Copyright (C) 2006 by Luis E. Muñoz
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl 5.8.6 itself.
Hey! The above document had some coding errors, which are explained
below:
- Around line 276:
- Non-ASCII character seen before =encoding in 'Muñoz,'. Assuming
UTF-8