check both uid and euid for root
Costa Tsaousis (ktsaou) committed
Jan 29, 2017 at 21:26 UTC
8c58f78f3304c18368e1a5655716ff0807ef1218
1 file changed
+5
-8
src/apps_plugin.c
+5
-8
@@ -3013,16 +3013,13 @@ static void parse_args(int argc, char **argv)
3013
}
3014
3015
static int am_i_running_as_root() {
3016
- if(getuid() != 0) {
3017
- if(debug)
3018
- info("I am not running as root.");
3019
- return 0;
3016
+ if(getuid() == 0 || geteuid() == 0) {
3017
+ if(debug) info("I am running as root.");
3018
+ return 1;
3019
}
3020
3022
- if(debug)
3023
- info("I am running as root.");
3024
-
3025
- return 1;
3021
+ if(debug) info("I am not running as root.");
3022
+ return 0;
3023
}
3024
3025
#ifdef HAVE_CAPABILITY