Blame SOURCES/0002-session-Make-sure-we-set-path-in-cockpit-session.patch

c09cc9
From 8c1908035c919da58d29fab87b42126754f84405 Mon Sep 17 00:00:00 2001
c09cc9
From: petervo <petervo@redhat.com>
c09cc9
Date: Wed, 10 Feb 2016 02:29:00 -0800
c09cc9
Subject: [PATCH] session: Make sure we set path in cockpit-session
c09cc9
c09cc9
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
c09cc9
---
c09cc9
 src/ws/session.c | 7 ++++++-
c09cc9
 1 file changed, 6 insertions(+), 1 deletion(-)
c09cc9
c09cc9
diff --git a/src/ws/session.c b/src/ws/session.c
c09cc9
index e877f15..618ca2e 100644
c09cc9
--- a/src/ws/session.c
c09cc9
+++ b/src/ws/session.c
c09cc9
@@ -56,6 +56,7 @@
c09cc9
 #define MAX_BUFFER 64 * 1024
c09cc9
 #define AUTH_FD 3
c09cc9
 #define EX 127
c09cc9
+#define DEFAULT_PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
c09cc9
 
c09cc9
 static struct passwd *pwd;
c09cc9
 const char *rhost;
c09cc9
@@ -898,6 +899,7 @@ static const char *env_names[] = {
c09cc9
   "G_DEBUG",
c09cc9
   "G_MESSAGES_DEBUG",
c09cc9
   "G_SLICE",
c09cc9
+  "PATH",
c09cc9
   NULL
c09cc9
 };
c09cc9
 
c09cc9
@@ -910,6 +912,9 @@ save_environment (void)
c09cc9
   const char *value;
c09cc9
   int i, j;
c09cc9
 
c09cc9
+  /* Force save our default path */
c09cc9
+  setenv ("PATH", DEFAULT_PATH, 1);
c09cc9
+
c09cc9
   for (i = 0, j = 0; env_names[i] != NULL; i++)
c09cc9
     {
c09cc9
       value = getenv (env_names[i]);
c09cc9
@@ -957,7 +962,7 @@ main (int argc,
c09cc9
         }
c09cc9
 
c09cc9
       /* set a minimal environment */
c09cc9
-      setenv ("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
c09cc9
+      setenv ("PATH", DEFAULT_PATH, 1);
c09cc9
 
c09cc9
       if (setgid (0) != 0 || setuid (0) != 0)
c09cc9
         err (1, "couldn't switch permissions correctly");
c09cc9
-- 
c09cc9
1.8.3.1
c09cc9