3.28.25. TranslatePasswordHook Previous topic Parent topic Child topic Next topic

This optional parameter specifies a Perl hook that can be used to convert, translate or transform plaintext passwords after retrieval from a user database and before comparison with the submitted password received from the client. The hook is passed the following arguments:
  • $_[0] The correct password as retrieved from the user database.
  • $_[1] A reference to the current AuthBy module object.
  • $_[2] The user name being authenticated.
  • $_[3] A flag saying whether the correct password is encrypted by crypt() or MSCHAP.
  • $_[4] A reference to the current RADIUS request.
The hook is expected to return a single scalar value containing the transformed password. In the following example, all passwords are transformed to uppercase.
# Translate all passwords to UPPERCASE
TranslatePasswordHook sub {$_[0] =~ tr/a-z/A-Z/; return $_[0]}