This optional parameter allows you to define a Perl function
that will be called after a reply is received from the remote RADIUS
server and before it is relayed back to the original client. The following
arguments are passed in the following order:
- Reference to the reply received from the remote RADIUS server
- Reference to the reply packet being constructed for return to the
NAS
- Reference to the original request from the NAS
- Reference to the request that was sent to the remote RADIUS
server
- Reference to the Radius::Host structure for the remote host
- Reference to the redirected flag. If redirected is set by the
hook, the ReplyHook has redirected the request to another AuthBy.
The hook code is compiled by Perl when Radiator starts up.
Compilation errors in your hook code will be reported to the log file at
start-up time. Runtime errors in your hook will also be reported to the
log file when your hook executes. Multiline hooks (i.e. with trailing
backslashes (\)) are parsed by Radiator into one long line. Therefore you
should not use trailing comments in your hook.
The response type can
be enforced when needed. For example, when the remote RADIUS server has
rejected the request, the ReplyHook can do any local processing required
for rejects and then change the response type to accept.
# Change RadiusResult in the 3rd argument, the original request
ReplyHook sub { ${$_[2]}->{RadiusResult} = $main::ACCEPT; }
ReplyHook
Can be an arbitrarily complicated Perl function, that might run external
processes, consult databases, change the contents of the current request
or many other things.
# Fake a new attribute into the reply going back to the client
ReplyHook sub { ${$_[1]}->add_attr('test-attr', \
'test-value');}