Re: username input filter (where to insert)



DC <dc dcarr org> wrote:
> [...] I want to insert a quick little filter into gdm that 
> will take whatever the user typed as username (user string) and replace 
> all spaces with underscores and then pass the username along.  This 
> needs to take place before the username information is passed to PAM.  
> My question is: Where is the best place (which function/sourcefile) to 
> add my filter?  I've been looking at gdm_login.c but my C is not as good 
> as that of the authors' of the file.

The best place is in your own PAM authentication module, which would
call pam_get_user(), then mangle the resulting username according to
whatever algorithm you want, then use pam_set_item(PAM_USER) to make
the modified name visible to subsequent modules.  Insert this module at
the top of the PAM 'auth' list for GDM.  Not only does this get you out
of the business of hacking on the GDM source, it also solves the issue
for any other PAM-aware login mechanism -- ssh, telnet, rsh, ftp and so
on.

If you're not up to speed with PAM then an easy way to go would be to
start with the source for whichever existing PAM module it is that
calls pam_get_user() which causes GDM's conversation function to be
invoked if the user name is not already known.  That's usually
/usr/lib/security/pam_unix.so.

Mike.
-- 
mike oliver sun com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]