summaryrefslogtreecommitdiff
path: root/src/bin/efreet
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-09 15:48:11 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-09 18:38:28 +0900
commit6b090a00b6b7b2d76948f36079204a1ee26ae468 (patch)
tree9f0fd38ddcf50bc0d12decc682ef084ad8c233c7 /src/bin/efreet
parent75e1033682b2ecf9feed3eae938c9ee0c43fe795 (diff)
efreetd - dont use XDG_RUNTIME_DIR or EFREET_LOG env vars for setuid
if a setuid app needs efreet - it will not be able to contact the users' efreetd and thus may spawn it's own... and thus we cant have this now spawned efreetd using env vars inherited from the unpriveleged etc. user, so ignore them.
Diffstat (limited to 'src/bin/efreet')
-rw-r--r--src/bin/efreet/efreetd.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/bin/efreet/efreetd.c b/src/bin/efreet/efreetd.c
index 8ed670d75f..2da069aa28 100644
--- a/src/bin/efreet/efreetd.c
+++ b/src/bin/efreet/efreetd.c
@@ -51,31 +51,18 @@ main(int argc, char *argv[])
51 if (!ipc_init()) goto ipc_error; 51 if (!ipc_init()) goto ipc_error;
52 if (!cache_init()) goto cache_error; 52 if (!cache_init()) goto cache_error;
53 53
54 s = getenv("XDG_RUNTIME_DIR"); 54 log_file_dir = eina_environment_tmp_get();
55 if (s) log_file_dir = s;
56 else log_file_dir = eina_environment_tmp_get();
57 if (gethostname(buf, sizeof(buf)) < 0) 55 if (gethostname(buf, sizeof(buf)) < 0)
58 hostname_str = ""; 56 hostname_str = "";
59 else 57 else
60 hostname_str = buf; 58 hostname_str = buf;
61 if (getenv("EFREETD_LOG")) 59 snprintf(path, sizeof(path), "%s/efreetd_%s_XXXXXX.log",
60 log_file_dir, hostname_str);
61 fd = eina_file_mkstemp(path, NULL);
62 if (fd < 0)
62 { 63 {
63 snprintf(path, sizeof(path), "%s/efreetd_%s_XXXXXX.log", 64 ERR("Can't create log file '%s'\b", path);;
64 log_file_dir, hostname_str); 65 goto tmp_error;
65 fd = eina_file_mkstemp(path, NULL);
66 if (fd < 0)
67 {
68 ERR("Can't create log file '%s'\b", path);;
69 goto tmp_error;
70 }
71 }
72 else
73 {
74 fd = open("/dev/null", O_WRONLY);
75 if (fd < 0)
76 {
77 goto tmp_error;
78 }
79 } 66 }
80 log = fdopen(fd, "wb"); 67 log = fdopen(fd, "wb");
81 if (!log) goto tmp_error; 68 if (!log) goto tmp_error;