FreeRADIUS/pam_radius — pull request #8 by foolean (2014-06-17 21:55:12+00:00)
Title: Added 'prompt' option

Hello,

First, thanks and kudos for the work on FreeRADIUS and pam_radius.

At $WORK we use pam_radius as part of our multi-factor authentication. We have been re-compiling pam_radius to change the prompt from "Password: " to something else. The reason is that "Password: " is the same for pam_radius as it is for our other factor and confused users. This patch, submitted for your approval, adds a prompt option which allows our custom prompt to be handled as a PAM configuration rather than re-compiling pam_radius itself.

I used two defines in pam_radius_auth.h to specify the defaults. DEFAULT_PROMPT specifies the default prompt of "Password: ". MAXPROMPT specifies the maximum length of the prompt plus the trailing '\0'. Excessively long prompts are truncated to (MAXPROMPT - 3) characters so that the ": " and trailing '\0' may be added. I opted to use a character array rather than a pointer so I wouldn't have to worry about error handling when malloc-ing. I see that the other defines are at the bottom of the header file but I couldn't put these new defines there without breaking the structure definition. I ended up putting my two defines above the struct radius_conf_t structure so MAXPROMPT could be used in the array definition. My thought was to make these two defines the only things that needed to be changed if changes to the defaults were needed.

I'm hoping that you will find this useful and be able to incorporate it, or at least incorporate the functionality.

Thanks,
- Bennett