aboutsummaryrefslogtreecommitdiff
path: root/miscutils/drop.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* drop: adjust environment on privilege changeRon Yorston2023-03-271-0/+16
| | | | | | | | | | | | | | | | | | | | | | | Some environment variables are subject to special treatment: USER, LOGNAME, HOME and SHELL are initialised when the shell starts if they don't already have a value. Some adjustments are necessary when changing privilege level: - USERNAME is added to the set of variables subject to special treatment. Unlike the others this is normally set on Windows. - The special variables are now also updated on shell start up if the current process is running with elevated privileges. This is necessary so USER, USERNAME and LOGNAME have the correct value. - USER, USERNAME and LOGNAME are set to the name of the unprivileged user when elevated privileges are dropped, though not if they've been changed from the expected value of "root". Costs 160-208 bytes. (GitHub issue #300)
* drop: cdrop and pdrop don't need shellRon Yorston2023-03-231-8/+18
| | | | | | | | | The cdrop and pdrop variants don't require the binary to include a shell. Removing this dependency makes it possible to build cdrop/pdrop as a much smaller standalone binaries. Update the default configuration to build a standalone make binary to exclude drop/cdrop/pdrop.
* drop: search PATH for cmd.exe/PowerShellRon Yorston2023-03-231-27/+25
| | | | | | | | | Rather than hardcode the paths of cmd.exe and PowerShell find them by searching PATH. Saves 104-128 bytes. (GitHub issue #240)
* drop: add cdrop and pdrop aliasesRon Yorston2023-03-191-3/+48
| | | | | | | | | | | | | | | | Add cdrop and pdrop applets as aliases for drop. If a command isn't specified these use cmd.exe and PowerShell instead of the BusyBox shell. This makes it possible to choose the default shell used for SSH connections even in older versions of OpenSSH that don't support the DefaultShellArguments registry key. Note that to get cmd.exe to run a command rather than an interactive shell it's necessary to set the DefaultShellCommandOption registry key to '/c'. Costs 248-272 bytes.
* runuser,drop: drop runuser, tweak dropRon Yorston2023-03-191-0/+130
Remove the runuser applet, leaving only drop. Move drop from util-linux to miscutils. A command of the form 'drop -c command' causes the BusyBox shell to be used, just like 'drop' without any arguments. A simple OpenSSH configuration with 'drop.exe' as DefaultShell and no DefaultShellArguments now works both for interactive login and to run a command. This is useful for older versions of OpenSSH which don't support DefaultShellArguments. Saves 208-232 bytes.