Re: username input filter (where to insert)



On Tue, Aug 05, 2003 at 04:07:06PM -0500, DC wrote:
> Hi all,
> I'm working integrating a new linux environment into our existing Novell 
> one.  Unfourtunately many of our Novell usernames contain whitespace, a 
> big no no according to my linux server.  Although probably not the most 
> elegant solution, 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.  Thanks for your help,
> -David Carr

Depends what version of GDM you are using.  I assume you are using the
stable version.  In this case you need to modify daemon/verify-pam.c
around the lines 778:

    if (username == NULL) {
	    /* Ask gdmgreeter for the user's login. Just for good measure */
	    gdm_slave_greeter_ctl_no_ret (GDM_MSG, _("Please enter your
username"));
	    login = gdm_slave_greeter_ctl (GDM_LOGIN, _("Username:"));
	    if (login == NULL ||
		gdm_slave_greeter_check_interruption ()) {
		    if (started_timer)
			    gdm_slave_greeter_ctl_no_ret (GDM_STOPTIMER, "");
		    g_free (login);
		    return NULL;
	    }
	    gdm_slave_greeter_ctl_no_ret (GDM_MSG, "");
    } else {
	    login = g_strdup (username);
    }

And have your filter change the 'login' string after this.


If you are using the devel version, then pam is asking for the username.  As
long as pam doesn't 'trick us' with a different prompt then the one
we have to it, then around line 172, we're asking for the username with a
GDM_PROMPT (GDM_LOGIN disappeared in the devel version).

However if you are using the devel version that it should be possible to do
it entierly inside pam.  It should be possible to write a small module that
would go all the way on top of the stack, that would ask the username and
then do the replacement by itself.  The advantage of this approach is that
all things that are fully PAMized (and let PAM ask for the username
themselves) will work.  Perhaps there even exists such a PAM module.

George

-- 
George <jirka 5z com>
   She had lost the art of conversation, 
   but not, unfortunately, the power of speech.
                       -- George Bernard Shaw



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