Ciro Iriarte created GUACAMOLE-2308:
---------------------------------------
Summary: Kubernetes: "scrollback" and "func-keys-and-keypad"
connection parameters are transposed
Key: GUACAMOLE-2308
URL: https://issues.apache.org/jira/browse/GUACAMOLE-2308
Project: Guacamole
Issue Type: Bug
Components: guacamole-server
Reporter: Ciro Iriarte
h2. Summary
In {{src/protocols/kubernetes/settings.c}} the {{GUAC_KUBERNETES_CLIENT_ARGS[]}}
name array and the {{KUBERNETES_ARGS_IDX}} enum disagree on the order of
{{scrollback}} and {{func-keys-and-keypad}}. guacd announces its parameters
positionally (the client sends values in the announced array order) and the
server
then parses each value by its enum index, so the two parameters are read from
each
other's argv slots: a connection's {{scrollback}} value is applied to
{{func-keys-and-keypad}} and vice-versa. Kubernetes is the only affected
terminal
protocol — SSH and telnet order the two identically in both structures.
h2. Details
Array order ({{GUAC_KUBERNETES_CLIENT_ARGS}}):
{noformat}
... "backspace", "scrollback", "func-keys-and-keypad", "clipboard-buffer-size",
...
{noformat}
Enum order ({{KUBERNETES_ARGS_IDX}}):
{noformat}
... IDX_BACKSPACE, IDX_FUNC_KEYS_AND_KEYPAD, IDX_SCROLLBACK, ...
{noformat}
The array places {{scrollback}} immediately after {{backspace}} and
{{func-keys-and-keypad}} after that; the enum declares them in the opposite
order.
Consequently {{IDX_SCROLLBACK}} indexes the argv slot the client populated for
{{func-keys-and-keypad}}, and {{IDX_FUNC_KEYS_AND_KEYPAD}} indexes the
{{scrollback}}
slot. The parsing calls in the same file:
{noformat}
guac_user_parse_args_int(..., IDX_SCROLLBACK,
GUAC_TERMINAL_DEFAULT_MAX_SCROLLBACK); // reads the func-keys value
guac_user_parse_args_string(..., IDX_FUNC_KEYS_AND_KEYPAD, "");
// reads the scrollback value
{noformat}
h2. Impact
* Setting {{scrollback}} (an integer) does not affect scrollback; its numeric
value is
interpreted as the {{func-keys-and-keypad}} mode string.
* Setting {{func-keys-and-keypad}} (e.g. {{VT100}}) is instead parsed as
{{scrollback}} via {{atoi}}, typically yielding 0/garbage and silently
mis-sizing or
disabling the scrollback buffer.
* Both failures are silent — no error is raised; the values simply land in the
wrong
setting.
h2. Comparison with SSH / telnet (correct)
The SSH and telnet arrays list {{"func-keys-and-keypad"}} then {{"scrollback"}},
matching their enums ({{IDX_FUNC_KEYS_AND_KEYPAD}} then {{IDX_SCROLLBACK}}).
Only the
Kubernetes array is out of order, which is consistent with a copy/paste
ordering slip.
h2. Fix
Reorder the two entries in {{GUAC_KUBERNETES_CLIENT_ARGS[]}} so
{{"func-keys-and-keypad"}} precedes {{"scrollback"}}, matching the enum (and
SSH /
telnet). One-line swap; the enum does not need to change. Happy to open a PR.
h2. Version
Verified present in 1.6.0 and in current apache/main (checked against the raw
file on
main at time of filing). Pre-existing and unrelated to any local changes.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)