mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
BUG/MEDIUM: stick-table: Properly handle "show table" with a data type argument
Since the commit 1b8e68e8 ("MEDIUM: stick-table: Stop handling stick-tables as proxies."), the target field into the table context of the CLI applet was not anymore a pointer to a proxy. It was replaced by a pointer to a stktable. But, some parts of the code was not updated accordingly. the function table_prepare_data_request() still tries to cast it to a pointer to a proxy. The result is totally undefined. With a bit of luck, when the "show table" command is used with a data type, we failed to find a table and the error "Data type not stored in this table" is returned. But crashes may also be experienced. This patch fixes the issue #262. It must be backported to 2.0.
This commit is contained in:
parent
a46b142e88
commit
4e9a83349a
@ -3556,8 +3556,7 @@ static int table_prepare_data_request(struct appctx *appctx, char **args)
|
|||||||
if (appctx->ctx.table.data_type < 0)
|
if (appctx->ctx.table.data_type < 0)
|
||||||
return cli_err(appctx, "Unknown data type\n");
|
return cli_err(appctx, "Unknown data type\n");
|
||||||
|
|
||||||
if (!((struct proxy *)appctx->ctx.table.target)->table ||
|
if (!((struct stktable *)appctx->ctx.table.target)->data_ofs[appctx->ctx.table.data_type])
|
||||||
!((struct proxy *)appctx->ctx.table.target)->table->data_ofs[appctx->ctx.table.data_type])
|
|
||||||
return cli_err(appctx, "Data type not stored in this table\n");
|
return cli_err(appctx, "Data type not stored in this table\n");
|
||||||
|
|
||||||
appctx->ctx.table.data_op = get_std_op(args[4]);
|
appctx->ctx.table.data_op = get_std_op(args[4]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user