aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-06-05 11:30:39 +0100
committerRon Yorston <rmy@pobox.com>2023-06-05 11:30:39 +0100
commit6fcf8ade94f6cb05a57562abb6a5491a39146682 (patch)
treef4f4062fc3bf8dc36bfcf4f13c97b63f8fac26ab
parent374b4e872a8981ec01707812d8822c9fb9a52d20 (diff)
downloadbusybox-w32-6fcf8ade94f6cb05a57562abb6a5491a39146682.tar.gz
busybox-w32-6fcf8ade94f6cb05a57562abb6a5491a39146682.tar.bz2
busybox-w32-6fcf8ade94f6cb05a57562abb6a5491a39146682.zip
win32: remove special treatment of USERNAME
Commit 255ebaf535 (drop: adjust environment on privilege change) added USERNAME to the variables subject to special treatment when the shell starts or privilege is dropped. It's been pointed out this may not be appropriate for a variable that's Windows-specific. Remove the special treatment of USERNAME. Saves 40-48 bytes. (GitHub issue #300)
-rw-r--r--miscutils/drop.c1
-rw-r--r--shell/ash.c1
2 files changed, 0 insertions, 2 deletions
diff --git a/miscutils/drop.c b/miscutils/drop.c
index 6b8e0f183..6903254c3 100644
--- a/miscutils/drop.c
+++ b/miscutils/drop.c
@@ -188,7 +188,6 @@ int drop_main(int argc, char **argv)
188 si.dwFlags = STARTF_USESTDHANDLES; 188 si.dwFlags = STARTF_USESTDHANDLES;
189 189
190 setenv_name("USER"); 190 setenv_name("USER");
191 setenv_name("USERNAME");
192 setenv_name("LOGNAME"); 191 setenv_name("LOGNAME");
193 192
194 if (!CreateProcessAsUserA(token, exe, cmd, NULL, NULL, TRUE, 193 if (!CreateProcessAsUserA(token, exe, cmd, NULL, NULL, TRUE,
diff --git a/shell/ash.c b/shell/ash.c
index 721204c61..f7e00ee0f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -15854,7 +15854,6 @@ init(void)
15854 pw = getpwuid(getuid()); 15854 pw = getpwuid(getuid());
15855 if (pw) { 15855 if (pw) {
15856 xsetenv_if_unset("USER", pw->pw_name); 15856 xsetenv_if_unset("USER", pw->pw_name);
15857 xsetenv_if_unset("USERNAME", pw->pw_name);
15858 xsetenv_if_unset("LOGNAME", pw->pw_name); 15857 xsetenv_if_unset("LOGNAME", pw->pw_name);
15859 xsetenv_if_unset("HOME", pw->pw_dir); 15858 xsetenv_if_unset("HOME", pw->pw_dir);
15860 } 15859 }