Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jan 1998 10:20:29 -0800 (PST)
From:      Kevin McQuiggin <mcquiggi@sfu.ca>
To:        bugs@freebsd.org
Subject:   Bug Report in getty
Message-ID:  <199801031820.KAA02422@fraser.sfu.ca>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801031820.KAA02422>