]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: warn when uid parameter is not a number
authorBaptiste Assmann <bedis9@gmail.com>
Fri, 11 Mar 2016 16:10:04 +0000 (17:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 13 Mar 2016 06:45:41 +0000 (07:45 +0100)
Currently, no warning are emitted when the uid is not a number.
Purpose of this warning is to let admins know they their configuration
won't be applied as expected.

src/cfgparse.c

index c55a56161fc31d2a11176ebb08271959734770dc..1a2c1ea045dddcd3e55b5609416e9101eb11bf24 100644 (file)
@@ -1075,7 +1075,12 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }
-               global.uid = atol(args[1]);
+               if (strl2irc(args[1], strlen(args[1]), &global.uid) != 0) {
+                       Warning("parsing [%s:%d] :  uid: string '%s' is not a number.\n   | You might want to use the 'user' parameter to use a system user name.\n", file, linenum, args[1]);
+                       err_code |= ERR_WARN;
+                       goto out;
+               }
+
        }
        else if (!strcmp(args[0], "gid")) {
                if (alertif_too_many_args(1, file, linenum, args, &err_code))