From: Vincent Bernat Date: Thu, 20 Feb 2014 20:37:22 +0000 (+0100) Subject: lldpcli: root is privileged X-Git-Tag: 0.7.8~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91f424d16491c6628a39638c0dea5a7cc2251edf;p=thirdparty%2Flldpd.git 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 --- 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*