All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: xinglp <xinglp@gmail.com>
Cc: util-linux@vger.kernel.org
Subject: Re: agetty not show username as I input on a serial term
Date: Mon, 26 Sep 2011 12:52:38 +0200	[thread overview]
Message-ID: <20110926105238.GA1982@nb.net.home> (raw)
In-Reply-To: <CAHQM782fzMjh+XAiTwea_02+qFQ-N-Z+Th3mox0HPkbWnwsV1Q@mail.gmail.com>

On Fri, Sep 02, 2011 at 02:26:17PM +0800, xinglp wrote:
> When I  login  on a serial term,  I type username, but nothing appear
> on the screen, just as input password.

[...]

> It looks like the "ECHO bit in termios.c_cflag" was not properly set
> before the get_logname() been called.

The code incorrectly checks c_cflag, but the ECHO is c_lflag flag
constant.

See the patch below. Thanks!

    Karel


>From b9261127260ff2a8efbdc6e5f9d00ec7f736b445 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Mon, 26 Sep 2011 12:34:10 +0200
Subject: [PATCH] agetty: test ECHO on c_lflag

Reported-by: xinglp <xinglp@gmail.com>
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=739522
Signed-off-by: Karel Zak <kzak@redhat.com>
---
 term-utils/agetty.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index 8398015..75c2b14 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -1466,7 +1466,7 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata
 			case '#':
 				cp->erase = ascval; /* set erase character */
 				if (bp > logname) {
-					if ((tp->c_cflag & (ECHO)) == 0)
+					if ((tp->c_lflag & ECHO) == 0)
 						write_all(1, erase[cp->parity], 3);
 					bp--;
 				}
@@ -1475,7 +1475,7 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata
 			case '@':
 				cp->kill = ascval;		/* set kill character */
 				while (bp > logname) {
-					if ((tp->c_cflag & (ECHO)) == 0)
+					if ((tp->c_lflag & ECHO) == 0)
 						write_all(1, erase[cp->parity], 3);
 					bp--;
 				}
@@ -1487,7 +1487,7 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata
 					break;
 				if ((size_t)(bp - logname) >= sizeof(logname) - 1)
 					log_err(_("%s: input overrun"), op->tty);
-				if ((tp->c_cflag & (ECHO)) == 0)
+				if ((tp->c_lflag & ECHO) == 0)
 					write_all(1, &c, 1);	/* echo the character */
 				*bp++ = ascval;			/* and store it */
 				break;
-- 
1.7.6



      reply	other threads:[~2011-09-26 10:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02  6:26 agetty not show username as I input on a serial term xinglp
2011-09-26 10:52 ` Karel Zak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110926105238.GA1982@nb.net.home \
    --to=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    --cc=xinglp@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.