couple of getpwnam() questions

Gerald Carter gcarter at valinux.com
Tue Nov 21 20:36:24 GMT 2000


Folks,

A couple of comments and questions.  Perhaps someone
can enlighten me if I am seeing this wrong.

--- username.c:Get_Pwnam() ---------------------------------

The current code tries to lookup the username

  o as transmitted
  o in all lower case
  o in all caps
  o with the first letter only in upper case
  o with the last letter only in upper case

My question is "Are the last two checks really necessary?"
For example, a lookup of "Administrator" looks like

  o getpwnam("Administrator")
  o getpwnam("administrator")
  o getpwnam("ADMINISTRATOR")
  o getpwnam("Administrator")
  o getpwnam("AdministratoR")

IMO the last two checks should be handled by a 

	username level = 1

if the host system requires them.

--- passdb.c:local_lookup_name() -----------------------------

In the following snippet of code, we use a the Get_Pwnam()
wrapper for case variations in the username.  From what I can
tell, this is not necessarily required since the use of this
function is used by RPCs (or cases where the username case 
is correct already).  Can anyone articulate a reason not
to change this call to sys_getpwnam() instead for performance
reasons?  (btw...also look at the use of getgrnam() which assumes
the case is already correct)

	if(!(pass = Get_Pwnam(user))) {
		/*
		 * Maybe it was a group ?
		 */
		struct group *grp = getgrnam(user);

		if(!grp)
			return False;







Cheers, jerry
----------------------------------------------------------------------
   /\  Gerald (Jerry) Carter                     Professional Services
 \/    http://www.valinux.com/  VA Linux Systems   gcarter at valinux.com
       http://www.samba.org/       SAMBA Team          jerry at samba.org
       http://www.plainjoe.org/                     jerry at plainjoe.org

       "...a hundred billion castaways looking for a home."
                                - Sting "Message in a Bottle" ( 1979 )






More information about the samba-technical mailing list