]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG: config: external-check command validation is checking for incorrect arguments.
authorBen Cabot <ben@loadbalancer.org>
Wed, 16 Sep 2015 11:07:51 +0000 (12:07 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 2 Oct 2015 21:11:49 +0000 (23:11 +0200)
When using the external-check command option HAProxy was failing to
start with a fatal error "'external-check' cannot handle unexpected
argument". When looking at the code it was looking for an incorrect
argument. Also correcting an Alert message text as spotted by by
PiBa-NL.

src/cfgparse.c

index bc7cd9468a8361b9d72a070f90c79f10fd6de928..610e165bab52b8c0629033d7183db3bb17573283 100644 (file)
@@ -3413,9 +3413,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                 }
 
                if (!strcmp(args[1], "command")) {
-                       if (alertif_too_many_args(1, file, linenum, args, &err_code))
+                       if (alertif_too_many_args(2, file, linenum, args, &err_code))
                                goto out;
-                       if (*(args[1]) == 0) {
+                       if (*(args[2]) == 0) {
                                Alert("parsing [%s:%d] : missing argument after '%s'.\n",
                                      file, linenum, args[1]);
                                err_code |= ERR_ALERT | ERR_FATAL;
@@ -3425,9 +3425,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        curproxy->check_command = strdup(args[2]);
                }
                else if (!strcmp(args[1], "path")) {
-                       if (alertif_too_many_args(1, file, linenum, args, &err_code))
+                       if (alertif_too_many_args(2, file, linenum, args, &err_code))
                                goto out;
-                       if (*(args[1]) == 0) {
+                       if (*(args[2]) == 0) {
                                Alert("parsing [%s:%d] : missing argument after '%s'.\n",
                                      file, linenum, args[1]);
                                err_code |= ERR_ALERT | ERR_FATAL;
@@ -7472,7 +7472,7 @@ int check_config_validity()
                                clear = 1;
                        }
                        if (curproxy->check_command[0] != '/' && !curproxy->check_path) {
-                               Alert("Proxy '%s': '%s' does not have a leading '/' and 'external-command path' is not set.\n",
+                               Alert("Proxy '%s': '%s' does not have a leading '/' and 'external-check path' is not set.\n",
                                      curproxy->id, "external-check command");
                                cfgerr++;
                        }