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 11:01:39AM +0200, Dr. Werner Fink wrote:
> On Tue, May 17, 2011 at 02:07:15PM +0200, Karel Zak wrote:
> > On Tue, May 10, 2011 at 05:34:30PM +0200, Dr. Werner Fink wrote:
> > > Better support of virtual console due support of UTF-8 login names
> > > provided by e.g. LDAP.  Set default size 24/80 on serial modem lines
> > > if not found by the kernel.
> > 
> >  Applied, but...
> > 
> > > @@ -1095,92 +1118,134 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata
> > [...]
> > > -			/* Do BREAK handling elsewhere. */
> > > -			if ((c == 0) && op->numspeed > 1)
> > > -				return EXIT_SUCCESS;
> >                 
> >  the original get_logname() returns zero
> > 
> > >  			/* Do erase, kill and end-of-line processing. */
> > >  			switch (ascval) {
> > > +			case 0:
> > > +				*bp = 0;
> > > +				if (op->numspeed > 1)
> > > +					return logname;
> > > +				break;
> > 
> >  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...

> 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 :-)


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?

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
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