Inheritance of PATH env var

Elliot Bräck Elliot.Braeck at simcorp.com
Wed Sep 11 19:34:24 AWST 2024


Hi there,

When running dropbear with the flag -e ("Pass on server process environment to child process"), I noticed that the PATH variable still was not inherited.

This is due to PATH unconditionally being set inside of `svr-chansession.c`:

```c
        if (getuid() == 0) {
                addnewvar("PATH", DEFAULT_ROOT_PATH);
        } else {
                addnewvar("PATH", DEFAULT_PATH);
        }
```

Is this behaviour intentional?
If not, what should the behaviour be? That if `-e` is set (svr_opts.pass_on_env), PATH should only be set to the default value if it does not already have a value from the environment?
If it is, would a patch adding a non-default compile-time flag that changes this behaviour be accepted?

My use-case is that I would like to run a dropbear server which inherits the PATH environment variable from the executing environment, but the value of this environment variable is not known at compile time.

Thankful for your input,

ELLIOT BRÄCK
Software Engineer
Investment, OTC Core, Instruments Modelling

SimCorp A/S
Weidekampsgade 16, 2300 Copenhagen S, Denmark
www.simcorp.com
Company reg. no. 15505281


This message, and any associated files, is intended only for the use of the individual or entity to which it is addressed and may contain information that is confidential, privileged, subject to copyright or constitute a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying, or distribution of this message or files associated with this message is strictly prohibited. If you have received this message in error, please notify us immediately or forward this message immediately to info at SimCorp.com...

Thank You
________________________________


More information about the Dropbear mailing list