[net.bugs.uucp] More System V.2 uucp bugs, maybe in others as well

joemu@nsc-pdc.UUCP (Joe Mueller) (07/10/85)

[eat me]

I found a couple of other bugs in uucp while I was hacking away I thought
I'd share the fixes.

1. If you look at your LOGFILE and notice that you have the sequence:
	OK (conversation complete)
	TIMEOUT (machine-name)
   The your system is missing the over and out message at the end of the
   transmission. The way I found some versions of uucp doing it was to modify
   cico.c in the following way:
*** /tmp/,RCSt1010067	Tue Jul  9 19:41:56 1985
--- /tmp/,RCSt2010067	Tue Jul  9 19:41:58 1985
***************
*** 488,494
  		DEBUG(4, "send OO %d,", ret);
  		if (!setjmp(Sjbuf)) {
  			for (;;) {
- 				omsg('O', "OOOOO", Ofn);
  				ret = imsg(msg, Ifn);
  				if (ret != 0)
  					break;

--- 488,493 -----
  		DEBUG(4, "send OO %d,", ret);
  		if (!setjmp(Sjbuf)) {
  			for (;;) {
  				ret = imsg(msg, Ifn);
  				if (ret != 0)
  					break;

    Basically I added a second omsg call within the loop. There is another omsg
    call directly above the DEBUG statement. Some versions of cico.c that I
    looked at had the omsg call within the loop but was missing it above the
    DEBUG statement. Actually, the right way to fix it would to extend the
    protocall so that you would syncronously look for the over and out message
    rather than to have both side blurt it out and hope the other guy sees it
    but it would mean that you'ld have to change all the uucp's around.

2.  The second and third bugs are that the routine us_sst does not open the
    correct lock file and once you fix that you can't open it because you don't
    have the correct permissions on the file. You can see the problem if you
    call your machine from another while in debug mode over the value of 9.
    i.e. on another machine issue the following command as root:
	/usr/lib/uucp/uucico -r1 -x9 -syour_machine_name
    It will call your machine and spit out a lot of junk to your screen. You
    then go back to your machine and check /usr/spool/uucp/AUDIT to see if
    you have any messages that look something like:
	"fopen of /usr/spool/uucp/LCK.LSTAT failed"
    If you do, you have the bugs. To fix the first one you need to change
    us_sst.c as follows:
*** /tmp/,RCSt1010154	Tue Jul  9 19:48:34 1985
--- us_sst.c	Tue Jul  9 19:48:07 1985
***************
*** 48,54
  		umask(mask);
  		return(FAIL);
  	}
! 	if ((fp = fopen(L_stat, "r+")) == NULL) {
  		DEBUG(3, "fopen of %s failed\n", LCKLSTAT);
  		rmlock(LCKLSTAT);
  		umask(mask);

--- 48,54 -----
  		umask(mask);
  		return(FAIL);
  	}
! 	if ((fp = fopen(LCKLSTAT, "r+")) == NULL) {
  		DEBUG(3, "fopen of %s failed\n", LCKLSTAT);
  		rmlock(LCKLSTAT);
  		umask(mask);

    The second bug you need to modify the file ulockf.c in the following way:
*** /tmp/,RCSt1010117	Tue Jul  9 19:45:20 1985
--- ulockf.c	Tue Jul  9 19:44:43 1985
***************
*** 146,152
  	char	cb[100];
  	extern errno;
  
! 	fd=creat(tempfile,0444);
  	if(fd < 0){
  		sprintf(cb, "%s %s %d",tempfile,name,errno);
  		logent("ULOCKC", cb);

--- 146,152 -----
  	char	cb[100];
  	extern errno;
  
! 	fd=creat(tempfile,0664);
  	if(fd < 0){
  		sprintf(cb, "%s %s %d",tempfile,name,errno);
  		logent("ULOCKC", cb);

That should do it.

Will Batman and Robin escape the clutches of the mad hacker? Tune in next week
to find out. Same bat time, same bat channel...