From owner-freebsd-bugs Sat Jan 3 10:20:44 1998 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id KAA24368 for bugs-outgoing; Sat, 3 Jan 1998 10:20:44 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: from rm-rstar.sfu.ca (root@rm-rstar.sfu.ca [142.58.120.21]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id KAA24363 for ; Sat, 3 Jan 1998 10:20:39 -0800 (PST) (envelope-from mcquiggi@sfu.ca) Received: from fraser.sfu.ca (fraser.sfu.ca [192.168.0.101]) by rm-rstar.sfu.ca (8.8.7/8.8.7/SFU-4.0H) with SMTP id KAA17986 for ; Sat, 3 Jan 1998 10:20:29 -0800 (PST) From: Kevin McQuiggin Received: by fraser.sfu.ca (950413.SGI.8.6.12/SFU-2.6C) id KAA02422 for bugs@freebsd.org (from mcquiggi@sfu.ca); Sat, 3 Jan 1998 10:20:29 -0800 Message-Id: <199801031820.KAA02422@fraser.sfu.ca> Subject: Bug Report in getty To: bugs@freebsd.org Date: Sat, 3 Jan 1998 10:20:29 -0800 (PST) X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi FreeBSD: I would like to report a bug, and bug fix, for FreeBSD 2.2.2. This was located in /usr/libexec/getty, and is associated with the gettytab :ac and :ic "chat scripts". See man gettytab for the functionality of these scripts. Here's the problem: A gettytab entry of: # TNC entry, create 97.12.31 by K. McQuiggin. tnc|tnc.1200|1200-baud TNC:\ :ac=*** HI\sfrom\sgettytab\r:\ :de=1:\ :ct=1000:\ :np:sp#1200:\ should wait on the associated /etc/ttys line: ttyd1 "/usr/libexec/getty tnc.1200" unknown on secure for the string "***", then reply with the string "HI from gettytab" prior to displaying the login: prompt. Here's what actually was produced: ("***" is typed, not echoed) HI sfro \sgettytab FreeBSD (sputnik.rfnet.sfu.ca) (ttyd1) login: Note how the quoted spaces ("\s" according to man gettytab) are not interpreted properly. The correct result should appear as: HI from gettytab FreeBSD etc... Obviously there is something wrong with the way that these literal characters are being interpreted! This was found to be a problem for all of the escaped special characters noted in the man page. I looked at the source code and noted the following statements starting at line 224 of /usr/src/libexec/getty/chat.c: } else { /* copy standard character */ *r++ == *q; } This "==" looked incorrect as an assignment and I changed it to: } else { /* copy standard character */ *r++ = *q; } And now the :ac output is correct: ("***" is typed, not echoed) HI from gettytab FreeBSD (sputnik.rfnet.sfu.ca) (ttyd1) login: I have tested the other backslashed special characters and this looks to be the fix. I suggest that this fix should be added to the getty source for the next release, if it hasn't been changed already! I have located another problem with the gettytab entries for these characters which I will report separately. In a nutshell someone is pre-parsing the :ac and :ic scripts prior to them getting to chat.c, so that \s for example is being replaced by just s prior to chat.c seeing the input string. I got around this by double backslashing the chars in gettytab: HI\\sfrom\\sgettytab This too is no to the spec and I'll see if I can find out what's going wrong and report it. Please reply to me via email, I read freebsd-questions infrequently as there's too much volume and my other mail gets lost in the noise! I've used FreeBSD for about 3 years, it's fantastic, keep up the good work! Kevin