[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] telnet: busybox telnet autologin with -a -l user option picks incorrect username
From: Denys Vlasenko <vda.linux () googlemail ! com>
Date: 2017-08-17 12:03:07
Message-ID: CAK1hOcMKL5YDzqQm-aiP95eE3RE3UygXo00jnQt4isahoMS3sg () mail ! gmail ! com
[Download RAW message or body]
On Thu, Aug 17, 2017 at 1:56 PM, Tito <farmatito@tiscali.it> wrote:
> On 08/17/2017 01:14 PM, Athira Rajeev wrote:
>>> On 17-Aug-2017, at 4:21 PM, Denys Vlasenko <vda.linux@googlemail.com>
>>> wrote:
>>>
>>> On Thu, Aug 17, 2017 at 12:01 PM, Athira Rajeev
>>> <atrajeev@linux.vnet.ibm.com> wrote:
>>>>
>>>> Adding patch which has the following change similar to telnet which:
>>>> - Assigns from getenv("USER") only if G.autologin is NULL
>>>>
>>>> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
>>>>
>>>> diff --git a/networking/telnet.c b/networking/telnet.c
>>>> index e1c2595..d1b79a0 100644
>>>> --- a/networking/telnet.c
>>>> +++ b/networking/telnet.c
>>>> @@ -644,7 +644,8 @@ int telnet_main(int argc UNUSED_PARAM, char **argv)
>>>>
>>>> #if ENABLE_FEATURE_TELNET_AUTOLOGIN
>>>> if (1 & getopt32(argv, "al:", &G.autologin))
>>>> - G.autologin = getenv("USER");
>>>> + if (G.autologin == NULL)
>>>> + G.autologin = getenv("USER");
>>>> argv += optind;
>>>
>>>
>>> if (G.autologin == NULL), then -l was not specified.
>>> I propose to simply check for that condition:
>>>
>>> if (1 == getopt32(argv, "al:", &G.autologin)) /* -a without -l USER */
>>>
>>> and not add more conditionals.
>>>
>>> Can you test that this works for you?
>>>
>>
>> Hi Denys,
>>
>> Thanks for the quick response. And yes, the above change works . Checked
>> with -a, -l and giving both options !
>>
>> Thanks
>> Athira Rajeev
>>
> Hi,
> why not (untested):
>
> G.autologin = getenv("USER");
> getopt32(argv, "al:", &G.autologin);
> argv += optind;
This would mean that -a is always active.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic