1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00

* Fix hardcoded use of /usr/local.

* Re-add support for reading /etc/login.conf. [1]

PR:		133793 [1]
Submitted by:	thomas [1]
This commit is contained in:
Joe Marcus Clarke 2009-05-31 20:00:18 +00:00
parent 47be40afc4
commit 3f4de75ac3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=234937
3 changed files with 75 additions and 11 deletions

View File

@ -8,7 +8,7 @@
PORTNAME= gdm
PORTVERSION= 2.26.1
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= x11 gnome
MASTER_SITES= GNOME
DIST_SUBDIR= gnome2
@ -68,7 +68,7 @@ CONFIGURE_ARGS+= --disable-ipv6
post-patch:
@${REINPLACE_CMD} -e 's|root:root|root:wheel|g' \
${WRKSRC}/data/Makefile.in
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \
@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' \
${WRKSRC}/daemon/gdm-session-worker.c \
${WRKSRC}/data/gconf.path
@${REINPLACE_CMD} -e 's|/bin/true|/usr/bin/true|g' \

View File

@ -1,10 +1,18 @@
--- daemon/Makefile.in.orig 2007-11-02 20:54:53.000000000 -0400
+++ daemon/Makefile.in 2007-11-02 20:55:08.000000000 -0400
@@ -451,6 +451,7 @@ test_session_SOURCES = \
test_session_LDADD = \
--- daemon/Makefile.in.orig 2009-05-31 15:51:18.000000000 -0400
+++ daemon/Makefile.in 2009-05-31 15:56:32.000000000 -0400
@@ -525,6 +525,7 @@ test_session_LDADD = \
$(XLIB_LIBS) \
$(EXTRA_DAEMON_LIBS) \
$(DAEMON_LIBS) \
+ $(EXTRA_DAEMON_LIBS) \
$(PAM_LIBS) \
$(top_builddir)/common/libgdmcommon.la \
$(NULL)
@@ -660,6 +661,7 @@ gdm_session_worker_SOURCES = session-wor
gdm_session_worker_LDFLAGS = \
$(XLIB_LIBS) \
$(PAM_LIBS) \
+ $(EXTRA_DAEMON_LIBS) \
$(NULL)
gdm_session_worker_LDADD = \

View File

@ -1,6 +1,16 @@
--- daemon/gdm-session-worker.c.orig 2008-07-30 19:15:47.000000000 -0400
+++ daemon/gdm-session-worker.c 2008-08-25 12:50:00.000000000 -0400
@@ -332,7 +332,7 @@ gdm_session_execute (const char *file,
--- daemon/gdm-session-worker.c.orig 2009-04-14 10:01:14.000000000 -0400
+++ daemon/gdm-session-worker.c 2009-05-31 15:52:10.000000000 -0400
@@ -31,6 +31,9 @@
#include <errno.h>
#include <grp.h>
#include <pwd.h>
+#ifdef HAVE_LOGINCAP
+#include <login_cap.h>
+#endif
#include <security/pam_appl.h>
@@ -332,7 +335,7 @@ gdm_session_execute (const char *file,
* what to search if PATH is unset. POSIX may, dunno.
*/
@ -9,3 +19,49 @@
}
len = strlen (file) + 1;
@@ -1757,11 +1760,12 @@ gdm_session_worker_start_user_session (G
char **environment;
char *home_dir;
int fd;
+#ifdef HAVE_LOGINCAP
+ char *login = worker->priv->username;
+ struct passwd *pwent = getpwnam (login);
+#endif
- if (setuid (worker->priv->uid) < 0) {
- g_debug ("GdmSessionWorker: could not reset uid - %s", g_strerror (errno));
- _exit (1);
- }
+ /* Call setsid() before setusercontext() */
if (setsid () < 0) {
g_debug ("GdmSessionWorker: could not set pid '%u' as leader of new session and process group - %s",
@@ -1769,6 +1773,28 @@ gdm_session_worker_start_user_session (G
_exit (2);
}
+#ifdef HAVE_LOGINCAP
+ if (setusercontext (NULL, pwent, pwent->pw_uid,
+ LOGIN_SETLOGIN | LOGIN_SETPATH |
+ LOGIN_SETPRIORITY | LOGIN_SETRESOURCES |
+ LOGIN_SETUMASK | LOGIN_SETUSER |
+ LOGIN_SETENV) < 0) {
+ g_debug ("%s: setusercontext () failed for %s. "
+ "Aborting.", "gdm_session_worker_start_user_session",
+ login ? login : "(null)");
+ }
+
+ /* Propagate PATH environment variable from user context to child processes */
+
+ gdm_session_worker_set_environment_variable (worker, "PATH", getenv ("PATH"));
+
+#else
+ if (setuid (worker->priv->uid) < 0) {
+ g_debug ("GdmSessionWorker: could not reset uid - %s", g_strerror (errno));
+ _exit (1);
+ }
+#endif
+
environment = gdm_session_worker_get_environment (worker);
g_assert (geteuid () == getuid ());