This optional parameter allows you to define a Perl function
that is called after a reply is received from a remote RadSec 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 RadSec server is
passed as the first argument
- Reference to the reply packet being constructed for return to the
NAS is passed as the second argument
- Reference to the original request from the NAS is passed as the
third argument
- Reference to the request that was sent to the remote RadSec server
is passed as the fourth argument
- Reference to the Radius::AuthRADSEC structure is passed as the
fifth argument
The response type can be enforced when needed. For example, when
the remote RadSec 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; }
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 are also reported to the log file when your
hook executes. Multiline hooks (with trailing backslashes (\)) are parsed
by Radiator into one long line. Therefore do not use trailing comments in
your hook.
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');}