remove root check

We can perfectly do icmp without root by using capabalities.  So,
instead of doing unsufficient checks beforehand, we just try and fail if
it doesn't work.

Signed-off-by: Danijel Tasov <m@rbfh.de>
This commit is contained in:
Danijel Tasov 2023-09-23 16:18:08 +02:00
parent f5c5a7438f
commit 8272d73e57
2 changed files with 0 additions and 16 deletions

View file

@ -300,19 +300,6 @@ char *np_escaped_string (const char *string) {
int np_check_if_root(void) { return (geteuid() == 0); }
int np_warn_if_not_root(void) {
int status = np_check_if_root();
if(!status) {
printf(_("Warning: "));
printf(_("This plugin must be either run as root or setuid root.\n"));
printf(_("To run as root, you can use a tool like sudo.\n"));
printf(_("To set the setuid permissions, use the command:\n"));
/* XXX could we use something like progname? */
printf("\tchmod u+s yourpluginfile\n");
}
return status;
}
/*
* Extract the value from key/value pairs, or return NULL. The value returned
* can be free()ed.

View file

@ -417,9 +417,6 @@ main(int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* print a helpful error message if geteuid != 0 */
np_warn_if_not_root();
/* we only need to be setsuid when we get the sockets, so do
* that before pointer magic (esp. on network data) */
icmp_sockerrno = udp_sockerrno = tcp_sockerrno = sockets = 0;