[gdm] Revert "worker: get PATH from parent instead of #define"
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] Revert "worker: get PATH from parent instead of #define"
- Date: Tue, 22 Apr 2014 19:02:50 +0000 (UTC)
commit c9bebed00008724600aef6c401f21245f7678e45
Author: Ray Strode <rstrode redhat com>
Date: Tue Apr 22 15:00:44 2014 -0400
Revert "worker: get PATH from parent instead of #define"
This reverts commit e546e4dc6649a4fdf9065322420a28fa7e666782.
It's causing problems because bindir and sbindir are in the wrong
order for a user session.
common/Makefile.am | 1 +
common/gdm-common.c | 2 +-
configure.ac | 17 +++++++++++++++++
daemon/Makefile.am | 1 +
daemon/gdm-session-worker.c | 15 +++++++++++----
5 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/common/Makefile.am b/common/Makefile.am
index ece167b..2e97090 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -20,6 +20,7 @@ AM_CPPFLAGS = \
-DGDM_DEFAULTS_CONF=\"$(GDM_DEFAULTS_CONF)\" \
-DGDM_CUSTOM_CONF=\"$(GDM_CUSTOM_CONF)\" \
-DGDM_OLD_CONF=\"$(GDM_OLD_CONF)\" \
+ -DGDM_SESSION_DEFAULT_PATH=\"$(GDM_SESSION_DEFAULT_PATH)\" \
$(COMMON_CFLAGS) \
$(NULL)
diff --git a/common/gdm-common.c b/common/gdm-common.c
index aeb873b..4017313 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -909,7 +909,7 @@ gdm_get_script_environment (const char *username,
/* Runs as root */
g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (display_x11_authority_file));
g_hash_table_insert (hash, g_strdup ("DISPLAY"), g_strdup (display_name));
- g_hash_table_insert (hash, g_strdup ("PATH"), g_strdup (g_getenv ("PATH")));
+ g_hash_table_insert (hash, g_strdup ("PATH"), g_strdup (GDM_SESSION_DEFAULT_PATH));
g_hash_table_insert (hash, g_strdup ("RUNNING_UNDER_GDM"), g_strdup ("true"));
g_hash_table_remove (hash, "MAIL");
diff --git a/configure.ac b/configure.ac
index 242a969..aa0a13f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -274,6 +274,23 @@ AC_ARG_WITH(at-spi-registryd-directory,
AT_SPI_REGISTRYD_DIR=$with_at_spi_registryd_directory
AC_SUBST(AT_SPI_REGISTRYD_DIR)
+# Allow configuration of default PATH
+#
+withval=""
+AC_ARG_WITH(default-path,
+ AS_HELP_STRING([--with-default-path=<PATH>],
+ [PATH GDM will use as the user's default PATH]),
+ [if test x$withval != x; then
+ AC_MSG_RESULT("PATH ${withval} will be the default PATH.")
+ fi])
+
+if test x$withval != x; then
+ GDM_SESSION_DEFAULT_PATH="$withval"
+else
+ GDM_SESSION_DEFAULT_PATH="/usr/local/bin:/usr/bin:/bin"
+fi
+AC_SUBST(GDM_SESSION_DEFAULT_PATH)
+
dnl
dnl file that sets LANG
dnl
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 6944baa..691c939 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -19,6 +19,7 @@ AM_CPPFLAGS = \
-DGDM_XAUTH_DIR=\"$(GDM_XAUTH_DIR)\" \
-DGDM_SCREENSHOT_DIR=\"$(GDM_SCREENSHOT_DIR)\" \
-DGDM_CACHE_DIR=\""$(localstatedir)/cache/gdm"\" \
+ -DGDM_SESSION_DEFAULT_PATH=\"$(GDM_SESSION_DEFAULT_PATH)\" \
-DCONSOLEKIT_DIR=\"$(CONSOLEKIT_DIR)\" \
$(DISABLE_DEPRECATED_CFLAGS) \
$(DAEMON_CFLAGS) \
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 5fc42c6..8493fbd 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -90,6 +90,10 @@
#define GDM_PASSWD_AUXILLARY_BUFFER_SIZE 1024
#endif
+#ifndef GDM_SESSION_DEFAULT_PATH
+#define GDM_SESSION_DEFAULT_PATH "/usr/local/bin:/usr/bin:/bin"
+#endif
+
#ifndef GDM_SESSION_ROOT_UID
#define GDM_SESSION_ROOT_UID 0
#endif
@@ -1503,10 +1507,13 @@ gdm_session_worker_accredit_user (GdmSessionWorker *worker,
/* Let's give the user a default PATH if he doesn't already have one
*/
if (!gdm_session_worker_environment_variable_is_set (worker, "PATH")) {
- const char *path;
-
- path = g_getenv ("PATH");
- gdm_session_worker_set_environment_variable (worker, "PATH", path);
+ if (strcmp (BINDIR, "/usr/bin") == 0) {
+ gdm_session_worker_set_environment_variable (worker, "PATH",
+ GDM_SESSION_DEFAULT_PATH);
+ } else {
+ gdm_session_worker_set_environment_variable (worker, "PATH",
+ BINDIR ":" GDM_SESSION_DEFAULT_PATH);
+ }
}
if (! _change_user (worker, uid, gid)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]