]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cfgparse: warn when gid parameter is not a number
authorBaptiste Assmann <bedis9@gmail.com>
Fri, 11 Mar 2016 16:21:15 +0000 (17:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 13 Mar 2016 06:46:31 +0000 (07:46 +0100)
Currently, no warning are emitted when the gid 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 1a2c1ea045dddcd3e55b5609416e9101eb11bf24..92f3611b4e687e753c2e4254e713a981073af7f8 100644 (file)
@@ -1095,7 +1095,11 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }
-               global.gid = atol(args[1]);
+               if (strl2irc(args[1], strlen(args[1]), &global.gid) != 0) {
+                       Warning("parsing [%s:%d] :  gid: string '%s' is not a number.\n   | You might want to use the 'group' parameter to use a system group name.\n", file, linenum, args[1]);
+                       err_code |= ERR_WARN;
+                       goto out;
+               }
        }
        else if (!strcmp(args[0], "external-check")) {
                if (alertif_too_many_args(0, file, linenum, args, &err_code))