summaryrefslogtreecommitdiff
path: root/src/lib/emotion
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-01-08 19:46:23 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-01-08 19:46:23 +0900
commitb95ef3801f9719a8f8ff731e25d66a8d1dd417cd (patch)
tree258548da51b18d5fde17915bdc36cba44effcf40 /src/lib/emotion
parent323f293ab538ffc7431f6598736963a834c4f880 (diff)
setuid safeness - ensure if an app that is setuid doesn't do bad things
this makes efl ignore certain env vars for thnigs and entirely removes user modules (that no one ever used) etc. etc. to ensure that *IF* an app is setuid, there isn't a priv escalation path that is easy.
Diffstat (limited to 'src/lib/emotion')
-rw-r--r--src/lib/emotion/emotion_modules.c58
1 files changed, 23 insertions, 35 deletions
diff --git a/src/lib/emotion/emotion_modules.c b/src/lib/emotion/emotion_modules.c
index e6c5640a55..d39c575ceb 100644
--- a/src/lib/emotion/emotion_modules.c
+++ b/src/lib/emotion/emotion_modules.c
@@ -3,6 +3,7 @@
3#endif 3#endif
4 4
5#include "emotion_private.h" 5#include "emotion_private.h"
6#include <unistd.h>
6 7
7#ifdef EMOTION_STATIC_BUILD_XINE 8#ifdef EMOTION_STATIC_BUILD_XINE
8Eina_Bool xine_module_init(void); 9Eina_Bool xine_module_init(void);
@@ -53,55 +54,42 @@ static void
53_emotion_modules_load(void) 54_emotion_modules_load(void)
54{ 55{
55 char buf[PATH_MAX]; 56 char buf[PATH_MAX];
56 char *path;
57 57
58 if (_emotion_modules_loaded) return; 58 if (_emotion_modules_loaded) return;
59 _emotion_modules_loaded = EINA_TRUE; 59 _emotion_modules_loaded = EINA_TRUE;
60 60
61 if (getenv("EFL_RUN_IN_TREE")) 61 if (getuid() == getuid())
62 { 62 {
63 struct stat st; 63 if (getenv("EFL_RUN_IN_TREE"))
64 snprintf(buf, sizeof(buf), "%s/src/modules/emotion",
65 PACKAGE_BUILD_DIR);
66 if (stat(buf, &st) == 0)
67 { 64 {
68 const char *built_modules[] = { 65 struct stat st;
66 snprintf(buf, sizeof(buf), "%s/src/modules/emotion",
67 PACKAGE_BUILD_DIR);
68 if (stat(buf, &st) == 0)
69 {
70 const char *built_modules[] = {
69#ifdef EMOTION_BUILD_GSTREAMER 71#ifdef EMOTION_BUILD_GSTREAMER
70 "gstreamer", 72 "gstreamer",
71#endif 73#endif
72#ifdef EMOTION_BUILD_XINE 74#ifdef EMOTION_BUILD_XINE
73 "xine", 75 "xine",
74#endif 76#endif
75 NULL 77 NULL
76 }; 78 };
77 const char **itr; 79 const char **itr;
78 for (itr = built_modules; *itr != NULL; itr++) 80 for (itr = built_modules; *itr != NULL; itr++)
79 { 81 {
80 snprintf(buf, sizeof(buf), 82 snprintf(buf, sizeof(buf),
81 "%s/src/modules/emotion/%s/.libs", 83 "%s/src/modules/emotion/%s/.libs",
82 PACKAGE_BUILD_DIR, *itr); 84 PACKAGE_BUILD_DIR, *itr);
83 _emotion_modules = eina_module_list_get(_emotion_modules, buf, 85 _emotion_modules = eina_module_list_get(_emotion_modules, buf,
84 EINA_FALSE, NULL, NULL); 86 EINA_FALSE, NULL, NULL);
87 }
88 return;
85 } 89 }
86 return;
87 } 90 }
88 } 91 }
89 92
90 path = eina_module_environment_path_get("EMOTION_MODULES_DIR",
91 "/emotion/modules");
92 if (path)
93 {
94 _emotion_modules = eina_module_arch_list_get(_emotion_modules, path, MODULE_ARCH);
95 free(path);
96 }
97
98 path = eina_module_environment_path_get("HOME", "/.emotion");
99 if (path)
100 {
101 _emotion_modules = eina_module_arch_list_get(_emotion_modules, path, MODULE_ARCH);
102 free(path);
103 }
104
105 snprintf(buf, sizeof(buf), "%s/emotion/modules", eina_prefix_lib_get(_emotion_pfx)); 93 snprintf(buf, sizeof(buf), "%s/emotion/modules", eina_prefix_lib_get(_emotion_pfx));
106 _emotion_modules = eina_module_arch_list_get(_emotion_modules, buf, MODULE_ARCH); 94 _emotion_modules = eina_module_arch_list_get(_emotion_modules, buf, MODULE_ARCH);
107// no - this is dumb. load ALL modules we find - force ALL the code pages of 95// no - this is dumb. load ALL modules we find - force ALL the code pages of