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.
This commit is contained in:
Carsten Haitzler 2017-02-09 15:48:11 +09:00
parent 75e1033682
commit 6b090a00b6
1 changed files with 7 additions and 20 deletions

View File

@ -51,31 +51,18 @@ main(int argc, char *argv[])
if (!ipc_init()) goto ipc_error;
if (!cache_init()) goto cache_error;
s = getenv("XDG_RUNTIME_DIR");
if (s) log_file_dir = s;
else log_file_dir = eina_environment_tmp_get();
log_file_dir = eina_environment_tmp_get();
if (gethostname(buf, sizeof(buf)) < 0)
hostname_str = "";
else
hostname_str = buf;
if (getenv("EFREETD_LOG"))
snprintf(path, sizeof(path), "%s/efreetd_%s_XXXXXX.log",
log_file_dir, hostname_str);
fd = eina_file_mkstemp(path, NULL);
if (fd < 0)
{
snprintf(path, sizeof(path), "%s/efreetd_%s_XXXXXX.log",
log_file_dir, hostname_str);
fd = eina_file_mkstemp(path, NULL);
if (fd < 0)
{
ERR("Can't create log file '%s'\b", path);;
goto tmp_error;
}
}
else
{
fd = open("/dev/null", O_WRONLY);
if (fd < 0)
{
goto tmp_error;
}
ERR("Can't create log file '%s'\b", path);;
goto tmp_error;
}
log = fdopen(fd, "wb");
if (!log) goto tmp_error;