From: Arran Cudbard-Bell Date: Tue, 3 Nov 2020 18:30:12 +0000 (-0600) Subject: Should use euid not uid as changing from root removes root's caps X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8fe734bb8b95b141fe4fb261bbdf574106fa631;p=thirdparty%2Ffreeradius-server.git Should use euid not uid as changing from root removes root's caps --- diff --git a/src/modules/rlm_icmp/rlm_icmp.c b/src/modules/rlm_icmp/rlm_icmp.c index 7e74ee89827..0ab80780a4b 100644 --- a/src/modules/rlm_icmp/rlm_icmp.c +++ b/src/modules/rlm_icmp/rlm_icmp.c @@ -65,7 +65,7 @@ typedef struct { bool replied; //!< do we have a reply? fr_value_box_t *ip; //!< the IP we're pinging uint32_t counter; //!< for pinging the same IP multiple times - request_t *request; //!< so it can be resumed when we get the echo reply + request_t *request; //!< so it can be resumed when we get the echo reply } rlm_icmp_echo_t; /** Wrapper around the module thread stuct for individual xlats @@ -535,12 +535,12 @@ static int mod_bootstrap(void *instance, CONF_SECTION *conf) #ifdef __linux__ # ifndef HAVE_CAPABILITY_H - if ((getuid() != 0)) PWARN("Server not built with cap interface, opening raw sockets will likely fail"); + if ((geteuid() != 0)) PWARN("Server not built with cap interface, opening raw sockets will likely fail"); # else /* * Request RAW capabilities on Linux. On other systems this does nothing. */ - if ((fr_cap_enable(CAP_NET_RAW, CAP_EFFECTIVE) < 0) && (getuid() != 0)) { + if ((fr_cap_enable(CAP_NET_RAW, CAP_EFFECTIVE) < 0) && (geteuid() != 0)) { PERROR("Failed setting capabilities required to open ICMP socket"); return -1; }