Bug 3379 - Config parser only allows SetEnv once
Summary: Config parser only allows SetEnv once
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 8.8p1
Hardware: All All
: P5 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-11 10:25 AEDT by Florian Streibelt
Modified: 2022-01-11 11:38 AEDT (History)
1 user (show)

See Also:


Attachments
working proof of concept patch (1.22 KB, patch)
2022-01-11 11:38 AEDT, Florian Streibelt
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Streibelt 2022-01-11 10:25:50 AEDT
When using SetEnv in the .ssh/config it can only be used once.

Every additional entry will be ignored.

looking at readconf.c:1758 I see that options->num_setenv is being checked to be != 0 and then continuing.

This leads to these configurations NOT to work as intended:

SetEnv TZ=UTC
SetEnv TERM=xterm

Here only TZ will be set.

Also when SetEnv is being used globally, it cannot be used later inside a Host definition to specify additional variables or change them.
Comment 1 Florian Streibelt 2022-01-11 11:38:19 AEDT
Created attachment 3564 [details]
working proof of concept patch

Just a quick and dirty proof of concept, that allows overwriting the environment in a host definition and also using multiple SetEnv entries to set different env vars.