From cecc96109eed572471168a70bd148403b86e5c55 Mon Sep 17 00:00:00 2001 From: Istvan Ruzman Date: Mon, 5 Jul 2021 17:26:10 +0200 Subject: [PATCH] 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. --- src/bbl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/bbl.c b/src/bbl.c index cdfea461..78295344 100644 --- a/src/bbl.c +++ b/src/bbl.c @@ -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 )\n");