From owner-freebsd-bugs Sun Aug 24 09:10:07 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA06700 for bugs-outgoing; Sun, 24 Aug 1997 09:10:07 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA06677; Sun, 24 Aug 1997 09:10:03 -0700 (PDT) Resent-Date: Sun, 24 Aug 1997 09:10:03 -0700 (PDT) Resent-Message-Id: <199708241610.JAA06677@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, sumii@is.s.u-tokyo.ac.jp Received: (from nobody@localhost) by hub.freebsd.org (8.8.7/8.8.7) id JAA06611; Sun, 24 Aug 1997 09:09:38 -0700 (PDT) Message-Id: <199708241609.JAA06611@hub.freebsd.org> Date: Sun, 24 Aug 1997 09:09:38 -0700 (PDT) From: sumii@is.s.u-tokyo.ac.jp To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: bin/4370: Getty(8) Parses 'ic' and 'ac' Fields in Gettytab(5) INCORRECTLY Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 4370 >Category: bin >Synopsis: Getty(8) Parses 'ic' and 'ac' Fields in Gettytab(5) INCORRECTLY >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Aug 24 09:10:01 PDT 1997 >Last-Modified: >Originator: Eijiro Sumii >Organization: Department of Information Science, Facility of Science, University of Tokyo >Release: 2.2.2-RELEASE >Environment: FreeBSD proside.sumii.or.jp 2.2.2-RELEASE FreeBSD 2.2.2-RELEASE #0: Sat Aug 2 11:21:48 JST 1997 sumii@proside.sumii.or.jp:/usr/src/sys/compile/PROSIDE+ACVC i386 >Description: Getty (8) parses 'ic' and 'ac' fields in gettytab(5) INCORRECTLY, when some escape characters are included in them. That is known by the debugging messages of getty(8) itself. The cause of this problem is two simple mistakes in the program. I think they are not corrected in FreeBSD-current now. >How-To-Repeat: An Example: 1. Edit /etc/syslog.conf to print debugging messages of getty(8). *.notice;*.debug;lpr.info;mail.crit;news.err /var/log/messages ^^^^^^^ 2. Add an entry like this to /etc/gettytab. mymodem:\ :hw:np:sp#38400:de#1:dc#255:ic="" \pATZ\r OK\r:ac=RING\r \pATA\r CONNECT: 3. Use it from init(8). % grep mymodem /etc/ttys ttyd1 "/usr/libexec/getty mymodem" dialup on insecure 4. Read the debugging messages in /var/log/messages. Aug 24 21:47:30 proside getty[491]: getty_chat script='"" pATZ^M OK' Aug 24 21:47:30 proside getty[491]: chat_expect '' Aug 24 21:47:30 proside getty[491]: chat_expect OK Aug 24 21:47:30 proside getty[491]: chat_send 'pATZ^M' ^ Here! >Fix: % diff -c /usr/src/libexec/getty/chat.c{~,} *** /usr/src/libexec/getty/chat.c~ Sat Feb 22 23:21:36 1997 --- /usr/src/libexec/getty/chat.c Sun Aug 24 22:49:51 1997 *************** *** 223,229 **** } } else { /* copy standard character */ ! *r++ == *q; } } --- 223,229 ---- } } else { /* copy standard character */ ! *r++ = *q; } } % diff -c /usr/src/libexec/getty/subr.c{~,} *** /usr/src/libexec/getty/subr.c~ Sun May 11 14:28:54 1997 --- /usr/src/libexec/getty/subr.c Sun Aug 24 22:24:56 1997 *************** *** 79,85 **** return; for (sp = gettystrs; sp->field; sp++) ! cgetstr(buf, (char*)sp->field, &sp->value); for (np = gettynums; np->field; np++) { if (cgetnum(buf, (char*)np->field, &n) == -1) np->set = 0; --- 79,85 ---- return; for (sp = gettystrs; sp->field; sp++) ! cgetustr(buf, (char*)sp->field, &sp->value); for (np = gettynums; np->field; np++) { if (cgetnum(buf, (char*)np->field, &n) == -1) np->set = 0; *************** *** 99,105 **** #ifdef DEBUG printf("name=\"%s\", buf=\"%s\"\r\n", name, buf); for (sp = gettystrs; sp->field; sp++) ! printf("cgetstr: %s=%s\r\n", sp->field, sp->value); for (np = gettynums; np->field; np++) printf("cgetnum: %s=%d\r\n", np->field, np->value); for (fp = gettyflags; fp->field; fp++) --- 99,105 ---- #ifdef DEBUG printf("name=\"%s\", buf=\"%s\"\r\n", name, buf); for (sp = gettystrs; sp->field; sp++) ! printf("cgetustr: %s=%s\r\n", sp->field, sp->value); for (np = gettynums; np->field; np++) printf("cgetnum: %s=%d\r\n", np->field, np->value); for (fp = gettyflags; fp->field; fp++) >Audit-Trail: >Unformatted: