1
0
mirror of https://github.com/rtbrick/bngblaster.git synced 2024-05-06 15:54:57 +00:00

remove getuid == 0 check

While the software needs "root, permissions getuid is not a good way to
check for the necessary permissions:
1. uid might be different from the effective uid - which is actually
   used for permissions
2. The binary might have all necessary capabilities set (via setcap) in
   this case the UID does not matter at all - the necessary permissions
   are set already.
This commit is contained in:
Istvan Ruzman
2021-07-05 17:26:10 +02:00
parent 9df9186e73
commit cecc96109e

View File

@ -645,20 +645,16 @@ main (int argc, char *argv[])
interactive = true;
break;
case 'S':
ctx->ctrl_socket_path = optarg;
ctx->ctrl_socket_path = optarg;
break;
case 'f':
ctx->config.interface_lock_force = true;
ctx->config.interface_lock_force = true;
break;
default:
bbl_print_usage();
exit(1);
}
}
if (geteuid() != 0) {
fprintf(stderr, "Error: Must be run with root privileges\n");
exit(1);
}
if(!config_file) {
fprintf(stderr, "Error: No configuration specified (-C / --config <file>)\n");