diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-01-12 23:19:11 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-01-12 23:19:11 +0100 |
commit | d162a7b978a98b910e410dc10a40d5de12db0419 (patch) | |
tree | 63271dbbe027b26692befba9944d0554b00968d0 /libbb | |
parent | 004cefa918483513a9eca13e7701c74dff160e95 (diff) | |
download | busybox-w32-d162a7b978a98b910e410dc10a40d5de12db0419.tar.gz busybox-w32-d162a7b978a98b910e410dc10a40d5de12db0419.tar.bz2 busybox-w32-d162a7b978a98b910e410dc10a40d5de12db0419.zip |
sulogin: increase util-linux compatibility
Change to root's HOME. Set some envvars. Steal ctty if necessary and possible.
function old new delta
sulogin_main 240 340 +100
setup_environment 225 233 +8
su_main 479 474 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 108/-5) Total: 103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/setup_environment.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index f8de44967..df2983958 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c | |||
@@ -54,15 +54,15 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass | |||
54 | xsetenv("TERM", term); | 54 | xsetenv("TERM", term); |
55 | xsetenv("PATH", (pw->pw_uid ? bb_default_path : bb_default_root_path)); | 55 | xsetenv("PATH", (pw->pw_uid ? bb_default_path : bb_default_root_path)); |
56 | goto shortcut; | 56 | goto shortcut; |
57 | // No, gcc (4.2.1) is not clever enougn to do it itself. | 57 | // No, gcc (4.2.1) is not clever enough to do it itself. |
58 | //xsetenv("USER", pw->pw_name); | 58 | //xsetenv("USER", pw->pw_name); |
59 | //xsetenv("LOGNAME", pw->pw_name); | 59 | //xsetenv("LOGNAME", pw->pw_name); |
60 | //xsetenv("HOME", pw->pw_dir); | 60 | //xsetenv("HOME", pw->pw_dir); |
61 | //xsetenv("SHELL", shell); | 61 | //xsetenv("SHELL", shell); |
62 | } else if (flags & SETUP_ENV_CHANGEENV) { | 62 | } else if (flags & SETUP_ENV_CHANGEENV) { |
63 | /* Set HOME, SHELL, and if not becoming a super-user, | 63 | /* Set HOME, SHELL, and if not becoming a super-user |
64 | * USER and LOGNAME. */ | 64 | * or if SETUP_ENV_CHANGEENV_LOGNAME, USER and LOGNAME. */ |
65 | if (pw->pw_uid) { | 65 | if ((flags & SETUP_ENV_CHANGEENV_LOGNAME) || pw->pw_uid != 0) { |
66 | shortcut: | 66 | shortcut: |
67 | xsetenv("USER", pw->pw_name); | 67 | xsetenv("USER", pw->pw_name); |
68 | xsetenv("LOGNAME", pw->pw_name); | 68 | xsetenv("LOGNAME", pw->pw_name); |