summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-11-04 12:06:13 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-11-04 12:06:13 +0100
commit22c0098be76a59ff95da58a4cf49e387c81081e0 (patch)
tree79f985ff321f1665b2df7b1756d51553d6612cc0
parent2bc07f98daabd3778b79b1c7eaf9f7e9d840d0ce (diff)
owfd: dhcp: print warning if not running as euid=0
DHCP and interface-setup requires CAP_NET_ADMIN. As we don't want to deal with libcap and capability-setup, we simply let the caller take care of it. To avoid mis-use, we print a warning for euid!=0, in case users run it from the command-line (debugging, etc). Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/dhcp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dhcp.c b/src/dhcp.c
index f564569..7eb93e6 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -118,6 +118,9 @@ static int owfd_dhcp_setup(struct owfd_dhcp *dhcp)
sigset_t mask;
struct sigaction sig;
+ if (geteuid())
+ log_warning("not running as uid=0, dhcp might not work");
+
dhcp->ifindex = if_name_to_index(dhcp->config.interface);
if (dhcp->ifindex < 0) {
r = -EINVAL;