From 91f424d16491c6628a39638c0dea5a7cc2251edf Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 20 Feb 2014 21:37:22 +0100 Subject: [PATCH] lldpcli: root is privileged For some reason, this bug was not catched before. It was expected that `lldpcli` can be installed as suid `_lldpd` to give user read access to the neighbor information. However, to avoid write access, we checked if the user was privileged by checking equality of effective and real user uid. However, even for root, they don't have to match. Maybe they matched in the past? Therefore, directly check for UID == 0 too. This should fix #56 --- src/client/lldpcli.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/lldpcli.c b/src/client/lldpcli.c index 7a82c724..0049a87f 100644 --- a/src/client/lldpcli.c +++ b/src/client/lldpcli.c @@ -80,7 +80,8 @@ usage() static int is_privileged() { - return (!(getuid() != geteuid() || getgid() != getegid())); + return (getuid() == geteuid() && getgid() == getegid()) || + getuid() == 0; } static char* -- 2.47.2