From e8c13118eb39a3acaf70430951f7049c53799bae Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 8 Jan 2014 22:06:41 +0900 Subject: [PATCH] fix mingw build for setuid fix/checks --- configure.ac | 1 + src/lib/ecore/ecore.c | 4 ++- src/lib/ecore/ecore_exe.c | 5 +++- src/lib/ecore_con/ecore_con_local.c | 14 ++++++--- src/lib/ecore_con/ecore_con_socks.c | 4 ++- src/lib/ecore_evas/ecore_evas_module.c | 6 ++-- src/lib/ecore_fb/ecore_fb.c | 6 +++- src/lib/ecore_fb/ecore_fb_ts.c | 6 +++- src/lib/ecore_imf/ecore_imf_module.c | 4 ++- src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c | 16 ++-------- src/lib/edje/edje_edit.c | 4 ++- src/lib/edje/edje_module.c | 8 +++-- src/lib/eeze/eeze_sensor.c | 6 +++- src/lib/efreet/efreet_base.c | 29 +++++++++++++++---- src/lib/efreet/efreet_menu.c | 5 +++- src/lib/eina/eina_file_common.c | 10 +++++-- src/lib/eina/eina_module.c | 5 ++-- src/lib/eina/eina_prefix.c | 12 ++++++-- src/lib/emotion/emotion_modules.c | 4 ++- src/lib/ethumb/ethumb.c | 16 ++++++++-- src/lib/evas/cserve2/evas_cs2_client.c | 8 +++-- src/lib/evas/file/evas_module.c | 12 ++++++-- .../engines/extn/ecore_evas_extn_buf.c | 4 ++- .../emotion/gstreamer/emotion_gstreamer.c | 4 ++- src/modules/emotion/gstreamer/emotion_sink.c | 12 ++++++-- .../emotion/gstreamer1/emotion_gstreamer.c | 16 +++++++--- src/modules/evas/engines/fb/evas_fb_main.c | 6 +++- .../engines/gl_common/evas_gl_file_cache.c | 8 +++-- src/modules/evas/engines/gl_x11/evas_engine.c | 5 +++- 29 files changed, 175 insertions(+), 65 deletions(-) diff --git a/configure.ac b/configure.ac index b63ddb3dce..6e772a543f 100644 --- a/configure.ac +++ b/configure.ac @@ -544,6 +544,7 @@ mtrace \ realpath \ strlcpy \ geteuid \ +getuid \ ]) AC_FUNC_ALLOCA diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c index d81cc6b16f..6356b2f12d 100644 --- a/src/lib/ecore/ecore.c +++ b/src/lib/ecore/ecore.c @@ -131,7 +131,9 @@ ecore_system_modules_load(void) { char buf[PATH_MAX] = ""; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EFL_RUN_IN_TREE")) { diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c index f13197216c..c533d654ec 100644 --- a/src/lib/ecore/ecore_exe.c +++ b/src/lib/ecore/ecore_exe.c @@ -1609,7 +1609,10 @@ _ecore_exe_exec_it(const char *exe_cmd, { if (!shell) /* Find users preferred shell. */ { - if (getuid() == getuid()) shell = getenv("SHELL"); +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif + shell = getenv("SHELL"); if (!shell) shell = "/bin/sh"; } diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c index 6bd60d24df..20a8d5fbaa 100644 --- a/src/lib/ecore_con/ecore_con_local.c +++ b/src/lib/ecore_con/ecore_con_local.c @@ -73,7 +73,9 @@ ecore_con_local_connect(Ecore_Con_Server *svr, if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) { - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { homedir = getenv("XDG_RUNTIME_DIR"); if (!homedir) @@ -88,6 +90,7 @@ ecore_con_local_connect(Ecore_Con_Server *svr, snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name, svr->port); } +#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID) else { struct passwd *pw = getpwent(); @@ -99,7 +102,7 @@ ecore_con_local_connect(Ecore_Con_Server *svr, snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", pw->pw_dir, svr->name, svr->port); } - +#endif } else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) { @@ -218,7 +221,9 @@ ecore_con_local_listen( if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) { - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { homedir = getenv("XDG_RUNTIME_DIR"); if (!homedir) @@ -231,6 +236,7 @@ ecore_con_local_listen( } } } +#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID) else { struct passwd *pw = getpwent(); @@ -238,7 +244,7 @@ ecore_con_local_listen( if ((!pw) || (!pw->pw_dir)) homedir = "/tmp"; else homedir = pw->pw_dir; } - +#endif mask = S_IRUSR | S_IWUSR | S_IXUSR; snprintf(buf, sizeof(buf), "%s/.ecore", homedir); if (stat(buf, &st) < 0) diff --git a/src/lib/ecore_con/ecore_con_socks.c b/src/lib/ecore_con/ecore_con_socks.c index 379079b165..5ff74b477e 100644 --- a/src/lib/ecore_con/ecore_con_socks.c +++ b/src/lib/ecore_con/ecore_con_socks.c @@ -596,7 +596,9 @@ ecore_con_socks_init(void) unsigned char addr6[sizeof(struct in6_addr)]; #endif - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { /* ECORE_CON_SOCKS_V4=[user@]host-port:[1|0] */ socks = getenv("ECORE_CON_SOCKS_V4"); diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c index c98f5ad511..5285dc4cfe 100644 --- a/src/lib/ecore_evas/ecore_evas_module.c +++ b/src/lib/ecore_evas/ecore_evas_module.c @@ -39,7 +39,9 @@ _ecore_evas_engine_load(const char *engine) { char tmp[PATH_MAX] = ""; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (run_in_tree) { @@ -81,7 +83,7 @@ _ecore_evas_engine_init(void) // _registered_engines = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free)); _registered_engines = eina_hash_string_small_new(NULL); - if (getuid() == getuid()) + if (getuid() == geteuid()) { if (getenv("EFL_RUN_IN_TREE")) { diff --git a/src/lib/ecore_fb/ecore_fb.c b/src/lib/ecore_fb/ecore_fb.c index 3bce09de0b..85ad087d33 100644 --- a/src/lib/ecore_fb/ecore_fb.c +++ b/src/lib/ecore_fb/ecore_fb.c @@ -108,7 +108,11 @@ _ecore_fb_size_get(int *w, int *h) struct fb_var_screeninfo fb_var; int fb; - if ((getuid() == getuid()) && (getenv("EVAS_FB_DEV"))) + if ( +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + (getuid() == geteuid()) && +#endif + (getenv("EVAS_FB_DEV"))) fb = open(getenv("EVAS_FB_DEV"), O_RDWR); else { diff --git a/src/lib/ecore_fb/ecore_fb_ts.c b/src/lib/ecore_fb/ecore_fb_ts.c index 3f699c05c9..00a3f31530 100644 --- a/src/lib/ecore_fb/ecore_fb_ts.c +++ b/src/lib/ecore_fb/ecore_fb_ts.c @@ -81,7 +81,11 @@ ecore_fb_ts_init(void) { #ifdef HAVE_TSLIB char *tslib_tsdevice = NULL; - if ((getuid() == getuid()) && ((tslib_tsdevice = getenv("TSLIB_TSDEVICE")))) + if ( +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + (getuid() == geteuid()) && +#endif + ((tslib_tsdevice = getenv("TSLIB_TSDEVICE")))) { printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice ); _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */ diff --git a/src/lib/ecore_imf/ecore_imf_module.c b/src/lib/ecore_imf/ecore_imf_module.c index 3005daa611..b0e1fe0983 100644 --- a/src/lib/ecore_imf/ecore_imf_module.c +++ b/src/lib/ecore_imf/ecore_imf_module.c @@ -36,7 +36,9 @@ ecore_imf_module_init(void) "ECORE_IMF", "ecore_imf", "checkme", PACKAGE_BIN_DIR, PACKAGE_LIB_DIR, PACKAGE_DATA_DIR, PACKAGE_DATA_DIR); - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EFL_RUN_IN_TREE")) { diff --git a/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c b/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c index 2a89c59e07..0e737f16a7 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c @@ -18,19 +18,9 @@ _ecore_xcb_xdefaults_init(void) LOGFN(__FILE__, __LINE__, __FUNCTION__); - if (getuid() == getuid()) - { - if (getenv("HOME")) - snprintf(buff, sizeof(buff), "%s/.Xdefaults", getenv("HOME")); - else return; - } - else - { - struct passwd *pw = getpwent(); - - if ((!pw) || (!pw->pw_dir)) return; - snprintf(buff, sizeof(buff), "%s/.Xdefaults", pw->pw_dir); - } + if (getenv("HOME")) + snprintf(buff, sizeof(buff), "%s/.Xdefaults", getenv("HOME")); + else return; if ((_ecore_xcb_xdefaults_file = eina_file_open(buff, EINA_FALSE))) { eina_mmap_safety_enabled_set(EINA_TRUE); diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 5e686cb287..15c3de9c2e 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -6808,7 +6808,9 @@ _edje_edit_embryo_rebuild(Edje_Edit *eed) #else # define BIN_EXT #endif - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EFL_RUN_IN_TREE")) { diff --git a/src/lib/edje/edje_module.c b/src/lib/edje/edje_module.c index 52bd47dd28..0e6882c7c1 100644 --- a/src/lib/edje/edje_module.c +++ b/src/lib/edje/edje_module.c @@ -37,7 +37,9 @@ _edje_module_handle_load(const char *module) { char tmp[PATH_MAX] = ""; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (run_in_tree) { @@ -77,7 +79,9 @@ _edje_module_init(void) _registered_modules = eina_hash_string_small_new(EINA_FREE_CB(eina_module_free)); - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EFL_RUN_IN_TREE")) { diff --git a/src/lib/eeze/eeze_sensor.c b/src/lib/eeze/eeze_sensor.c index 831fb12df2..8a8170c20c 100644 --- a/src/lib/eeze/eeze_sensor.c +++ b/src/lib/eeze/eeze_sensor.c @@ -82,7 +82,11 @@ eeze_sensor_modules_load(void) * is one of these items. We do load the modules from the builddir if the * environment is set. Normal case is to use installed modules from system */ - if ((getuid() == getuid()) && (getenv("EFL_RUN_IN_TREE"))) + if ( +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + (getuid() == geteuid()) && +#endif + (getenv("EFL_RUN_IN_TREE"))) { const char **itr; diff --git a/src/lib/efreet/efreet_base.c b/src/lib/efreet/efreet_base.c index 5836d95a5d..7bde732bae 100644 --- a/src/lib/efreet/efreet_base.c +++ b/src/lib/efreet/efreet_base.c @@ -278,18 +278,24 @@ efreet_dirs_init(void) struct stat st; /* efreet_home_dir */ - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif efreet_home_dir = getenv("HOME"); +#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID) else { struct passwd *pw = getpwent(); if ((pw) && (pw->pw_dir)) efreet_home_dir = pw->pw_dir; } +#endif #ifdef _WIN32 if (!efreet_home_dir || efreet_home_dir[0] == '\0') { - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif efreet_home_dir = getenv("USERPROFILE"); } #endif @@ -315,7 +321,10 @@ efreet_dirs_init(void) xdg_config_dirs = efreet_dirs_get("XDG_CONFIG_DIRS", "/etc/xdg"); /* xdg_runtime_dir */ - if (getuid() == getuid()) xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif + xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); if (!xdg_runtime_dir) { snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX"); @@ -390,7 +399,10 @@ efreet_dir_get(const char *key, const char *fallback) char *dir = NULL; const char *t; - if (getuid() == getuid()) dir = getenv(key); +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif + dir = getenv(key); if (!dir || dir[0] == '\0') { int len; @@ -425,7 +437,10 @@ efreet_dirs_get(const char *key, const char *fallback) char *s, *p; size_t len; - if (getuid() == getuid()) path = getenv(key); +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif + path = getenv(key); if (!path || (path[0] == '\0')) path = fallback; if (!path) return dirs; @@ -496,7 +511,9 @@ efreet_env_expand(const char *in) { memcpy(env, e1, len); env[len] = 0; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { val = getenv(env); if (val) eina_strbuf_append(sb, val); diff --git a/src/lib/efreet/efreet_menu.c b/src/lib/efreet/efreet_menu.c index 1af99f1b0a..03ce851e6e 100644 --- a/src/lib/efreet/efreet_menu.c +++ b/src/lib/efreet/efreet_menu.c @@ -14,6 +14,7 @@ static int _efreet_menu_log_dom = -1; #include "Efreet.h" #include "efreet_private.h" #include "efreet_xml.h" +#include typedef struct Efreet_Menu_Move Efreet_Menu_Move; @@ -399,7 +400,9 @@ efreet_menu_init(void) return 0; } - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif efreet_menu_prefix = getenv("XDG_MENU_PREFIX"); if (!efreet_menu_prefix) efreet_menu_prefix = ""; diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c index a0389943a9..37f3f51c53 100644 --- a/src/lib/eina/eina_file_common.c +++ b/src/lib/eina/eina_file_common.c @@ -902,7 +902,10 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path) mode_t old_umask; #ifndef HAVE_EVIL - if (getuid() == getuid()) tmpdir = getenv("TMPDIR"); +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif + tmpdir = getenv("TMPDIR"); if (!tmpdir) tmpdir = "/tmp"; #else tmpdir = (char *)evil_tmpdir_get(); @@ -933,7 +936,10 @@ eina_file_mkdtemp(const char *templatename, Eina_Tmpstr **path) char *tmpdirname; #ifndef HAVE_EVIL - if (getuid() == getuid()) tmpdir = getenv("TMPDIR"); +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif + tmpdir = getenv("TMPDIR"); if (!tmpdir) tmpdir = "/tmp"; #else tmpdir = (char *)evil_tmpdir_get(); diff --git a/src/lib/eina/eina_module.c b/src/lib/eina/eina_module.c index 8c81873dc6..29b680277f 100644 --- a/src/lib/eina/eina_module.c +++ b/src/lib/eina/eina_module.c @@ -431,8 +431,9 @@ EAPI char *eina_module_environment_path_get(const char *env, const char *env_dir; EINA_SAFETY_ON_NULL_RETURN_VAL(env, NULL); - if (getuid() != getuid()) return NULL; // if setuid dont use dangerous env - +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() != geteuid()) return NULL; // if setuid dont use dangerous env +#endif env_dir = getenv(env); if (env_dir) { diff --git a/src/lib/eina/eina_prefix.c b/src/lib/eina/eina_prefix.c index 3e8709f335..7428ec377f 100644 --- a/src/lib/eina/eina_prefix.c +++ b/src/lib/eina/eina_prefix.c @@ -335,7 +335,9 @@ _try_argv(Eina_Prefix *pfx, const char *argv0) } /* 3. argv0 no path - look in PATH */ - if (getuid() != getuid()) return 0; +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() != geteuid()) return 0; +#endif path = getenv("PATH"); if (!path) { @@ -384,7 +386,9 @@ _get_env_var(char **var, const char *envprefix, const char *envsuffix, const cha char env[1024]; const char *s; - if (getuid() != getuid()) return 0; +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() != geteuid()) return 0; +#endif snprintf(env, sizeof(env), "%s_%s_DIR", envprefix, envsuffix); s = getenv(env); if (s) @@ -420,7 +424,9 @@ _get_env_vars(Eina_Prefix *pfx, const char *prefix; int ret = 0; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { snprintf(env, sizeof(env), "%s_PREFIX", envprefix); if ((prefix = getenv(env))) STRDUP_REP(pfx->prefix_path, prefix); diff --git a/src/lib/emotion/emotion_modules.c b/src/lib/emotion/emotion_modules.c index d39c575ceb..afbf9416ea 100644 --- a/src/lib/emotion/emotion_modules.c +++ b/src/lib/emotion/emotion_modules.c @@ -58,7 +58,9 @@ _emotion_modules_load(void) if (_emotion_modules_loaded) return; _emotion_modules_loaded = EINA_TRUE; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EFL_RUN_IN_TREE")) { diff --git a/src/lib/ethumb/ethumb.c b/src/lib/ethumb/ethumb.c index c408be516d..e3b3764d57 100644 --- a/src/lib/ethumb/ethumb.c +++ b/src/lib/ethumb/ethumb.c @@ -159,7 +159,9 @@ _ethumb_plugins_load(void) if (_plugins_loaded) return; _plugins_loaded = EINA_TRUE; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EFL_RUN_IN_TREE")) { @@ -257,11 +259,14 @@ ethumb_init(void) ecore_evas_init(); edje_init(); - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { home = getenv("HOME"); snprintf(buf, sizeof(buf), "%s/.thumbnails", home); } +#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID) else { struct passwd *pw = getpwent(); @@ -269,6 +274,7 @@ ethumb_init(void) if ((!pw) || (!pw->pw_dir)) goto error_plugins_ext; snprintf(buf, sizeof(buf), "%s/.thumbnails", pw->pw_dir); } +#endif _home_thumb_dir = eina_stringshare_add(buf); _thumb_category_normal = eina_stringshare_add("normal"); @@ -707,13 +713,16 @@ _ethumb_build_absolute_path(const char *path, char buf[PATH_MAX]) } else if (path[0] == '~') { - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { const char *home = getenv("HOME"); if (!home) return NULL; strncpy(p, home, PATH_MAX - 1); p[PATH_MAX - 1] = 0; } +#if !defined(HAVE_GETUID) || defined(HAVE_GETEUID) else { struct passwd *pw = getpwent(); @@ -722,6 +731,7 @@ _ethumb_build_absolute_path(const char *path, char buf[PATH_MAX]) strncpy(p, pw->pw_dir, PATH_MAX - 1); p[PATH_MAX - 1] = 0; } +#endif len = strlen(p); p += len; p[0] = '/'; diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c index 0afd91f3fa..ab6c30eeeb 100644 --- a/src/lib/evas/cserve2/evas_cs2_client.c +++ b/src/lib/evas/cserve2/evas_cs2_client.c @@ -128,7 +128,9 @@ _socket_path_set(char *path) char *env; char buf[UNIX_PATH_MAX]; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { env = getenv("EVAS_CSERVE2_SOCKET"); if (env && env[0]) @@ -142,7 +144,9 @@ _socket_path_set(char *path) /* FIXME: check we can actually create this socket */ strcpy(path, buf); #if 0 - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { env = getenv("XDG_RUNTIME_DIR"); if (!env || !env[0]) diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c index 01bf0b0f1d..28b4243cdd 100644 --- a/src/lib/evas/file/evas_module.c +++ b/src/lib/evas/file/evas_module.c @@ -56,7 +56,9 @@ evas_module_paths_init(void) { char *libdir, *path; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EFL_RUN_IN_TREE")) { @@ -326,7 +328,9 @@ evas_module_engine_list(void) const char *fname = fi->path + fi->name_start; buf[0] = '\0'; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (run_in_tree) { @@ -425,7 +429,9 @@ evas_module_find_type(Evas_Module_Type type, const char *name) } buffer[0] = '\0'; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (run_in_tree) { diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c index 37261fa41f..593a9457a3 100644 --- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c +++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn_buf.c @@ -42,7 +42,9 @@ _extnbuf_new(const char *base, int id, Eina_Bool sys, int num, { const char *s = NULL; - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { s = getenv("XDG_RUNTIME_DIR"); if (!s) s = getenv("TMPDIR"); diff --git a/src/modules/emotion/gstreamer/emotion_gstreamer.c b/src/modules/emotion/gstreamer/emotion_gstreamer.c index 1f4b9f5509..cae7acd0e5 100644 --- a/src/modules/emotion/gstreamer/emotion_gstreamer.c +++ b/src/modules/emotion/gstreamer/emotion_gstreamer.c @@ -1749,7 +1749,9 @@ _emotion_gstreamer_video_pipeline_parse(Emotion_Gstreamer_Video *ev, /** NOTE: you need to set: GST_DEBUG_DUMP_DOT_DIR=/tmp EMOTION_ENGINE=gstreamer to save the $EMOTION_GSTREAMER_DOT file in '/tmp' */ /** then call dot -Tpng -oemotion_pipeline.png /tmp/$TIMESTAMP-$EMOTION_GSTREAMER_DOT.dot */ - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(ev->pipeline), diff --git a/src/modules/emotion/gstreamer/emotion_sink.c b/src/modules/emotion/gstreamer/emotion_sink.c index 8697448bd7..7677f9e47d 100644 --- a/src/modules/emotion/gstreamer/emotion_sink.c +++ b/src/modules/emotion/gstreamer/emotion_sink.c @@ -866,7 +866,9 @@ _emotion_gstreamer_cancel(void *data, Ecore_Thread *thread) ev->threads = eina_list_remove(ev->threads, thread); - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(ev->pipeline), GST_DEBUG_GRAPH_SHOW_ALL, getenv("EMOTION_GSTREAMER_DOT")); } @@ -888,7 +890,9 @@ _emotion_gstreamer_end(void *data, Ecore_Thread *thread) ev->play_started = 1; } - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(ev->pipeline), GST_DEBUG_GRAPH_SHOW_ALL, getenv("EMOTION_GSTREAMER_DOT")); } @@ -1433,7 +1437,9 @@ gstreamer_video_sink_new(Emotion_Gstreamer_Video *ev, /** NOTE: you need to set: GST_DEBUG_DUMP_DOT_DIR=/tmp EMOTION_ENGINE=gstreamer to save the $EMOTION_GSTREAMER_DOT file in '/tmp' */ /** then call dot -Tpng -oemotion_pipeline.png /tmp/$TIMESTAMP-$EMOTION_GSTREAMER_DOT.dot */ - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(playbin), GST_DEBUG_GRAPH_SHOW_ALL, getenv("EMOTION_GSTREAMER_DOT")); } diff --git a/src/modules/emotion/gstreamer1/emotion_gstreamer.c b/src/modules/emotion/gstreamer1/emotion_gstreamer.c index ef5f943c67..84813233ce 100644 --- a/src/modules/emotion/gstreamer1/emotion_gstreamer.c +++ b/src/modules/emotion/gstreamer1/emotion_gstreamer.c @@ -1542,7 +1542,9 @@ _emotion_gstreamer_video_pipeline_parse(Emotion_Gstreamer_Video *ev, /** NOTE: you need to set: GST_DEBUG_DUMP_DOT_DIR=/tmp EMOTION_ENGINE=gstreamer to save the $EMOTION_GSTREAMER_DOT file in '/tmp' */ /** then call dot -Tpng -oemotion_pipeline.png /tmp/$TIMESTAMP-$EMOTION_GSTREAMER_DOT.dot */ - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(ev->pipeline), @@ -1629,7 +1631,9 @@ _emotion_gstreamer_cancel(void *data, Ecore_Thread *thread) ev->threads = eina_list_remove(ev->threads, thread); - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(ev->pipeline), GST_DEBUG_GRAPH_SHOW_ALL, getenv("EMOTION_GSTREAMER_DOT")); } @@ -1650,7 +1654,9 @@ _emotion_gstreamer_end(void *data, Ecore_Thread *thread) gst_element_set_state(ev->pipeline, GST_STATE_PLAYING); } - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(ev->pipeline), GST_DEBUG_GRAPH_SHOW_ALL, getenv("EMOTION_GSTREAMER_DOT")); } @@ -1763,7 +1769,9 @@ _create_pipeline (Emotion_Gstreamer_Video *ev, /** NOTE: you need to set: GST_DEBUG_DUMP_DOT_DIR=/tmp EMOTION_ENGINE=gstreamer to save the $EMOTION_GSTREAMER_DOT file in '/tmp' */ /** then call dot -Tpng -oemotion_pipeline.png /tmp/$TIMESTAMP-$EMOTION_GSTREAMER_DOT.dot */ - if (getuid() == getuid()) +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() == geteuid()) +#endif { if (getenv("EMOTION_GSTREAMER_DOT")) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(GST_BIN(playbin), GST_DEBUG_GRAPH_SHOW_ALL, getenv("EMOTION_GSTREAMER_DOT")); } diff --git a/src/modules/evas/engines/fb/evas_fb_main.c b/src/modules/evas/engines/fb/evas_fb_main.c index 5dd4ee006c..66bea83e7c 100644 --- a/src/modules/evas/engines/fb/evas_fb_main.c +++ b/src/modules/evas/engines/fb/evas_fb_main.c @@ -456,7 +456,11 @@ fb_init(int vt EINA_UNUSED, int device) if (vt != 0) fb_setvt(vt); #endif - if ((getuid() == getuid()) && (getenv("EVAS_FB_DEV"))) + if ( +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + (getuid() == geteuid()) && +#endif + (getenv("EVAS_FB_DEV"))) fb = open(getenv("EVAS_FB_DEV"), O_RDWR); else { diff --git a/src/modules/evas/engines/gl_common/evas_gl_file_cache.c b/src/modules/evas/engines/gl_common/evas_gl_file_cache.c index d12e30765f..d629666101 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_file_cache.c +++ b/src/modules/evas/engines/gl_common/evas_gl_file_cache.c @@ -48,7 +48,9 @@ evas_gl_common_file_cache_mkpath(const char *path) char ss[PATH_MAX]; unsigned int i; - if (getuid() != getuid()) return EINA_FALSE; +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() != geteuid()) return EINA_FALSE; +#endif if (evas_gl_common_file_cache_is_dir(path)) return EINA_TRUE; for (i = 0; path[i]; ss[i] = path[i], i++) @@ -71,7 +73,9 @@ evas_gl_common_file_cache_dir_check(char *cache_dir, int num) char *home = NULL; char *subdir = ".cache/evas_gl_common_caches"; - if (getuid() != getuid()) return 0; +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + if (getuid() != geteuid()) return 0; +#endif home = getenv("HOME"); if ((!home) || (!home[0])) return 0; diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c index dd921d27d1..5fb289b5cb 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.c +++ b/src/modules/evas/engines/gl_x11/evas_engine.c @@ -1527,7 +1527,10 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode) // Save contents of the framebuffer to a file if (swap_buffer_debug_mode == -1) { - if ((getuid() == getuid()) && + if ( +#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) + (getuid() == geteuid()) && +#endif ((dname = getenv("EVAS_GL_SWAP_BUFFER_DEBUG_DIR")))) { int stat;