Aymeric Vincent <aymericvincent%free.fr@localhost> writes: > while looking at usr.bin/login/login.c, I noticed the following strange > test: > > if (tty[sizeof("tty")-1] == 'd') > syslog(LOG_INFO, "DIALUP %s, %s", tty, pwd->pw_name); > > The intent seems obvious (if the name contains a 'd' in a position which > would agree with "ttyd", syslog that we have a dialup login) but it > seems to be a sloppy test which is furthermore incoherent with the > current naming of our devices. (It can't currently lead to an out of > bounds access because ttyname(3) returns a static PATH_MAX-length array) This seems odd to me, but maybe there was a notion at berkeley to name tty devices with d if they were modems. > After a quick look around, ttys(5) mentions ttyd0 as a dialout device in > its examples section, and the MAKEDEV.conf of the vax seems to avoid > ttyd in its enumeration of ttys, but on the other hand quite a handful > of ports use tty[a-d] as usual serial ports and logins on ttyd would > spam syslog uselessly. Historically DEC machines used tty0 (probably as far back as 6th Edition), and ttyd0 was the dialout version. That did/does two things: allow open to succeed without waiting for CD, and interlock against the pending open on the tty0 from getty, keeping it from succeeding as long as the dialout open is open (even though CD will be asserted). I think the dialout bit was oring in 128 to the minor (back when minor was 8 bits). I remember ttyd0 as being the dialout version of tty0 (vaguely around 2.8BSD, but my memory is a bit fuzzy as it's over 30 years ago). On Sun, the serial ports were ttya and ttyb. So there the ttyd notion didn't really work as you point out. > Out of curiosity, I'm also interested to know if /dev/dtyxx is the new > incarnation of /dev/ttydxx or if they serve different purposes. I am 99% sure that dty is a new naming convention for the dialout concept. On a netbsd-6 i386 system, tty00 is 8,0 and dty00 8,524288 - which is 0x80000. > Also, checking with cvs annotate dug up a very old PR which induced the > removal of the test but the test was added back a few months later as a > merge of 4.4lite. > > http://gnats.netbsd.org/377 > > So, before I remove the test (again), does anyone object? Does anyone > want to offer a more sensible test for the same intended purpose? I guess the real question is whether login is trying to log a login on a modem (which seems not doable, because a modem and a terminal with a null modem look the same), or if it's trying to warn about use of a dialout device to login, which is a misconfiguration. It seems most likely it's about login on a modem. So I'd say remove these lines.
Attachment:
pgpmtCnSwz5xc.pgp
Description: PGP signature