[net.bugs.uucp] bug in acucntrl.c

dave@uwvax.UUCP (Dave Cohrs) (01/01/86)

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