Bug 491319

Summary: g_get_user_name / g_get_home_dir should check LOGNAME
Product: Red Hat Enterprise Linux 4 Reporter: ritz <rkhadgar>
Component: glib2Assignee: Cosimo Cecchi <ccecchi>
Status: CLOSED WONTFIX QA Contact: desktop-bugs <desktop-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.8CC: jwest, mclasen, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-14 19:38:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch based on upstream code none

Description ritz 2009-03-20 12:39:41 UTC
Description of problem:
This problem occurs with RHEL-4 u7.

Customer has two users with same uid viz. foo and ,say, ccfoo. She logs in as foo and sets $LOGNAME to ccfoo as well. By default it is set as foo based on uid since foo was created first.

When she starts up X-Windows and runs firefox (3.0), firefox shows an error "error occurred while loading or saving configuration information for Gecko". The core issue is that gconf is trying to acquire a lock for /tmp/gconfd-ccfoo/lock/ior whereas gconfd has created /tmp/gconfd-foo/lock/ior.

This problem does not occur, when using firefox 1.5.0.12 in RHEL-4 u6.

It turns out firefox 3 links against glib-2.0 in /usr/evolution28/lib, which implements g_get_user_name() differently compared to that in /usr/lib used byg gconf. The difference is:

* g_get_user_name() in evolution28 returns the contents of $LOGNAME provided it matches against the current uid.
* g_get_user_name() in /usr/lib returns the user name associated by default to the current uid.

gconfd and firefox link against the two different versions, thus causing a mismatch in their interpretation of user names.


Version-Release number of selected component (if applicable):
glib2-2.4.7-1


How reproducible:
always


Steps to Reproduce:
For firefox error:
1) Create two user names with same uid:
useradd -u 666 -o foo
useradd -u 666 -o ccfoo
2) log in as ccroot
3) Open a terminal and type:
LOGNAME=ccfoo firefox
  

Actual results:
The error described above


Expected results:
Firefox should simply start with profile of foo.


Additional info:

Test case to verify return value of g_get_user_name:

$ cat ggetusername.c
#include <glib.h>

int main()
{
       printf("%s\n", g_get_user_name());
}


$ gcc -o stockglib ggetusername.c `pkgconfig --cflags --libs glib-2.0`
$ gcc -o evlglib ggetusername.c /usr/evolution28/lib/libglib-2.0.a -I/usr/evolution28/include/glib-2.0 -I/usr/evolution28/lib/glib-2.0/include

$ LOGNAME=ccfoo ./evlglib
ccfoo
$ LOGNAME=ccfoo ./stockglib
foo



http://svn.gnome.org/viewvc/glib/trunk/glib/gutils.c?r1=4220&r2=4403
	Handle multiple user names with the same UID better.
	(#319535, Laszlo Peter)

	* glib/gutils.c (g_get_any_init_do): When determining user
	data, first look up $LOGNAME. If the UID doesn't match
	getuid(), fall back to the current behaviour of looking
	up the user data based on getuid().

Comment 1 ritz 2009-03-20 12:40:36 UTC
Created attachment 336035 [details]
patch based on upstream code

Comment 4 RHEL Program Management 2010-10-22 19:04:26 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.