Patch #7 to Pcomm v1.1

egray at fthood.UUCP egray at fthood.UUCP
Tue Jan 31 04:28:00 AEST 1989


This is patch #7 to Pcomm v1.1.   This will probably be the last patch to
version 1.1, because the 1.2 version is scheduled to be released very soon.

That means you've got a choice...  You can use this patch to upgrade the
version you've already got, or you can wait and download the (rather
huge) v1.2 distribution package in a few weeks.

Have fun...

Emmet P. Gray				US Army, HQ III Corps & Fort Hood
...!uunet!uiucuxc!fthood!egray		Attn: AFZF-DE-ENV
					Directorate of Engineering & Housing
					Environmental Management Office
					Fort Hood, TX 76544-5057

-------------------------------------------------------------------------------
*** old/d_print.c	Sat Oct 22 19:35:10 1988
--- d_print.c	Thu Jan 26 12:33:02 1989
***************
*** 14,18
  print_dir()
  {
! 	FILE *fp, *popen();
  	WINDOW *p_win, *newwin();
  	char *file, *e_get_str(), buf[80];

--- 14,18 -----
  print_dir()
  {
! 	FILE *fp, *popen(), *my_fopen();
  	WINDOW *p_win, *newwin();
  	char *file, *e_get_str(), buf[80];
***************
*** 80,84
  			}
  		}
! 		fp = fopen(file, "w");
  	}
  

--- 80,84 -----
  			}
  		}
! 		fp = my_fopen(file, "w");
  	}
  
*** old/di_delay.c	Tue Aug  9 22:08:02 1988
--- di_delay.c	Thu Jan 26 12:33:57 1989
***************
*** 69,73
  			else
  				rdelay = MIN_PAUSE;
! 			mvwprintw(dt_win, 6, 20, "%-3d", rdelay);
  		}
  	}

--- 69,73 -----
  			else
  				rdelay = MIN_PAUSE;
! 			mvwprintw(dt_win, 6, 22, "%-3d", rdelay);
  		}
  	}
*** old/dial.c	Sat Oct 22 19:35:28 1988
--- dial.c	Thu Jan 26 12:36:28 1989
***************
*** 224,228
  {
  	extern int fd;
! 	int c;
  #ifdef UNIXPC
  	unsigned int sleep();

--- 224,229 -----
  {
  	extern int fd;
! 	int i;
! 	char c;
  #ifdef UNIXPC
  	unsigned int sleep();
***************
*** 247,251
  					/* search for key words */
  	for (; rc_index<511; rc_index++) {
! 		if ((c = getc_line(1)) <= 0)
  			return(NULL);
  #ifdef DEBUG

--- 248,252 -----
  					/* search for key words */
  	for (; rc_index<511; rc_index++) {
! 		if ((i = getc_line(1)) <= 0)
  			return(NULL);
  
***************
*** 249,252
  		if ((c = getc_line(1)) <= 0)
  			return(NULL);
  #ifdef DEBUG
  		fprintf(stderr, "read_codes: '%c', %02x, %03o, %d\n", c, c, c, c);

--- 250,255 -----
  		if ((i = getc_line(1)) <= 0)
  			return(NULL);
+ 
+ 		c = i & 0x7f;
  #ifdef DEBUG
  		fprintf(stderr, "read_codes: '%c', %02x, %03o, %d\n", c, c, c, c);
***************
*** 252,256
  		fprintf(stderr, "read_codes: '%c', %02x, %03o, %d\n", c, c, c, c);
  #endif /* DEBUG */
! 
  		rc_buf[rc_index] = c;
  		rc_buf[rc_index+1] = '\0';

--- 255,264 -----
  		fprintf(stderr, "read_codes: '%c', %02x, %03o, %d\n", c, c, c, c);
  #endif /* DEBUG */
! 					/* no NULLs please */
! 		if (c == '\0') {
! 			if (rc_index)
! 				rc_index--;
! 			continue;
! 		}
  		rc_buf[rc_index] = c;
  		rc_buf[rc_index+1] = '\0';
*** old/info.c	Sat Nov 19 11:06:28 1988
--- info.c	Thu Jan 26 12:37:46 1989
***************
*** 4,9
   */
  
! #define VERSION "1.1"
! #define DATE	"19 Nov 88"
  
  #include <stdio.h>

--- 4,9 -----
   */
  
! #define VERSION "1.1.7"
! #define DATE	"27 Jan 89"
  
  #include <stdio.h>
*** old/input.c	Sat Oct 22 19:35:45 1988
--- input.c	Thu Jan 26 12:38:57 1989
***************
*** 331,334
  			}
  			break;
  		case '\t':		/* tab character */
  			tab_stop = VCOL + 8 - (VCOL % 8);

--- 331,337 -----
  			}
  			break;
+ 		case 0:
+ 		case 7:			/* skip NULL and "bell" character */
+ 			break;
  		case '\t':		/* tab character */
  			tab_stop = VCOL + 8 - (VCOL % 8);
***************
*** 419,423
  				/* get the x, y coordinates */
  	fgets(buf, 10, fp);
! 	scanf(buf, "%d,%d\n", VROW, VCOL);
  
  				/* read the file into the vs array */

--- 422,426 -----
  				/* get the x, y coordinates */
  	fgets(buf, 10, fp);
! 	sscanf(buf, "%d,%d\n", &VROW, &VCOL);
  
  				/* read the file into the vs array */
*** old/main.c	Sat Nov 19 11:06:30 1988
--- main.c	Sun Jan 29 19:22:35 1989
***************
*** 11,19
   *
   *	Release v1.0	12 Mar 88
-  *	  patch #1	22 Mar 88
-  *	  patch #2	26 Mar 88
-  *	  patch #3	 3 Apr 88
-  *	  patch #4	14 Apr 88
-  *	  patch #5	25 May 88
   *	Release v1.1	21 Aug 88
   *	  patch #1	13 Sep 88

--- 11,14 -----
   *
   *	Release v1.0	12 Mar 88
   *	Release v1.1	21 Aug 88
   *	  patch #1	13 Sep 88
***************
*** 23,26
   *	  patch #5	15 Oct 88
   *	  patch #6	19 Nov 88
   */
  

--- 18,22 -----
   *	  patch #5	15 Oct 88
   *	  patch #6	19 Nov 88
+  *	  patch #7	27 Jan 89
   */
  
***************
*** 25,28
   */
  
  #include <stdio.h>
  #include <signal.h>

--- 21,26 -----
   */
  
+ #undef SETUID_BROKE
+ 
  #include <stdio.h>
  #include <signal.h>
***************
*** 219,223
  	char *p, path[200], *strcpy(), *strrchr();
  
! 	p = strcpy(path, file);
  					/* dissect the path component */
  	if (p = strrchr(path, '/'))

--- 217,221 -----
  	char *p, path[200], *strcpy(), *strrchr();
  
! 	strcpy(path, file);
  					/* dissect the path component */
  	if (p = strrchr(path, '/'))
***************
*** 222,226
  					/* dissect the path component */
  	if (p = strrchr(path, '/'))
! 		*(p++) = '\0';
  	else
  		strcpy(path, ".");

--- 220,224 -----
  					/* dissect the path component */
  	if (p = strrchr(path, '/'))
! 		*p = '\0';
  	else
  		strcpy(path, ".");
***************
*** 239,243
  /*
   * Check the read and write permissions before opening a file.  This
!  * is a horrible kludge to work around that fact that a lot of systems
   * that claim to be SVID compatible don't treat setuid(2) and setgid(2)
   * properly.  For example, on a Masscomp, you can't flip-flop back and

--- 237,241 -----
  /*
   * Check the read and write permissions before opening a file.  This
!  * is a horrible kludge to work around the fact that a lot of systems
   * that claim to be SVID compatible don't treat setuid(2) and setgid(2)
   * properly.  For example, on a Masscomp, you can't flip-flop back and
***************
*** 249,252
  char *file, *mode;
  {
  #ifdef SETUGID
  	switch (*mode) {

--- 247,252 -----
  char *file, *mode;
  {
+ 	FILE *fp;
+ 
  #ifdef SETUGID
  #ifdef SETUID_BROKE
***************
*** 250,253
  {
  #ifdef SETUGID
  	switch (*mode) {
  		case 'a':

--- 250,254 -----
  
  #ifdef SETUGID
+ #ifdef SETUID_BROKE
  	switch (*mode) {
  		case 'a':
***************
*** 253,258
  		case 'a':
  		case 'w':
! 			if (!can_write(file))
! 				return(NULL);
  			break;
  		case 'r':

--- 254,269 -----
  		case 'a':
  		case 'w':
! 			switch(can_write(file)) {
! 				case 0:	/* denied */
! 					fp = (FILE *) NULL;
! 					break;
! 				case 2:	/* file already exists */
! 					fp = fopen(file, mode);
! 					break;
! 				case 1: /* create a new file */
! 					fp = fopen(file, mode);
! 					chown(file, getuid(), getgid());
! 					break;
! 			}
  			break;
  		case 'r':
***************
*** 258,262
  		case 'r':
  			if (access(file, 4))
! 				return(NULL);
  			break;
  	}

--- 269,275 -----
  		case 'r':
  			if (access(file, 4))
! 				fp = (FILE *) NULL;
! 			else
! 				fp = fopen(file, mode);
  			break;
  	}
***************
*** 261,264
  			break;
  	}
  #endif /* SETUGID */
  	return ((FILE *) fopen(file, mode));

--- 274,294 -----
  			break;
  	}
+ #else /* SETUID_BROKE */
+ 	int euid, egid;
+ 
+ 	euid = geteuid();
+ 	egid = getegid();
+ 					/* abdicate the throne */
+ 	setuid(getuid());
+ 	setgid(getgid());
+ 
+ 	fp = fopen(file, mode);
+ 					/* put things back */
+ 	setuid(euid);
+ 	setgid(egid);
+ #endif /* SETUID_BROKE */
+ 	return(fp);
+ #else /* SETUGID */
+ 	return(fopen(file, mode));
  #endif /* SETUGID */
  }
***************
*** 262,265
  	}
  #endif /* SETUGID */
- 	return ((FILE *) fopen(file, mode));
  }

--- 292,294 -----
  	return(fopen(file, mode));
  #endif /* SETUGID */
  }
*** old/passthru.c	Tue Aug 16 18:57:10 1988
--- passthru.c	Thu Jan 26 12:41:33 1989
***************
*** 17,21
  	WINDOW *pt_win, *newwin();
  	int num;
! 	void cpio();
  
  	pt_win = newwin(5, 70, 5, 5);

--- 17,21 -----
  	WINDOW *pt_win, *newwin();
  	int num;
! 	void cpio(), error_win();
  
  	pt_win = newwin(5, 70, 5, 5);
***************
*** 40,43
  			wrefresh(pt_win);
  			delwin(pt_win);
  
  			touchwin(stdscr);

--- 40,48 -----
  			wrefresh(pt_win);
  			delwin(pt_win);
+ 
+ 			if (fd == -1) {
+ 				error_win(0, "Not currently connected to any host", "");
+ 				return(0);
+ 			}
  
  			touchwin(stdscr);
*** old/port.c	Sat Nov 19 11:06:30 1988
--- port.c	Thu Jan 26 12:42:45 1989
***************
*** 150,153
  					/* turn off the "no delay" mode */
  			fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NDELAY);
  					/* load the modem data base */
  			modem->m_cur = -1;

--- 150,157 -----
  					/* turn off the "no delay" mode */
  			fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NDELAY);
+ 
+ 					/* ...just to be sure */
+ 			close(open(buf, O_RDWR));
+ 
  					/* load the modem data base */
  			modem->m_cur = -1;
*** old/x_ascii.c	Sat Oct 22 19:36:35 1988
--- x_ascii.c	Thu Jan 26 12:44:19 1989
***************
*** 165,169
  				break;
  		}
! 		c = i & 0xff;
  					/* expand blank lines */
  		if (expand && last == '\n' && c == '\n')

--- 165,169 -----
  				break;
  		}
! 		c = i & 0x7f;
  					/* expand blank lines */
  		if (expand && last == '\n' && c == '\n')
***************
*** 265,269
  		got_first = 1;
  		delay = param->timer;
! 		c = i & 0xff;
  					/* display it on the screen */
  		putchar(c);

--- 265,269 -----
  		got_first = 1;
  		delay = param->timer;
! 		c = i & 0x7f;
  					/* display it on the screen */
  		putchar(c);
*** old/x_batch.c	Sat Oct 22 19:36:44 1988
--- x_batch.c	Thu Jan 26 12:45:51 1989
***************
*** 274,278
  					/* dissect the name component */
  	if ((s = strrchr(str, '/')))
! 		strcpy(temp, s++);
  	else
  		strcpy(temp, str);

--- 274,278 -----
  					/* dissect the name component */
  	if ((s = strrchr(str, '/')))
! 		strcpy(temp, ++s);
  	else
  		strcpy(temp, str);
***************
*** 331,335
  					/* ignore the path component */
  	if (s = strrchr(path, '/'))
! 		strcpy(temp, s++);
  	else
  		strcpy(temp, path);

--- 331,335 -----
  					/* ignore the path component */
  	if (s = strrchr(path, '/'))
! 		strcpy(temp, ++s);
  	else
  		strcpy(temp, path);
*** old/x_extrnl.c	Sat Oct 22 19:36:44 1988
--- x_extrnl.c	Thu Jan 26 13:06:14 1989
***************
*** 10,13
  #include <curses.h>
  #include <fcntl.h>
  #include "config.h"
  

--- 10,14 -----
  #include <curses.h>
  #include <fcntl.h>
+ #include <errno.h>
  #include "config.h"
  
***************
*** 16,20
  char *cmd;
  {
! 	extern int fd;
  	WINDOW *xt_win, *newwin();
  	int (*istat)(), (*qstat)(), status, epid, w;

--- 17,21 -----
  char *cmd;
  {
! 	extern int fd, errno;
  	WINDOW *xt_win, *newwin();
  	int (*istat)(), (*qstat)(), epid;
***************
*** 18,22
  	extern int fd;
  	WINDOW *xt_win, *newwin();
! 	int (*istat)(), (*qstat)(), status, epid, w;
  	char *shell, *shellpath, *getenv(), *strrchr(), buf[40], *ttyname();
  	char *strcpy();

--- 19,23 -----
  	extern int fd, errno;
  	WINDOW *xt_win, *newwin();
! 	int (*istat)(), (*qstat)(), epid;
  	char *shell, *shellpath, *getenv(), *strrchr(), buf[40], *ttyname();
  	char *strcpy();
***************
*** 39,42
  
  	if (!(epid = fork())) {
  						/* recreate the device name */
  		strcpy(buf, ttyname(fd));

--- 40,44 -----
  
  	if (!(epid = fork())) {
+ 		setpgrp();
  						/* recreate the device name */
  		strcpy(buf, ttyname(fd));
***************
*** 44,47
  						/* swap the stdin */
  		close(0);
  		open(buf, O_RDONLY);
  						/* swap the stdout */

--- 46,54 -----
  						/* swap the stdin */
  		close(0);
+ #ifdef UNIXPC
+ 		if (!strncmp(buf, "/dev/ph", 7))
+ 			open(buf, O_RDWR);
+ 		else
+ #endif /* UNIXPC */
  		open(buf, O_RDONLY);
  						/* swap the stdout */
***************
*** 47,50
  						/* swap the stdout */
  		close(1);
  		open(buf, O_WRONLY);
  #ifdef SETUGID

--- 54,62 -----
  						/* swap the stdout */
  		close(1);
+ #ifdef UNIXPC
+ 		if (!strncmp(buf, "/dev/ph", 7))
+ 			open(buf, O_RDWR);
+ 		else
+ #endif /* UNIXPC */
  		open(buf, O_WRONLY);
  #ifdef SETUGID
***************
*** 58,63
  	qstat = signal(SIGQUIT, SIG_IGN);
  
! 	while ((w = wait(&status)) != epid && w != -1)
! 		;
  
  	signal(SIGINT, istat);

--- 70,93 -----
  	qstat = signal(SIGQUIT, SIG_IGN);
  
! 	/*
! 	 * Check the keyboard while the external program is running.  If
! 	 * the user hits the <ESC> key, then kill the entire process 
! 	 * group associated with the new shell.
! 	 */
! 	while(1) {
! 		switch(wait_key(stdscr, 1)) {
! 			case -1:	/* timed out */
! 				break;
! 			case 27:	/* a user abort */
! 				kill(-epid, SIGKILL);
! 				break;
! 			default:
! 				beep();
! 				break;
! 		}
! 					/* see if the process is still active */
! 		if ((kill(epid, 0) == -1) && errno == ESRCH)
! 			break;
! 	}
  
  	signal(SIGINT, istat);
*** old/x_rcv.c	Sat Nov 19 11:06:32 1988
--- x_rcv.c	Mon Jan 30 08:13:20 1989
***************
*** 246,250
  			file_length = recv - (unsigned int) block_size + (unsigned int) i -2L;
  			fclose(fp);
! 			if (fix_length(file_name, file_length)) {
  				beep();
  				clear_line(win, 12, 24, 1);

--- 246,250 -----
  			file_length = recv - (unsigned int) block_size + (unsigned int) i -2L;
  			fclose(fp);
! 			if (fix_length(file, file_length)) {
  				beep();
  				clear_line(win, 12, 24, 1);
***************
*** 375,379
  	unsigned short crc, calc_crc();
  	unsigned int packet, sleep();
! 	unsigned char calc_sum(), crc_1, crc_2;
  	void cancel_xfer();
  

--- 375,379 -----
  	unsigned short crc, calc_crc();
  	unsigned int packet, sleep();
! 	unsigned char calc_sum(), crc_1, crc_2, blk_compliment;
  	void cancel_xfer();
  
***************
*** 455,459
  		 */
  		out_of_sync = 0;
! 		if (buf[1] != blk || buf[2] != (unsigned char) ~blk)
  			out_of_sync++;
  

--- 455,460 -----
  		 */
  		out_of_sync = 0;
! 		blk_compliment = ~blk;
! 		if (buf[1] != blk || buf[2] != blk_compliment)
  			out_of_sync++;
  
*** old/xmodem.c	Tue Aug 16 10:23:06 1988
--- xmodem.c	Mon Jan 30 08:18:08 1989
***************
*** 245,249
  	FILE *fp, *tempfp, *my_fopen();
  	register int num;
! 	char *tempfile, *mktemp(), buf[BUFSIZ];
  	struct stat stbuf;
  

--- 245,249 -----
  	FILE *fp, *tempfp, *my_fopen();
  	register int num;
! 	char tempfile[128], *mktemp(), buf[BUFSIZ], *s, *strrchr();
  	struct stat stbuf;
  
***************
*** 263,267
  	 * links across different file systems aren't allowed).
  	 */
! 	tempfile = mktemp("trunXXXXXX");
  	if (!(tempfp = my_fopen(tempfile, "w"))) {
  		fclose(fp);

--- 263,275 -----
  	 * links across different file systems aren't allowed).
  	 */
! 	strcpy(tempfile, file);
! 	if (s = strrchr(tempfile))
! 		*++s = '\0';
! 	else
! 		strcpy(tempfile, "./");
! 
! 	strcat(tempfile, "trunXXXXXX");
! 	mktemp(tempfile);
! 
  	if (!(tempfp = my_fopen(tempfile, "w"))) {
  		fclose(fp);



More information about the Comp.sources.bugs mailing list