[PATCH] agetty: make username-in-uppercase feature optional (off by default.)

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

 



From: Hamish Coleman <hamish@xxxxxxx>

The following patch makes the username-in-upper-case feature optional.

I have chosen to make it default to off since this feature was designed
to cater for serial terminals that were last sold almost 30 years ago,
thus the likelyhood that anyone will need this feature turned on is
vanishingly small.

Addresses-Debian-Bug: 156242
Signed-off-by: Hamish Coleman <hamish@xxxxxxx>
Signed-off-by: LaMont Jones <lamont@xxxxxxxxxx>
---
 login-utils/agetty.8 |    8 +++++++-
 login-utils/agetty.c |   12 ++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/login-utils/agetty.8 b/login-utils/agetty.8
index 5bde294..8761374 100644
--- a/login-utils/agetty.8
+++ b/login-utils/agetty.8
@@ -3,7 +3,7 @@
 agetty \- alternative Linux getty
 
 .SH SYNOPSIS
-.BR "agetty " [\-8ihLmnw]
+.BR "agetty " [\-8ihLmnUw]
 .RI "[-f " issue_file ]
 .RI "[-l " login_program ]
 .RI "[-I " init ]
@@ -163,6 +163,12 @@ Force the line to be a local line with no need for carrier detect. This can
 be useful when you have a locally attached terminal where the serial line
 does not set the carrier detect signal.
 .TP
+\-U
+Turn on support for detecting an uppercase only terminal.  This setting will
+detect a login name containing only capitals as indicating an uppercase
+only terminal and turn on some upper to lower case conversions.  Note that
+this has no support for any unicode characters.
+.TP
 \-w 
 Wait for the user or the modem to send a carriage-return or a
 linefeed character before sending the \fI/etc/issue\fP (or other) file
diff --git a/login-utils/agetty.c b/login-utils/agetty.c
index c6c754d..fe31b36 100644
--- a/login-utils/agetty.c
+++ b/login-utils/agetty.c
@@ -134,6 +134,7 @@ struct options {
 #define F_WAITCRLF	(1<<5)		/* wait for CR or LF */
 #define F_CUSTISSUE	(1<<6)		/* give alternative issue file */
 #define F_NOPROMPT	(1<<7)		/* don't ask for login name! */
+#define F_LCUC		(1<<8)		/* Support for *LCUC stty modes */
 
 /* Storage for things detected while the login name was read. */
 
@@ -374,7 +375,7 @@ parse_args(argc, argv, op)
     extern int optind;			/* getopt */
     int     c;
 
-    while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mt:wn"))) {
+    while (isascii(c = getopt(argc, argv, "8I:LH:f:hil:mt:wUn"))) {
 	switch (c) {
 	case '8':
 	    op->eightbits = 1;
@@ -451,6 +452,9 @@ parse_args(argc, argv, op)
 	case 'w':
 	    op->flags |= F_WAITCRLF;
 	    break;
+	case 'U':
+	    op->flags |= F_LCUC;
+	    break;
 	default:
 	    usage();
 	}
@@ -1082,7 +1086,7 @@ char   *get_logname(op, cp, tp)
     }
     /* Handle names with upper case and no lower case. */
 
-    if ((cp->capslock = caps_lock(logname))) {
+    if (((cp->capslock = caps_lock(logname))) && (op->flags & F_LCUC)) {
 	for (bp = logname; *bp; bp++)
 	    if (isupper(*bp))
 		*bp = tolower(*bp);		/* map name to lower case */
@@ -1142,7 +1146,7 @@ termio_final(op, tp, cp)
     }
     /* Account for upper case without lower case. */
 
-    if (cp->capslock) {
+    if (cp->capslock && (op->flags & F_LCUC)) {
 	tp->c_iflag |= IUCLC;
 #ifdef XCASE	
 	tp->c_lflag |= XCASE;
@@ -1197,7 +1201,7 @@ bcode(s)
 void
 usage()
 {
-    fprintf(stderr, _("Usage: %s [-8hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname);
+    fprintf(stderr, _("Usage: %s [-8hiLmUw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] baud_rate,... line [termtype]\nor\t[-hiLmw] [-l login_program] [-t timeout] [-I initstring] [-H login_host] line baud_rate,... [termtype]\n"), progname);
     exit(1);
 }
 
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" 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