]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] inform the user when root is expected but not set
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Feb 2009 17:02:48 +0000 (18:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Feb 2009 17:02:48 +0000 (18:02 +0100)
When a plain user runs haproxy as non-root but some options require
root, let's inform him.

src/haproxy.c

index c6c102de609b505a5f306fa9e5e0ddeb3964d0c9..dbb074d29843f35dc9c105fe611b8dff65b599bb 100644 (file)
@@ -1052,11 +1052,19 @@ int main(int argc, char **argv)
 
        if ((global.last_checks & LSTCHK_NETADM) && global.uid) {
                Alert("[%s.main()] Some configuration options require full privileges, so global.uid cannot be changed.\n"
-                     "", argv[0], global.gid);
+                     "", argv[0]);
                protocol_unbind_all();
                exit(1);
        }
 
+       /* If the user is not root, we'll still let him try the configuration
+        * but we inform him that unexpected behaviour may occur.
+        */
+       if ((global.last_checks & LSTCHK_NETADM) && getuid())
+               Warning("[%s.main()] Some options which require full privileges"
+                       " might not work well.\n"
+                       "", argv[0]);
+
        /* chroot if needed */
        if (global.chroot != NULL) {
                if (chroot(global.chroot) == -1) {