summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-08 19:15:19 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-02-08 21:19:39 +0900
commitc6ff925132e414ca1753de075ea1db45a62212ca (patch)
tree5b261746ebc3b1a776ec8c3ad93fb8ea5dc4ef5d /src/lib/ecore_con
parent5bb34aa2ce11440480444bcd9889e43ee17af024 (diff)
ecore_con - only use XDG_RUNTIME_DIR if not setuid
this should address possible misuse of this env var in setuid apps. keep using home and tmp to maintain socket "abi" (the filenames that are used).
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con_local.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index a66a8b4500..fa909c8f07 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -29,10 +29,14 @@
29static const char * 29static const char *
30_ecore_con_local_path_get(void) 30_ecore_con_local_path_get(void)
31{ 31{
32 const char *homedir = getenv("XDG_RUNTIME_DIR"); 32 static char *homedir = NULL;
33 if (!homedir) homedir = eina_environment_home_get(); 33 if (homedir) return homedir;
34 if (!homedir) homedir = eina_environment_tmp_get();
35 34
35#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
36 if (getuid() == geteuid()) homedir = getenv("XDG_RUNTIME_DIR");
37#endif
38 if (!homedir) homedir = (char *)eina_environment_home_get();
39 if (!homedir) homedir = (char *)eina_environment_tmp_get();
36 return homedir; 40 return homedir;
37} 41}
38 42