Re: [PATCH 5/7] Better support of virtual console

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 18, 2011 at 12:47:54PM +0200, Karel Zak wrote:
> On Wed, May 18, 2011 at 11:01:39AM +0200, Dr. Werner Fink wrote:
> > > 
> > >  your new version does not return zero. The code in main() checks for
> > >  the zero to call next_speed().
> > > 
> > >  It seems like a bug, right?
> > 
> > Yes and also No ... if a CBREAK happens that is normally the
> > read() will see a zero the former get_logname() returns due
> > to the implicit cast to (char*) simply NULL.  With the new
> > code the current login name will be terminated by 0 and
> > returned.
> 
>  Yep, and string terminated by 0 is not NULL ;-)
> 
>   while ((logname =
>           get_logname(&options, &termios, &chardata)) == 0)
> 
>  is what makes me unhappy.
> 
> > The question is: If a CBREAK happens in both cases the login
> > name has to be repeated, in the old code the prompt for the
> > login is simply shown again regardless what was typed in
> 
>  The old code calls next_speed(), so it changes the terminal setting
>  before it asks again for the login name.
> 
> > in the new code the part of the login name does not exist
> > as a user but now the agetty asks for a password.
> 
>  It's login(1) who asks for a password, agetty will never be able to
>  try any other terminal speed...

You're right

> > For the later case I'd like to say it's a bug ...
> 
>  Yes.
> 
> > Maybe there is a way to handle such CBREAKS more efficiently
> > as the array logname is already a static one and will remember
> > the already typed characters.  For this get_logname() may
> > not overwrite the start of logname if it has seen a CBREAK
> > before. But this will become a more complex code (IMHO).
> 
>  It's probably better to keep it simple and stupid. It's better if you
>  type your username more times that if you are not able to log in to
>  the system at all :-)

Yes ...

> diff --git a/term-utils/agetty.c b/term-utils/agetty.c
> index 1b6bfd6..45624f5 100644
> --- a/term-utils/agetty.c
> +++ b/term-utils/agetty.c
> @@ -1336,7 +1336,7 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata
>  			case 0:
>  				*bp = 0;
>  				if (op->numspeed > 1)
> -					return logname;
> +					return NULL;
>  				break;
>  			case CR:
>  			case NL:
> 
> 
>  OK?

I'm agree, better we use this simple solution instead of tease out
a very complex solution with the risk making get_logname() unreadable.

     Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux