[comp.sources.bugs] elm 2.3 Patch #10

syd@dsinc.DSI.COM (Syd Weinstein) (12/19/90)

This patch fixes the deleted line that causes the Segmentation
Violation.

Add back missing line in length check
From: Syd

Revision 4.1.1.1  90/12/19  09:44:06  syd
Fix not checking for mail before scanning
From: Syd via report from Joern Lubkoll

Fix:	From rn, say "| patch -p -N -d DIR", where DIR is your elm source
	directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
	If you don't have the patch program, apply the following by hand,
	or get patch (version 2.0, latest patchlevel).

	After patching:
		make
		make install

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel.h file to find out what has or
	has not been applied.  In any event, don't continue with the patch.

	If you are missing previous patches they can be obtained from our:
	archive server.

	Syd Weinstein
	elm@DSI.COM

	The patches are available from the dsinc archive server
	Send the following message to archive-server@DSI.COM for
	a list of available patches:

	Subject: patch list
	send index elm

Index: hdrs/patchlevel.h
Prereq: 9
*** ../elm2.3/hdrs/patchlevel.h	Wed Dec  5 23:42:02 1990
--- hdrs/patchlevel.h	Wed Dec 19 09:52:11 1990
***************
*** 1 ****
! #define PATCHLEVEL 9
--- 1 ----
! #define PATCHLEVEL 10

Index: Patchlist
*** ../elm2.3/Patchlist	Wed Dec  5 23:42:04 1990
--- Patchlist	Wed Dec 19 09:53:21 1990
***************
*** 1,4 ****
--- 1,12 ----
  	Elm 2.3 Patch 9 - More bug/portability fixes
+ 	Wed Dec 19 09:52:45 EST 1990 (Creation date, not posting date)
+ Add back missing line in length check
+ From: Syd
+ 
+ Fix not checking for mail before scanning
+ From: Syd via report from Joern Lubkoll
+ 
+ 	Elm 2.3 Patch 9 - More bug/portability fixes
  	Wed Dec  5 22:10:09 EST 1990 (Creation date, not posting date)
  Add yp search to /etc/yp as well as /usr/etc/yp
  From: Lee Ziegenhals

Index: src/elm.c
Prereq: 4.1
*** ../elm2.3/src/elm.c	Sat Apr 28 22:42:56 1990
--- src/elm.c	Wed Dec 19 09:44:31 1990
***************
*** 1,8 ****
  
! static char rcsid[] = "@(#)$Id: elm.c,v 4.1 90/04/28 22:42:54 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1 $   $State: Exp $
   *
   * This file and all associated files and documentation:
   * 			Copyright (c) 1986, 1987 Dave Taylor
--- 1,8 ----
  
! static char rcsid[] = "@(#)$Id: elm.c,v 4.1.1.1 90/12/19 09:44:06 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.1 $   $State: Exp $
   *
   * This file and all associated files and documentation:
   * 			Copyright (c) 1986, 1987 Dave Taylor
***************
*** 15,20 ****
--- 15,24 ----
   *
   *******************************************************************************
   * $Log:	elm.c,v $
+  * Revision 4.1.1.1  90/12/19  09:44:06  syd
+  * Fix not checking for mail before scanning
+  * From: Syd via report from Joern Lubkoll
+  * 
   * Revision 4.1  90/04/28  22:42:54  syd
   * checkin of Elm 2.3 as of Release PL0
   * 
***************
*** 221,231 ****
  			   }
  			   break;
  
! 	    case '/'    :  if (pattern_match())
  			     nucurr = get_page(current);
  			   else {
! 			      error("pattern not found!");
! 			      fflush(stdin);
  			   }
  			   break;
  
--- 225,240 ----
  			   }
  			   break;
  
! 	    case '/'    :  /* scan mbox for string */
! 			   if  (message_count < 1) {
! 			     error("No mail to scan!");
! 			     fflush(stdin);
! 			   }
! 			   else if (pattern_match())
  			     nucurr = get_page(current);
  			   else {
! 			     error("pattern not found!");
! 			     fflush(stdin);
  			   }
  			   break;
  

Index: src/leavembox.c
Prereq: 4.1.1.5
*** ../elm2.3/src/leavembox.c	Wed Oct 10 13:11:13 1990
--- src/leavembox.c	Thu Dec  6 13:39:56 1990
***************
*** 1,8 ****
  
! static char rcsid[] = "@(#)$Id: leavembox.c,v 4.1.1.5 90/10/10 12:49:46 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.5 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
--- 1,8 ----
  
! static char rcsid[] = "@(#)$Id: leavembox.c,v 4.1.1.6 90/12/06 13:38:55 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.6 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
***************
*** 14,19 ****
--- 14,23 ----
   *
   *******************************************************************************
   * $Log:	leavembox.c,v $
+  * Revision 4.1.1.6  90/12/06  13:38:55  syd
+  * disable stop signal around writeback to avoid corrupted file
+  * From: Syd via report from Tom Davis <tdd@endure.cl.msu.edu>
+  * 
   * Revision 4.1.1.5  90/10/10  12:49:46  syd
   * Fix calling sequence to copy_message calls for
   * new MMDF argument
***************
*** 120,125 ****
--- 124,134 ----
  #else
  	struct utimbuf utime_buffer;	/* utime command */
  #endif
+ #ifdef VOIDSIG
+ 	void	(*oldstop)();
+ #else
+ 	int	(*oldstop)();
+ #endif
  	register int to_delete = 0, to_store = 0, to_keep = 0, i,
  		     marked_deleted, marked_read, marked_unread,
  		     last_sortby, ask_questions,  asked_storage_q,
***************
*** 377,382 ****
--- 386,395 ----
  	
  	/* Everything's GO - so ouput that user message and go to it. */
  
+ #ifdef SIGTSTP
+ 	oldstop = signal(SIGTSTP, SIGIGN);
+ #endif
+ 	
  	dprint(2, (debugfile, "Action: %s\n", buffer));
  	error(buffer);
  
***************
*** 392,397 ****
--- 405,413 ----
  	    dprint(1, (debugfile, "** %s - %s **\n", error_name(errno),
  	      error_description(errno)));
  	    unlock();
+ #ifdef SIGTSTP
+ 	    signal(SIGTSTP, oldstop);
+ #endif
  	    return(0);
  	  }
  	  if ((temp = fopen(recvd_mail,"a")) == NULL) {
***************
*** 432,437 ****
--- 448,456 ----
  	    dprint(1, (debugfile, "** %s - %s **\n", error_name(errno),
  	      error_description(errno)));
  	    unlock();
+ #ifdef SIGTSTP
+ 	    signal(SIGTSTP, oldstop);
+ #endif
  	    return(0);
  	  }
  	  if ((temp = fopen(temp_keep_file,"w")) == NULL) {
***************
*** 468,473 ****
--- 487,495 ----
  	   * simply remove the old original folder and that's it!
  	   */
  	  (void)unlink(cur_folder);
+ #ifdef SIGTSTP
+ 	  signal(SIGTSTP, oldstop);
+ #endif
  	  return(1);
  	}
  
***************
*** 610,615 ****
--- 632,640 ----
  	mailfile_size = bytes(cur_folder);
  	unlock();	/* remove the lock on the file ASAP! */
  
+ #ifdef SIGTSTP
+ 	signal(SIGTSTP, oldstop);
+ #endif
  	return(1);	
  }
  

Index: src/returnadd.c
Prereq: 4.1.1.2
*** ../elm2.3/src/returnadd.c	Wed Dec  5 23:42:09 1990
--- src/returnadd.c	Tue Dec 11 15:36:10 1990
***************
*** 1,8 ****
  
! static char rcsid[] = "@(#)$Id: returnadd.c,v 4.1.1.2 90/12/05 22:33:58 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.2 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
--- 1,8 ----
  
! static char rcsid[] = "@(#)$Id: returnadd.c,v 4.1.1.3 90/12/11 15:35:56 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.3 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
***************
*** 14,19 ****
--- 14,23 ----
   *
   *******************************************************************************
   * $Log:	returnadd.c,v $
+  * Revision 4.1.1.3  90/12/11  15:35:56  syd
+  * Add back missing  strlen line, fixes segv problem
+  * From: Syd
+  * 
   * Revision 4.1.1.2  90/12/05  22:33:58  syd
   * Fix missing close brace due to indention error
   * From: Syd
***************
*** 295,300 ****
--- 299,305 ----
  	      buf[len_buf] = '\0';
  	    }
  	    strncat(buf, buf2, (SLEN-len_buf-1));
+ 	    len_buf = strlen(buf);
  	    ok = (int) (fgets(buf2, SLEN, mailfile) != NULL);
  	    if (ok) {
  	      len_buf2 = strlen(buf2);

Index: utils/fastmail.c
Prereq: 4.1.1.2
*** ../elm2.3/utils/fastmail.c	Sun Oct  7 21:55:00 1990
--- utils/fastmail.c	Thu Dec  6 10:39:21 1990
***************
*** 1,8 ****
  
! static char rcsid[] = "@(#)$Id: fastmail.c,v 4.1.1.2 90/10/07 20:56:25 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.2 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
--- 1,8 ----
  
! static char rcsid[] = "@(#)$Id: fastmail.c,v 4.1.1.3 90/12/06 10:38:55 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.3 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
***************
*** 14,19 ****
--- 14,23 ----
   *
   *******************************************************************************
   * $Log:	fastmail.c,v $
+  * Revision 4.1.1.3  90/12/06  10:38:55  syd
+  * Fix getlogin returning null causing a core dump
+  * From: Nigel Metheringham <nigelm@ohm.york.ac.uk>
+  * 
   * Revision 4.1.1.2  90/10/07  20:56:25  syd
   * Add ifndef NO_XHEADER to X-Mailer
   * From: syd via request of Frank Elsner
***************
*** 101,106 ****
--- 105,111 ----
  	char filename[SLEN], tempfilename[SLEN], command_buffer[256];
  	char replyto[SLEN], cc_list[SLEN], bcc_list[SLEN], to_list[SLEN];
  	char from_addr[SLEN];
+ 	char *tmplogname;
  	int  c, sendmail_available, debug = 0;
  
  	from_string[0] = '\0';
***************
*** 156,162 ****
  	gethostname(hostname, sizeof(hostname));
  #endif
  
! 	strcpy(username, getlogin());
  
  	if (strlen(username) == 0)
  	  cuserid(username);
--- 161,171 ----
  	gethostname(hostname, sizeof(hostname));
  #endif
  
! 	tmplogname = getlogin();
! 	if (tmplogname != NULL)
! 	  strcpy(username, tmplogname);
! 	else
! 	  username[0] = '\0';
  
  	if (strlen(username) == 0)
  	  cuserid(username);

Index: utils/newalias.c
Prereq: 4.1.1.2
*** ../elm2.3/utils/newalias.c	Wed Aug 15 23:51:42 1990
--- utils/newalias.c	Thu Dec  6 10:24:07 1990
***************
*** 1,8 ****
  
! static char rcsid[] = "@(#)$Id: newalias.c,v 4.1.1.2 90/08/02 21:57:58 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.2 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
--- 1,8 ----
  
! static char rcsid[] = "@(#)$Id: newalias.c,v 4.1.1.3 90/12/06 10:23:22 syd Exp $";
  
  /*******************************************************************************
!  *  The Elm Mail System  -  $Revision: 4.1.1.3 $   $State: Exp $
   *
   * 			Copyright (c) 1986, 1987 Dave Taylor
   * 			Copyright (c) 1988, 1989, 1990 USENET Community Trust
***************
*** 14,19 ****
--- 14,23 ----
   *
   *******************************************************************************
   * $Log:	newalias.c,v $
+  * Revision 4.1.1.3  90/12/06  10:23:22  syd
+  * Prevent newalias from trying to process lines without two = signs
+  * From: Syd via report from integow!ronald
+  * 
   * Revision 4.1.1.2  90/08/02  21:57:58  syd
   * The newly introduced function 'stricmp' has a name conflict with a libc
   * function under SunOS 4.1.  Changed name to istrcmp.
***************
*** 234,239 ****
--- 238,254 ----
  	char comment[LONG_STRING], c;
  	int  first, last, i = 0, j = 0;
  
+ 	/* check for two = signs */
+ 	for (i = 0, j = 0; buffer[i]; i++)
+ 	    if (buffer[i] == '=')
+ 		j++;
+ 
+ 	if (j < 2) {
+ 	    printf("Error - alias data line is not in proper format:\n'%s'\n", buffer);
+ 	    error++;
+ 	    return;
+ 	}
+ 	 
  	remove_all(' ', TAB, buffer);
  
  	for (i=0; buffer[i] != '=' && i < LONG_STRING; i++)

-- 
=====================================================================
Sydney S. Weinstein, CDP, CCP                   Elm Coordinator
Datacomp Systems, Inc.                          Voice: (215) 947-9900
syd@DSI.COM or dsinc!syd                        FAX:   (215) 938-0235