GNOME Bugzilla – Bug 583660
gdm fails to call setusercontext
Last modified: 2010-05-29 13:59:27 UTC
Please describe the problem: When starting a session on systems that have login_cap.h, gdm does not call setusercontext anymore as it used to do. This causes an invalid value to be returned by subsequent getlogin() calls within the session, and failure to set the PATH environment variable as defined in system configuration (e.g. /etc/login.conf on FreeBSD systems). Steps to reproduce: 1. Login in using gdm on a FreeBSD system as a non-root user 2. Notice that getlogin(2) still returns "root" 3. Notice that PATH settings from /etc/login.conf haven't been taken into account. Actual results: Expected results: Does this happen every time? Other information:
Created attachment 135243 [details] [review] proposed patch against gdm 2.26.1 sources This patch re-adds a call to setusercontext as it used to exist in earlier versions of gdm, and appears to indeed fix the described issue on this system.
See also FreeBSD PR ports/133793 at http://www.freebsd.org/cgi/query-pr.cgi?pr=133793
So, you do: if (setusercontext (NULL, pwent, pwent->pw_uid, + LOGIN_SETLOGIN | LOGIN_SETPATH | + LOGIN_SETPRIORITY | LOGIN_SETRESOURCES | + LOGIN_SETUMASK | LOGIN_SETUSER | + LOGIN_SETENV) < 0) { LOGIN_SETLOGIN makes sense, but SETPATH, SETUMASK, and SETENV get immediately overwritten afterward right? Also, SETUSER would as well if you dropped the #else block and just called in unconditionally. I wonder if we can just call setlogin() instead? This would drop the potentially costly call to get to getpwnam().
Thomas, can you address the questions raised in comment #3?
Closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for. Thanks!