aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-17 13:37:51 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-17 13:37:51 +0200
commitfb8348b36457e5287646e11c1ec45365c112fd3c (patch)
tree9f9975a3fda29f271d33eb8d31299ce1afa6301e /networking
parent048491fbdccc35edd481218baeedb31c5253aa12 (diff)
downloadbusybox-fb8348b36457e5287646e11c1ec45365c112fd3c.tar.gz
telnet: "-a" + "-l USER" should respect USER
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/telnet.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/networking/telnet.c b/networking/telnet.c
index e1c259579..1f8a44466 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -44,7 +44,7 @@
//config: Setting this option will forward the USER environment variable to the
//config: remote host you are connecting to. This is useful when you need to
//config: log into a machine without telling the username (autologin). This
-//config: option enables '-a' and '-l USER' arguments.
+//config: option enables '-a' and '-l USER' options.
//config:
//config:config FEATURE_TELNET_WIDTH
//config: bool "Enable window size autodetection"
@@ -643,8 +643,10 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
}
#if ENABLE_FEATURE_TELNET_AUTOLOGIN
- if (1 & getopt32(argv, "al:", &G.autologin))
+ if (1 == getopt32(argv, "al:", &G.autologin)) {
+ /* Only -a without -l USER picks $USER from envvar */
G.autologin = getenv("USER");
+ }
argv += optind;
#else
argv++;