Roberto E. Vargas Caballero
a570a80ed1
su: Fix running it without arguments
...
The commit 8f5a0c3
introduced a regression and the logic
to control the number of arguments was broken after it,
giving an error when su was executed without parameters.
2024-03-07 22:35:31 +01:00
neeshy
4cd0b14380
su: don't set $PATH
...
Just /bin is too restrictive, and login shells set the path anyway via
the default profile. Also, carrying the path over for non-login shells
conforms to the behavior of util-linux's su.
2024-03-06 10:12:49 +01:00
neeshy
e9bcdcc341
su: check $SHELL for validity
...
If $SHELL isn't defined in the environment, the call to execve will
fail when -p is specified. Fallback to the user's login shell if $SHELL
is invalid.
2024-03-06 10:11:29 +01:00
neeshy
cf9e26d7fa
su: fix setting argv0
...
argv0 was being set to the user's login shell even when -p was
specified. Only populate newargv once the shell is properly determined.
2024-03-06 10:11:23 +01:00
neeshy
8f5a0c3236
su: simplify logic
...
Inline dologin, and simplify common code
2024-03-06 10:11:07 +01:00
Hiltjo Posthuma
7e394bd70f
code-style: cleanup
...
- move main() at the bottom.
- put global variables at the top.
- improve usage() lines (consistent with man page).
2015-02-06 15:16:24 +00:00
sin
6f7f387352
Stop using EXIT_{SUCCESS,FAILURE}
2014-10-02 23:47:39 +01:00
Wolfgang Corcoran-Mathe
9859943d47
Remove unnecessary newline output from su
2014-08-25 15:37:13 +01:00
Hiltjo Posthuma
291aedb875
code consistency fixes
2014-07-09 15:08:01 +01:00
Hiltjo Posthuma
96f15f1d04
errno: check only errno if return value was NULL
2014-07-09 15:07:34 +01:00
sin
86060b535c
Fix includes across all tools
2014-06-30 19:04:47 +01:00
sin
5980da83e7
Add passwd manpage
2014-06-09 16:44:47 +01:00
sin
d745889805
Fix pw_check() semantics and style - it is now similar to pw_copy()
2014-06-09 13:05:24 +01:00
sin
12083d49e5
Port su(1) to use pw_check()
2014-06-09 11:13:07 +01:00
sin
9716ca2c7a
OK we had our fun, now remove the randquotes from su.c
2014-06-05 17:43:11 +01:00
sin
2ea51e8cd8
Print errors on the next line
2014-06-05 17:20:58 +01:00
sin
d3709f91a2
the shell field in passwd is optional - fallback to /bin/sh
2014-06-05 12:18:27 +01:00
FRIGN
5a2f3c85b7
Bring back some C89/C90 elements
...
dmesg: don't use VLAs
getty, su: no need to use compound literals
2014-06-05 11:33:34 +01:00
sin
8441c95a2f
define -D_XOPEN_SOURCE in config.mk
...
Remove from su.c and login.c
2014-06-04 15:16:24 +01:00
sin
916b7fed1e
Set TERM to linux if needed for su and login
2014-06-03 18:21:05 +01:00
sin
da215823a3
Inform the user if exec*() fails
2014-06-03 12:34:39 +01:00
sin
b8dbf05ce7
Simplify dologin() in su(1)
...
Exec the user's shell with -l to fake a login.
2014-06-03 12:28:50 +01:00
sin
2f10d16b9f
Remove explicit_bzero() calls
2014-06-03 12:18:19 +01:00
sin
bd4b6f4e47
Add /etc/passwd support to su(1)
2014-06-03 12:15:24 +01:00
sin
3046b513fc
use lowercase for errors
2014-06-02 17:15:41 +01:00
sin
d068541779
Not all password entries start with '$'
...
Respect old DES :)
2014-06-02 16:51:11 +01:00
sin
6f7995b65a
Consistent error reporting
2014-06-02 16:20:02 +01:00
sin
e992efc8fb
Remember to #define _XOPEN_SOURCE for crypt()
2014-06-02 16:19:52 +01:00
Jakob Kramer
b6e4a367e2
su: zero out encrypted passwords
2014-04-30 13:25:33 +01:00
sin
5b9ea69b08
Sweep through code and replace malloc() with emalloc() etc.
2014-04-30 13:12:17 +01:00
sin
24d5c07d29
Use explicit_bzero() in su
2014-04-30 12:30:15 +01:00
sin
8f4c0f2a8e
Add random replies for failed password attempts in su(1)
2014-04-22 16:40:16 +01:00
sin
505bb70e89
Fix char **argv to char *argv[]
2014-04-18 11:52:31 +01:00
sin
5c8cf6925d
Add su manpage and fix su usage line
2014-04-13 17:23:26 +01:00
sin
634e77a1a5
Simply use eprintf() instead of enprintf()
2014-02-27 14:59:34 +00:00
Hiltjo Posthuma
96af28da60
su: set default 'root', fixes a uninitialised variable warning
...
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-02-14 14:11:28 +00:00
sin
5f3c183b85
Setup a sane PATH across su(1)
...
Also added a config.h for the basic configuration of ubase.
2013-10-19 19:11:14 +01:00
Jakob Kramer
ab37391837
fix SHELL being set to the usr's home directory
2013-10-18 21:46:03 +01:00
sin
bfb4b38cff
If we are preserving the environment use SHELL instead of pw->pw_shell
2013-10-18 16:23:22 +01:00
sin
acb9ae197e
Implement -p for su(1)
2013-10-18 14:26:40 +01:00
sin
7e59506b4b
Set SHELL environment variable by default
...
If target user is not root also set USER and LOGNAME.
2013-10-18 11:22:31 +01:00
sin
784c6a5acf
Implement -l support for su(1)
2013-10-18 11:15:31 +01:00
sin
f7bfe68a9e
We use environ so declare it
2013-10-18 11:15:31 +01:00
sin
86566f4ceb
Only try to ask for a password and check if uid is != 0
2013-10-18 10:26:48 +01:00
sin
56ce9e8bff
Some stylistic changes to su(1)
...
Also set errno to zero before calling getspnam().
2013-10-18 10:26:40 +01:00
sin
f7fdd58972
Use a compound literal instead of malloc() in su(1)
2013-10-18 10:08:27 +01:00
sin
ff2e11638f
Add initial su(1)
2013-10-17 23:04:20 +01:00