]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
lldpctl: just require access to the socket for actions, not root priv
authorVincent Bernat <bernat@luffy.cx>
Fri, 31 Aug 2012 06:01:57 +0000 (08:01 +0200)
committerVincent Bernat <bernat@luffy.cx>
Fri, 31 Aug 2012 06:01:57 +0000 (08:01 +0200)
Instead of checking for root, we check that we don't have additional
privileges due to setuid or setgid binary.

src/client/lldpctl.c

index a96057fc2bb57fa1368c5c241dbbdeaee00ce3fc..e848d05a1c00a917fbcb554a731a5ce55b5f1097 100644 (file)
@@ -153,8 +153,9 @@ main(int argc, char *argv[])
 
        log_init(debug, __progname);
 
-       if ((action != 0) && (getuid() != 0)) {
-               fatalx("mere mortals may not do that, 'root' privileges are required.");
+       if ((action != 0) &&
+           (getuid() != geteuid() || getgid() != getegid())) {
+               fatalx("mere mortals may not do that, admin privileges are required.");
        }
 
        conn = lldpctl_new(NULL, NULL, NULL);