From wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!cbmvax!vu-vlsi!dsinc!syd Tue Sep 19 20:04:42 CDT 1989 Article 1115 of comp.mail.elm: Path: wubios!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!cbmvax!vu-vlsi!dsinc!syd From: syd@DSI.COM (Syd Weinstein) Newsgroups: comp.mail.elm,comp.sources.bugs Subject: elm 2.2 Patch #11 Summary: This is an official patch for elm 2.2 system. Please apply it. Message-ID: <1989Sep15.205321.758@DSI.COM> Date: 15 Sep 89 20:53:21 GMT Organization: Datacomp Systems, Inc. Huntingdon Valley, PA Lines: 732 Xref: wubios comp.mail.elm:1115 comp.sources.bugs:56 Priority: MEDIUM Fix calling qsort when no headers to sort causing qsort on some systems to abort when passed a null. >From: edf@rocky.rockefeller.edu Special case nameof to not substitute ~ for the home directory if it is only one character long (/). >From: Jeffery Small Fixed arepdaem to not take signals by disassociating itself from the terminal. Also fixed not removing users when all are removed. >From: Syd Fix include files in filter/filter.c and filter/rules.c to honor TMINSYS. >From: Andrew Findlay Fixed arepdaem bug where autoreply file wasnt being closed (UB01) >From: Syd Fix newalias not to core dump if the line is too long. >From: Syd Fixed string lengths for consistency in file.c for use by get_existing_address, was causing a segv if the string was overwritten. Still possible to overwrite, but longer lenght reduces odds. >From: Chris Jackman Fix variable usage in get_return - wrong variable used for line count detection. >From: Laurenc Lundblade 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 #include #include ! #include #include #include "defs.h" --- 51,67 ---- #include #include #include ! #ifdef BSD ! # ifdef TMINSYS ! # include ! # else ! # include ! # include ! # include ! # endif ! #else ! # include ! #endif #include #include "defs.h" Index: filter/rules.c Prereq: 2.4 *** ../elm2.2/filter/rules.c Thu Mar 30 10:34:16 1989 --- filter/rules.c Thu Jul 13 14:15:33 1989 *************** *** 1,8 **** ! static char rcsid[] ="@(#)$Id: rules.c,v 2.4 89/03/25 21:45:17 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.4 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] ="@(#)$Id: rules.c,v 2.4.1.1 89/07/13 14:15:31 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.4.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: rules.c,v $ + * Revision 2.4.1.1 89/07/13 14:15:31 syd + * Fix time include file for TMINSYS checking + * From:Andrew Findlay + * * Revision 2.4 89/03/25 21:45:17 syd * Initial 2.2 Release checkin * *************** *** 28,34 **** #include #include #include ! #include #include #include "defs.h" --- 32,48 ---- #include #include #include ! #ifdef BSD ! # ifdef TMINSYS ! # include ! # else ! # include ! # include ! # include ! # endif ! #else ! # include ! #endif #include #include "defs.h" Index: src/file.c Prereq: 2.22 *** ../elm2.2/src/file.c Mon Jun 12 10:21:47 1989 --- src/file.c Fri Sep 15 16:39:51 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: file.c,v 2.22 89/05/30 16:03:09 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.22 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: file.c,v 2.22.1.1 89/09/15 16:39:24 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.22.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: file.c,v $ + * Revision 2.22.1.1 89/09/15 16:39:24 syd + * Make string lengths consistent for get_existing_address + * From: Chris Jackman + * * Revision 2.22 89/05/30 16:03:09 syd * remove sleep on appended to file save messages to try and reduce * tagged save time *************** *** 76,82 **** register int tagged = 0, i, oldstat, appending = 0; int mesgnum; /* message whose address is used for save-by-name fn */ ! char filename[SLEN], address[SLEN], buffer[SLEN]; static char helpmsg[LONG_STRING]; FILE *save_file; --- 80,86 ---- register int tagged = 0, i, oldstat, appending = 0; int mesgnum; /* message whose address is used for save-by-name fn */ ! char filename[SLEN], address[LONG_STRING], buffer[LONG_STRING]; static char helpmsg[LONG_STRING]; FILE *save_file; Index: src/help.c Prereq: 2.13 *** ../elm2.2/src/help.c Thu Mar 30 10:36:06 1989 --- src/help.c Fri Jun 23 21:28:11 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: help.c,v 2.13 89/03/25 21:46:26 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.13 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: help.c,v 2.13.1.1 89/06/23 21:26:06 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.13.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: help.c,v $ + * Revision 2.13.1.1 89/06/23 21:26:06 syd + * Fix problem with error message + * From: Benjamin G. Golding + * * Revision 2.13 89/03/25 21:46:26 syd * Initial 2.2 Release checkin * *************** *** 295,301 **** if ((fileptr = fopen(file,"r")) == NULL) { dprint(1, (debugfile, "Error: Couldn't open file %s (help)\n", file)); ! error1("Couldn't open file %s.",buffer); return(FALSE); } --- 299,305 ---- if ((fileptr = fopen(file,"r")) == NULL) { dprint(1, (debugfile, "Error: Couldn't open file %s (help)\n", file)); ! error1("Couldn't open file %s.",file); return(FALSE); } Index: src/returnadd.c Prereq: 2.8 *** ../elm2.2/src/returnadd.c Thu Mar 30 10:37:11 1989 --- src/returnadd.c Fri Sep 15 16:42:52 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: returnadd.c,v 2.8 89/03/25 21:47:08 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.8 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: returnadd.c,v 2.8.1.1 89/09/15 16:42:28 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.8.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: returnadd.c,v $ + * Revision 2.8.1.1 89/09/15 16:42:28 syd + * Fix use of wrong variable for new line check in returnadd + * From: Laurence Lundblade + * * Revision 2.8 89/03/25 21:47:08 syd * Initial 2.2 Release checkin * *************** *** 266,272 **** while (ok && lines) { ok = (int) (fgets(buf, SLEN, mailfile) != NULL); if (ok) ! if(buffer[strlen(buffer)-1] == '\n') lines--; /* got a full line */ if (first_word(buf, "From ")) sscanf(buf, "%*s %s", hold_return); else if (first_word(buf, ">From")) { --- 270,276 ---- while (ok && lines) { ok = (int) (fgets(buf, SLEN, mailfile) != NULL); if (ok) ! if(buf[strlen(buf)-1] == '\n') lines--; /* got a full line */ if (first_word(buf, "From ")) sscanf(buf, "%*s %s", hold_return); else if (first_word(buf, ">From")) { Index: src/sort.c Prereq: 2.7 *** ../elm2.2/src/sort.c Thu Mar 30 10:37:38 1989 --- src/sort.c Mon Jun 26 15:03:04 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: sort.c,v 2.7 89/03/25 21:47:26 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.7 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: sort.c,v 2.7.1.1 89/06/26 15:02:34 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.7.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: sort.c,v $ + * Revision 2.7.1.1 89/06/26 15:02:34 syd + * Dont call qsort when no entries to avoid qsort error when called with null + * From: edf@rocky2.rockefeller.edu + * * Revision 2.7 89/03/25 21:47:26 syd * Initial 2.2 Release checkin * *************** *** 52,58 **** if (entries > 30 && visible) error1("Sorting messages by %s...", sort_name(FULL)); ! qsort(headers, (unsigned) entries, sizeof (struct header_rec *), compare_headers); if (last_index > -1) --- 56,63 ---- if (entries > 30 && visible) error1("Sorting messages by %s...", sort_name(FULL)); ! if (entries > 1) ! qsort(headers, (unsigned) entries, sizeof (struct header_rec *), compare_headers); if (last_index > -1) Index: src/utils.c Prereq: 2.23 *** ../elm2.2/src/utils.c Mon Apr 24 20:04:09 1989 --- src/utils.c Wed Jul 5 17:35:25 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: utils.c,v 2.23 89/04/24 18:43:21 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.23 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: utils.c,v 2.23.1.1 89/07/05 17:35:04 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.23.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: utils.c,v $ + * Revision 2.23.1.1 89/07/05 17:35:04 syd + * Change nameof to not expand one character home directories (/) + * From: Jeffery Small + * * Revision 2.23 89/04/24 18:43:21 syd * This fixes a wrongly named variable (caused by copying a function and not * completing tailoring it to its new role). Found by Rob Healey. *************** *** 329,335 **** } } else if (strncmp(filename, home, strlen(home)) == 0) { ! if (strlen(home) > 0) { buffer[i++] = '~'; iindex = strlen(home); } --- 333,339 ---- } } else if (strncmp(filename, home, strlen(home)) == 0) { ! if (strlen(home) > 1) { buffer[i++] = '~'; iindex = strlen(home); } Index: utils/arepdaem.c Prereq: 2.6 *** ../elm2.2/utils/arepdaem.c Thu Mar 30 10:38:02 1989 --- utils/arepdaem.c Fri Jul 14 11:12:36 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: arepdaem.c,v 2.6 89/03/25 21:47:39 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.6 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: arepdaem.c,v 2.6.1.2 89/07/14 11:12:11 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.6.1.2 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,28 ---- * ******************************************************************************* * $Log: arepdaem.c,v $ + * Revision 2.6.1.2 89/07/14 11:12:11 syd + * Fix bug where reply file wasnt being closed + * From: Syd + * + * Revision 2.6.1.1 89/07/13 10:43:34 syd + * Fix signal problem, and not clearing in core cache when enrolled file + * is removed. + * From: Michael Katzmann, code by Syd + * * Revision 2.6 89/03/25 21:47:39 syd * Initial 2.2 Release checkin * *************** *** 109,114 **** --- 118,132 ---- if (fork()) exit(0); + /* + * note the usage of the BSD style setpgrp wont hurt + * system V as its calling sequence is no arguments. + * The idea is to disassociate from the terminal to + * prevent signals. + */ + person = getpid(); + setpgrp(person, person); + while (1) { logfd = open_logfile(); /* open the log */ *************** *** 164,197 **** log("Autoreply data file has changed! Reading..."); ! if ((file = fopen(autoreply_file,"r")) == NULL) { ! log("No-one is using autoreply..."); ! return(0); ! } ! for (person = 0; person < active; person++) reply_table[person].in_list = 0; ! ! while (fscanf(file, "%s %s %dl", username, replyfile, &size) != EOF) { ! /* check to see if this person is already in the list */ ! if ((person = in_list(username)) != -1) { ! reply_table[person].in_list = 1; ! reply_table[person].mailsize = size; /* sync */ ! } ! else { /* if not, add them */ ! if (active == MAX_PEOPLE) { ! unlock(); ! exit(log("Couldn't add %s - already at max people!", ! username)); } ! log("adding %s to the active list", username); ! strcpy(reply_table[active].username, username); ! sprintf(reply_table[active].mailfile, "%s%s", mailhome, username); ! strcpy(reply_table[active].replyfile, replyfile); ! reply_table[active].mailsize = size; ! reply_table[active].in_list = 1; /* obviously! */ ! active++; } } /** now check to see if anyone has been removed... **/ --- 182,218 ---- log("Autoreply data file has changed! Reading..."); ! /* ! * clear old entries prior to reread ! */ for (person = 0; person < active; person++) reply_table[person].in_list = 0; ! ! if ((file = fopen(autoreply_file,"r")) == NULL) { ! log("No-one is using autoreply..."); ! } else { ! while (fscanf(file, "%s %s %dl", username, replyfile, &size) != EOF) { ! /* check to see if this person is already in the list */ ! if ((person = in_list(username)) != -1) { ! reply_table[person].in_list = 1; ! reply_table[person].mailsize = size; /* sync */ } ! else { /* if not, add them */ ! if (active == MAX_PEOPLE) { ! unlock(); ! exit(log("Couldn't add %s - already at max people!", ! username)); ! } ! log("adding %s to the active list", username); ! strcpy(reply_table[active].username, username); ! sprintf(reply_table[active].mailfile, "%s%s", mailhome, username); ! strcpy(reply_table[active].replyfile, replyfile); ! reply_table[active].mailsize = size; ! reply_table[active].in_list = 1; /* obviously! */ ! active++; ! } } + fclose(file); } /** now check to see if anyone has been removed... **/ Index: utils/newalias.c Prereq: 2.7 *** ../elm2.2/utils/newalias.c Thu Mar 30 10:38:20 1989 --- utils/newalias.c Wed Aug 16 10:14:25 1989 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: newalias.c,v 2.7 89/03/25 21:47:53 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.7 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: newalias.c,v 2.7.1.1 89/08/16 10:14:14 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 2.7.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: newalias.c,v $ + * Revision 2.7.1.1 89/08/16 10:14:14 syd + * Fix core dump on long lines + * From: Syd + * * Revision 2.7 89/03/25 21:47:53 syd * Initial 2.2 Release checkin * *************** *** 251,257 **** /** read line from file. If first_line and buff_loaded, then just return! **/ ! int stat; if (first_line && buff_loaded) { buff_loaded = 1; --- 255,261 ---- /** read line from file. If first_line and buff_loaded, then just return! **/ ! int stat, len; if (first_line && buff_loaded) { buff_loaded = 1; *************** *** 262,269 **** stat = fgets(buffer, SLEN, file) == NULL ? -1 : 0; ! if (stat != -1) no_ret(buffer); return(stat); } --- 266,281 ---- stat = fgets(buffer, SLEN, file) == NULL ? -1 : 0; ! if (stat != -1) { ! len = strlen(buffer); ! if (len > 0) { ! if (buffer[len - 1] != '\n') { ! printf("Line too long, split using continuation line format (starting line\nwith whitespace):\n%s\n\n", buffer); ! exit(1); ! } ! } no_ret(buffer); + } return(stat); } -- ===================================================================== Sydney S. Weinstein, CDP, CCP Elm Coordinator Datacomp Systems, Inc. Voice: (215) 947-9900 syd@DSI.COM or {bpa,vu-vlsi}!dsinc!syd FAX: (215) 938-0235