mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 09:07:02 +02:00
[BUG] inform the user when root is expected but not set
When a plain user runs haproxy as non-root but some options require root, let's inform him.
This commit is contained in:
parent
5e6e204d1c
commit
4e30ed73f4
@ -1052,11 +1052,19 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((global.last_checks & LSTCHK_NETADM) && global.uid) {
|
if ((global.last_checks & LSTCHK_NETADM) && global.uid) {
|
||||||
Alert("[%s.main()] Some configuration options require full privileges, so global.uid cannot be changed.\n"
|
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();
|
protocol_unbind_all();
|
||||||
exit(1);
|
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 */
|
/* chroot if needed */
|
||||||
if (global.chroot != NULL) {
|
if (global.chroot != NULL) {
|
||||||
if (chroot(global.chroot) == -1) {
|
if (chroot(global.chroot) == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user