]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: do not perform an invalid action on "set server check-port"
authorWilly Tarreau <w@1wt.eu>
Sun, 5 Nov 2017 08:58:50 +0000 (09:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 5 Nov 2017 09:13:37 +0000 (10:13 +0100)
The "set server <srv> check-port" CLI handler forgot to return after
detecting an error on the port number, and still proceeds with the action.
This needs to be backported to 1.7.

src/server.c

index c96b096e2b7fbc5ee0517573c0dbfb06d4c8609b..3265680417d1a91eeacaf846eea93cf4dce088f7 100644 (file)
@@ -4155,11 +4155,15 @@ static int cli_parse_set_server(char **args, struct appctx *appctx, void *privat
                        appctx->ctx.cli.severity = LOG_ERR;
                        appctx->ctx.cli.msg = "'set server <srv> check-port' expects an integer as argument.\n";
                        appctx->st0 = CLI_ST_PRINT;
+                       SPIN_UNLOCK(SERVER_LOCK, &sv->lock);
+                       return 1;
                }
                if ((i < 0) || (i > 65535)) {
                        appctx->ctx.cli.severity = LOG_ERR;
                        appctx->ctx.cli.msg = "provided port is not valid.\n";
                        appctx->st0 = CLI_ST_PRINT;
+                       SPIN_UNLOCK(SERVER_LOCK, &sv->lock);
+                       return 1;
                }
                /* prevent the update of port to 0 if MAPPORTS are in use */
                if ((sv->flags & SRV_F_MAPPORTS) && (i == 0)) {