Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site uwvax.UUCP Path: utzoo!linus!decvax!decwrl!pyramid!ut-sally!seismo!uwvax!dave From: dave@uwvax.UUCP (Dave Cohrs) Newsgroups: net.bugs.uucp Subject: bug in acucntrl.c (4.3 version) with utmp update Message-ID: <492@uwvax.UUCP> Date: Wed, 1-Jan-86 00:05:04 EST Article-I.D.: uwvax.492 Posted: Wed Jan 1 00:05:04 1986 Date-Received: Thu, 2-Jan-86 04:47:08 EST Organization: U of Wisconsin CS Dept Lines: 44 Index: /usr/src/uucp/acucntrl.c 4.3BSD Description: acncntrl updates the wrong entry in /etc/utmp if the /etc/ttys files contains lines with comments or blank lines. It turns out the these lines shouldn't be counted when figuring which entry in the utmp file gets updated. Repeat-By: put some lines in your /etc/ttys file before the dialup line you want to use for dialing in/out. Now, disable the line. If you look at /etc/utmp, the wrong entry got updated. Fix: The fix is simple. In the opnttys() routine, only update the utmploc if the line does not begin with a newline or a '#'. I just looked at the distributed version (I have a newer version) also -- it has the same problem, but the update to utmploc is in a different place. *** acucntrl.c.old Mon Nov 4 18:46:01 1985 --- acucntrl.c Tue Dec 31 22:13:13 1985 *************** *** 423,429 **** --- 423,430 ---- if(strncmp(device, linebuf, ndevice) == 0) return; ttyslnbeg += strlen(linebuf); !< utmploc += sizeof(utmp); if (fputs(linebuf, nttysfile) == NULL) { fprintf(stderr, "On %s write: %s\n", Etcttys, sys_errlist[errno]); --------------- if(strncmp(device, linebuf, ndevice) == 0) return; ttyslnbeg += strlen(linebuf); !> if(*linebuf != '\n' && *linebuf != '#') !> utmploc += sizeof(utmp); if (fputs(linebuf, nttysfile) == NULL) { fprintf(stderr, "On %s write: %s\n", Etcttys, sys_errlist[errno]); -- Dave Cohrs (608) 262-1204 ...!{harvard,ihnp4,seismo,topaz}!uwvax!dave dave@romano.wisc.edu