| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Introduce the new applet sush. It's like su but it permits additional
arguments on the command line which are passed to the elevated shell.
Adds 144-168 bytes. (O bytes if it's not enabled.)
|
|
|
|
|
|
|
|
|
|
| |
Previously the command passed to the elevated shell was placed
in literal double quotes on the command line. Instead it should
be subject to full quoting by the quote_arg() function.
Tweak command line processing.
Costs 24-32 bytes.
|
|
|
|
|
|
|
|
|
| |
Only a handful of functions are used from shell32.dll, userenv.dll
and psapi.dll. Mostly these functions are in out of the way places.
By loading the functions only when required we can avoid the startup
cost of linking the three DLLs in the common case that they aren't
needed.
|
|
|
|
|
|
|
|
|
| |
There are now two places where slashes are converted to backslashes
throughout a string so it makes sense to create a function to do
this.
To avoid confusion rename convert_slashes() to bs_to_slash() and
call the new function slash_to_bs().
|
|
|
|
|
|
| |
If the current directory is in a drive mapped to a network share
we may not be able to access it once we have elevated privileges.
Avoid this by canonicalising the path before calling ShellExecuteEx().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Formalise the use of 0 as the uid of a process running with elevated
privileges:
- Rewrite getuid(2) to return DEFAULT_UID by default and 0 if the
process has elevated privileges.
- geteuid(2) and the corresponding functions for groups are aliases
for getuid(2).
- Change root's home directory to be whatever GetSystemDirectory()
returns, probably C:/Windows/System32 in most cases.
- Remove the special handling of geteuid(2) in the line editing code.
With these changes the shell started by 'su' is a lot more like a
*nix root shell.
|
| |
|
|
|
|
|
|
| |
ShellExecuteEx() requires backslashes as the file separator if
the binary to be executed has a UNC path. Convert separators
unconditionally.
|
|
|
|
|
|
| |
I've been a bit lax about ensuring the --busybox flag is passed
in command lines. It's needed to avoid problems if the binary
is called something like sh.exe.
|
|
|
|
|
|
|
|
| |
When busybox-w32 is installed in C:/Windows/System32 su doesn't
run in the same directory as its parent as intended.
Work around this by adding a flag to the shell to set the working
directory.
|
|
Use the undocumented 'runas' verb in a call to ShellExecuteEx()
to run a shell with elevated privileges.
Because of the way ShellExecuteEx() works this:
- requires that you acknowledge a User Account Control prompt (if
you're an Administrator);
- requires that you enter an Administrator's password (if you aren't
an Administrator);
- creates a separate console window for the privileged shell.
Variables from the parent shell aren't passed to its privileged child,
only variables from the environment.
It's possible to specify a command to run when the shell starts.
This can be used to pass shell variables:
su -c "HELLO='hello world'; GOODBYE=$GOODBYE"
Or do fancy things like:
su -c "ls -l; read -p 'Hit return to exit: '; exit"
It's probably best to put double quotes around the command and use
single quotes inside it. Apparently ShellExecuteEx() requires
double quotes to be entered in triplicate:
su -c 'HELLO="""hello world"""'
|