@@ -144,8 +144,6 @@ int handle_debug_table(struct state *state, int argc, char **argv)
}
}
- check_root_or_die("batctl");
-
if (read_opt & UNICAST_ONLY && read_opt & MULTICAST_ONLY) {
fprintf(stderr, "Error - '-u' and '-m' are exclusive options\n");
debug_table_usage(state);
@@ -946,14 +946,6 @@ void get_random_bytes(void *buf, size_t buflen)
get_random_bytes_fallback(buf, buflen);
}
-void check_root_or_die(const char *cmd)
-{
- if (geteuid() != 0) {
- fprintf(stderr, "Error - you must be root to run '%s' !\n", cmd);
- exit(EXIT_FAILURE);
- }
-}
-
int parse_bool(const char *val, bool *res)
{
if (strcasecmp(val, "0") == 0 ||
@@ -60,7 +60,6 @@ int check_mesh_iface(struct state *state);
int check_mesh_iface_ownership(struct state *state, char *hard_iface);
void get_random_bytes(void *buf, size_t buflen);
-void check_root_or_die(const char *cmd);
int parse_bool(const char *val, bool *res);
bool parse_throughput(char *buff, const char *description,
@@ -598,8 +598,6 @@ int handle_json_query(struct state *state, int argc, char **argv)
}
}
- check_root_or_die("batctl");
-
err = netlink_print_query_json(state, json_query);
return err;
@@ -299,8 +299,6 @@ static int gw_mode(struct state *state, int argc, char **argv)
if (argc == 1)
return gw_read_setting(state);
- check_root_or_die("batctl gw_mode");
-
res = parse_gw(state, argc, argv);
if (res < 0)
return EXIT_FAILURE;
@@ -436,8 +436,6 @@ static int interface(struct state *state, int argc, char **argv)
if (rest_argc == 0)
return print_interfaces(state);
- check_root_or_die("batctl interface");
-
if ((strcmp(rest_argv[0], "add") != 0) && (strcmp(rest_argv[0], "a") != 0) &&
(strcmp(rest_argv[0], "del") != 0) && (strcmp(rest_argv[0], "d") != 0) &&
(strcmp(rest_argv[0], "create") != 0) && (strcmp(rest_argv[0], "c") != 0) &&
@@ -128,8 +128,6 @@ static int loglevel(struct state *state, int argc, char **argv)
}
if (argc != 1) {
- check_root_or_die("batctl loglevel");
-
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "none") == 0) {
log_level_globals.log_level = 0;
@@ -132,8 +132,6 @@ static int ping(struct state *state, int argc, char **argv)
return EXIT_FAILURE;
}
- check_root_or_die("batctl ping");
-
dst_string = argv[found_args];
bat_hosts_init(0);
bat_host = bat_hosts_find_by_name(dst_string);
@@ -279,8 +279,6 @@ static int routing_algo(struct state *state, int argc, char **argv)
}
}
- check_root_or_die("batctl routing_algo");
-
if (argc == 2)
return write_default_ra(SYS_SELECTED_RA_PATH, argv[1]);
@@ -245,8 +245,6 @@ int handle_sys_setting(struct state *state, int argc, char **argv)
if (argc == 1)
return sys_read_setting(state);
- check_root_or_die("batctl");
-
if (settings->parse) {
res = settings->parse(state, argc, argv);
if (res < 0)
@@ -1539,8 +1539,6 @@ static int tcpdump(struct state *state __maybe_unused, int argc, char **argv)
return EXIT_FAILURE;
}
- check_root_or_die("batctl tcpdump");
-
bat_hosts_init(read_opt);
signal(SIGINT, sig_handler);
@@ -352,8 +352,6 @@ static int throughputmeter(struct state *state, int argc, char **argv)
return EXIT_FAILURE;
}
- check_root_or_die("batctl throughputmeter");
-
dst_string = argv[found_args];
bat_hosts_init(read_opt);
bat_host = bat_hosts_find_by_name(dst_string);
@@ -83,8 +83,6 @@ static int traceroute(struct state *state, int argc, char **argv)
return EXIT_FAILURE;
}
- check_root_or_die("batctl traceroute");
-
dst_string = argv[found_args];
bat_hosts_init(read_opt);
bat_host = bat_hosts_find_by_name(dst_string);
@@ -32,8 +32,6 @@ static int translate(struct state *state, int argc, char **argv)
return EXIT_FAILURE;
}
- check_root_or_die("batctl translate");
-
dst_string = argv[1];
bat_hosts_init(0);
bat_host = bat_hosts_find_by_name(dst_string);