Subject: elm 2.4 Patch #23d
Summary: This is an official patch for elm 2.4 system. Please apply it.
Priority: HIGH
THIS IS PART 4 OF A 5 PART PATCH
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:
Apply patches 23e next
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
[email protected]
The patches are available from the dsinc archive server
Send the following message to
[email protected] for
a list of available patches:
Subject: patch list
send index elm
Index: src/elm.c
Prereq: 5.14
*** ../elm2.4/src/elm.c Mon May 31 15:32:20 1993
--- src/elm.c Sun Sep 19 19:46:01 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: elm.c,v 5.14 1993/05/31 19:32:20 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.14 $ $State: Exp $
*
* This file and all associated files and documentation:
* Copyright (c) 1988-1992 USENET Community Trust
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: elm.c,v 5.16 1993/09/19 23:46:00 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.16 $ $State: Exp $
*
* This file and all associated files and documentation:
* Copyright (c) 1988-1992 USENET Community Trust
***************
*** 15,20 ****
--- 15,37 ----
*
*******************************************************************************
* $Log: elm.c,v $
+ * Revision 5.16 1993/09/19 23:46:00 syd
+ * Although it doesnt solve the limit/resync problem of new
+ * messages, allow them to be accessed anyway.
+ * From:
[email protected]
+ *
+ * Revision 5.15 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.14 1993/05/31 19:32:20 syd
* With this patch build_address() should treat local mailing
* lists and other aliases known by the transport agent as valid
***************
*** 103,112 ****
#endif
#ifdef BSD
# include <sys/timeb.h>
-
- #undef toupper
- #undef tolower
-
#endif
long bytes();
--- 120,125 ----
***************
*** 199,204 ****
--- 212,220 ----
clear_error();
header_page = pageon;
+ if (selected) /* update count of selected messages */
+ selected += message_count - last_in_folder;
+
if (on_page(current)) /* do we REALLY have to rewrite? */
showscreen();
else {
Index: src/expires.c
Prereq: 5.2
*** ../elm2.4/src/expires.c Sun Dec 6 21:59:02 1992
--- src/expires.c Tue Aug 10 14:53:31 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: expires.c,v 5.2 1992/12/07 02:58:56 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: expires.c,v 5.4 1993/08/10 18:53:31 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,36 ----
*
*******************************************************************************
* $Log: expires.c,v $
+ * Revision 5.4 1993/08/10 18:53:31 syd
+ * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
+ * some reads of unitialized memory.
+ * From:
[email protected]
+ *
+ * Revision 5.3 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.2 1992/12/07 02:58:56 syd
* Fix long -> time_t
* From: Syd
***************
*** 39,51 ****
# include <sys/time.h>
#endif
- #include <ctype.h>
-
- #ifdef BSD
- #undef toupper
- #undef tolower
- #endif
-
process_expiration_date(date, message_status)
char *date;
int *message_status;
--- 56,61 ----
***************
*** 53,59 ****
struct tm *timestruct;
time_t thetime;
char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN], word5[WLEN];
! int month = 0, day = 0, year = 0, hour = 0, minute = 0;
#ifndef _POSIX_SOURCE
struct tm *localtime();
time_t time();
--- 63,69 ----
struct tm *timestruct;
time_t thetime;
char word1[WLEN], word2[WLEN], word3[WLEN], word4[WLEN], word5[WLEN];
! int month = 0, day = 0, year = 0, hour = 0, minute = 0, items;
#ifndef _POSIX_SOURCE
struct tm *localtime();
time_t time();
***************
*** 77,84 ****
so is the first field the month or the day? Standard prob.
**/
! sscanf(date, "%s %s %s %s %s",
! word1, word2, word3, word4, word5);
if (strlen(word5) != 0) { /* we have form #7 */
day = atoi(word1);
--- 87,105 ----
so is the first field the month or the day? Standard prob.
**/
! items = sscanf(date, "%s %s %s %s %s",
! word1, word2, word3, word4, word5);
!
! if (items < 5)
! word5[0] = '\0';
! if (items < 4)
! word4[0] = '\0';
! if (items < 3)
! word3[0] = '\0';
! if (items < 2)
! word2[0] = '\0';
! if (items < 1)
! word1[0] = '\0';
if (strlen(word5) != 0) { /* we have form #7 */
day = atoi(word1);
Index: src/file.c
Prereq: 5.20
*** ../elm2.4/src/file.c Thu May 13 23:57:38 1993
--- src/file.c Tue Aug 3 15:29:06 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: file.c,v 5.20 1993/05/14 03:57:36 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.20 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: file.c,v 5.21 1993/08/03 19:28:39 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.21 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,31 ----
*
*******************************************************************************
* $Log: file.c,v $
+ * Revision 5.21 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.20 1993/05/14 03:57:36 syd
* A couple of calls to want_to() had typos. Here is the patch.
* From: Jukka Ukkonen <
[email protected]>
***************
*** 139,151 ****
#endif
#include "s_elm.h"
- #include <ctype.h>
#include <errno.h>
- #ifdef BSD
- #undef tolower
- #endif
-
extern int errno;
char *nameof();
--- 151,158 ----
Index: src/file_util.c
Prereq: 5.6
*** ../elm2.4/src/file_util.c Wed Feb 3 14:06:48 1993
--- src/file_util.c Sun Sep 26 21:51:57 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: file_util.c,v 5.6 1993/02/03 19:06:31 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.6 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: file_util.c,v 5.10 1993/09/27 01:51:38 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,46 ----
*
*******************************************************************************
* $Log: file_util.c,v $
+ * Revision 5.10 1993/09/27 01:51:38 syd
+ * Add elm_chown to consolidate for Xenix not allowing -1
+ * From: Syd
+ *
+ * Revision 5.9 1993/09/19 23:37:29 syd
+ * I found a few places more where the code was missing a call
+ * to fflush() before it called unlock() and fclose()/exit()
+ * right after unlocking the mail drop.
+ * From: Jukka Ukkonen <
[email protected]>
+ *
+ * Revision 5.8 1993/08/23 03:26:24 syd
+ * Try setting group id separate from user id in chown to
+ * allow restricted systems to change group id of file
+ * From: Syd
+ *
+ * Revision 5.7 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.6 1993/02/03 19:06:31 syd
* Remove extra strchr/strcat/strcpy et al declarations
* From: Syd
***************
*** 49,61 ****
#include "headers.h"
#include "s_elm.h"
#include <sys/stat.h>
- #include <ctype.h>
- #include <errno.h>
-
- #ifdef BSD
- # undef tolower
- #endif
-
#include <errno.h>
#ifdef BSD
--- 76,81 ----
***************
*** 112,151 ****
FILE *from_file, *to_file;
char buffer[VERY_LONG_STRING];
int len;
!
if ((from_file = fopen(from, "r")) == NULL) {
! dprint(1, (debugfile, "Error: could not open %s for reading (copy)\n",
! from));
! error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
! "Could not open file %s."), from);
! return(1);
}
if ((to_file = fopen(to, "w")) == NULL) {
! dprint(1, (debugfile, "Error: could not open %s for writing (copy)\n",
! to));
! error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
! "Could not open file %s."), to);
! return(1);
}
! while (len = fread(buffer, 1, VERY_LONG_STRING, from_file))
! if (fwrite(buffer, 1, len, to_file) != len) {
! Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopy,
! "\n\rWrite failed to temp file in copy\n\r"), 0);
! perror(to);
! fclose(to_file);
! fclose(from_file);
! return(1);
! }
fclose(from_file);
! if (fclose(to_file) == EOF) {
! Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCloseFailedCopy,
! "\n\rClose failed on temp file in copy\n\r"), 0);
! perror(to);
! return(1);
}
! chown( to, userid, groupid);
return(0);
}
--- 132,183 ----
FILE *from_file, *to_file;
char buffer[VERY_LONG_STRING];
int len;
!
! dprint (1, (debugfile, "Copy: from='%s' to='%s'\n", from, to));
!
if ((from_file = fopen(from, "r")) == NULL) {
! dprint(1, (debugfile, "Error: could not open %s for reading (copy)\n",
! from));
! error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
! "Could not open file %s."), from);
! return(1);
}
if ((to_file = fopen(to, "w")) == NULL) {
! dprint(1, (debugfile, "Error: could not open %s for writing (copy)\n",
! to));
! error1(catgets(elm_msg_cat, ElmSet, ElmCouldNotOpenFile,
! "Could not open file %s."), to);
! return(1);
}
! while (len = fread(buffer, 1, VERY_LONG_STRING, from_file)) {
! if (fwrite(buffer, 1, len, to_file) != len) {
! Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmWriteFailedCopy,
! "\n\rWrite failed to temp file in copy\n\r"), 0);
! perror(to);
! /*
! * NEVER close anything just at whim!!
! * If the file has been locked using fcntl() or lockf()
! * YOU WILL DROP ALL LOCKS refering to the file.
! */
! fflush(to_file);
! fclose(to_file);
! fclose(from_file);
! return(1);
! }
! }
!
fclose(from_file);
! fflush(to_file);
!
! if (fclose(to_file) == EOF) {
! Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmCloseFailedCopy,
! "\n\rClose failed on temp file in copy\n\r"), 0);
! perror(to);
! return(1);
}
! (void) elm_chown( to, userid, groupid);
return(0);
}
Index: src/fileio.c
Prereq: 5.8
*** ../elm2.4/src/fileio.c Mon Feb 8 13:38:12 1993
--- src/fileio.c Sun Sep 26 21:51:58 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: fileio.c,v 5.8 1993/02/08 18:38:12 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.8 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: fileio.c,v 5.14 1993/09/27 01:51:38 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.14 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,52 ----
*
*******************************************************************************
* $Log: fileio.c,v $
+ * Revision 5.14 1993/09/27 01:51:38 syd
+ * Add elm_chown to consolidate for Xenix not allowing -1
+ * From: Syd
+ *
+ * Revision 5.13 1993/09/19 23:15:52 syd
+ * Here's some more patch stuff for undersize buffers for header lines.
+ * From: Jukka Ukkonen <
[email protected]>
+ *
+ * Revision 5.12 1993/08/23 12:28:23 syd
+ * Fix placement of ifdef for PC_CHOWN
+ * From: syd
+ *
+ * Revision 5.11 1993/08/23 03:26:24 syd
+ * Try setting group id separate from user id in chown to
+ * allow restricted systems to change group id of file
+ * From: Syd
+ *
+ * Revision 5.10 1993/08/10 20:29:52 syd
+ * add PC_CHOWN_RESTRICTED where needed
+ * From: Syd
+ *
+ * Revision 5.9 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.8 1993/02/08 18:38:12 syd
* Fix to copy_file to ignore unescaped from if content_length not yet reached.
* Fixes to NLS messages match number of newlines between default messages
***************
*** 60,72 ****
#include "headers.h"
#include "s_elm.h"
#include <sys/stat.h>
- #include <ctype.h>
#include <errno.h>
- #ifdef BSD
- #undef tolower
- #endif
-
extern int errno;
char *error_description();
--- 93,100 ----
***************
*** 106,112 ****
else just copy it as it is.
**/
! char buffer[SLEN];
register struct header_rec *current_header = headers[current-1];
register int lines, front_line, next_front,
in_header = 1, first_line = TRUE, ignoring = FALSE;
--- 134,147 ----
else just copy it as it is.
**/
! /*
! * Changed buffer[SLEN] to buffer[VERY_LONG_STRING] to make it
! * big enough to contain a full length header line. Any header
! * is allowed to be at least 1024 bytes in length. (r.t.f. RFC)
! * 14-Sep-1993 Jukka Ukkonen <
[email protected]>
! */
!
! char buffer[VERY_LONG_STRING];
register struct header_rec *current_header = headers[current-1];
register int lines, front_line, next_front,
in_header = 1, first_line = TRUE, ignoring = FALSE;
***************
*** 151,157 ****
next_front = TRUE;
while (lines) {
! if ((buf_len = mail_gets(buffer, SLEN, mailfile)) == 0)
break;
bytes_seen += buf_len;
--- 186,192 ----
next_front = TRUE;
while (lines) {
! if (! (buf_len = mail_gets(buffer, VERY_LONG_STRING, mailfile)))
break;
bytes_seen += buf_len;
***************
*** 362,368 ****
}
static struct stat saved_buf;
! static char saved_fname[SLEN];
int
save_file_stats(fname)
--- 397,410 ----
}
static struct stat saved_buf;
!
! /*
! * Don't take chances that a file name is really longer than SLEN.
! * You'll just pollute the memory right after the allocated space
! * if you have MAXPATHLEN of 1024 (_PATH_MAX in POSIX).
! */
!
! static char saved_fname[VERY_LONG_STRING];
int
save_file_stats(fname)
***************
*** 427,440 ****
/*
* Chown is restricted to root on BSD unix
*/
! (void) chown(fname, new_owner, new_group);
#else
! if((i = chown(fname, new_owner, new_group)) == -1)
! ret_code = -1;
!
! dprint(2, (debugfile, "** chown(%s, %d, %d) returns %d [errno=%d] **\n",
! fname, new_owner, new_group, i, errno));
! #endif
return(ret_code);
--- 469,495 ----
/*
* Chown is restricted to root on BSD unix
*/
! (void) elm_chown(fname, new_owner, new_group);
#else
! # ifdef _PC_CHOWN_RESTRICTED
! /*
! * Chown may or may not be restricted to root in SVR4, if it is,
! * then need to copy must be true, and no restore of permissions
! * should be performed.
! */
! if (!pathconf(fname, _PC_CHOWN_RESTRICTED)) {
! # endif
! if((i = elm_chown(fname, new_owner, new_group)) == -1)
! ret_code = -1;
!
! dprint(2, (debugfile, "** elm_chown(%s, %d, %d) returns %d [errno=%d] **\n",
! fname, new_owner, new_group, i, errno));
! # ifdef _PC_CHOWN_RESTRICTED
! } else {
! (void) elm_chown(fname, new_owner, new_group);
! }
! # endif /* _PC_CHOWN_RESTRICTED */
! #endif /* BSD */
return(ret_code);
***************
*** 452,465 ****
'hidden users' on the system.
**/
! FILE *hidden_users;
! char buffer[SLEN];
! /*
this line is deliberately inserted to ensure that you THINK
about what you're doing, and perhaps even contact the author
of Elm before you USE this option...
! */
if ((hidden_users = fopen (HIDDEN_SITE_USERS,"r")) == NULL) {
dprint(1, (debugfile,
--- 507,520 ----
'hidden users' on the system.
**/
! FILE *hidden_users;
! char buffer[VERY_LONG_STRING];
! /*
this line is deliberately inserted to ensure that you THINK
about what you're doing, and perhaps even contact the author
of Elm before you USE this option...
! */
if ((hidden_users = fopen (HIDDEN_SITE_USERS,"r")) == NULL) {
dprint(1, (debugfile,
Index: src/forms.c
Prereq: 5.3
*** ../elm2.4/src/forms.c Wed Feb 3 14:06:48 1993
--- src/forms.c Tue Aug 3 15:10:22 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: forms.c,v 5.3 1993/02/03 19:06:31 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: forms.c,v 5.4 1993/08/03 19:10:22 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,24 ----
*
*******************************************************************************
* $Log: forms.c,v $
+ * Revision 5.4 1993/08/03 19:10:22 syd
+ * The last character of a form field gets zapped if more characters than
+ * the field expects are entered.
+ * From:
[email protected] (Dave Wolfe)
+ *
* Revision 5.3 1993/02/03 19:06:31 syd
* Remove extra strchr/strcat/strcpy et al declarations
* From: Syd
***************
*** 399,403 ****
fgets(buffer, SLEN, stdin);
no_ret(buffer);
! if (strlen(buffer) > field_size) buffer[field_size-1] = '\0';
}
--- 404,408 ----
fgets(buffer, SLEN, stdin);
no_ret(buffer);
! if (strlen(buffer) > field_size) buffer[field_size] = '\0';
}
Index: src/hdrconfg.c
Prereq: 5.2
*** ../elm2.4/src/hdrconfg.c Sat Nov 21 20:15:16 1992
--- src/hdrconfg.c Tue Aug 3 15:29:09 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: hdrconfg.c,v 5.2 1992/11/22 01:15:15 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.2 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: hdrconfg.c,v 5.3 1993/08/03 19:28:39 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,31 ----
*
*******************************************************************************
* $Log: hdrconfg.c,v $
+ * Revision 5.3 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.2 1992/11/22 01:15:15 syd
* Add on initial display or display where the entire screen is being
* drawn, we should not output the trailing blanks that clear the old
***************
*** 47,59 ****
#include "headers.h"
#include "s_elm.h"
- #include <ctype.h>
-
- #ifdef BSD
- #undef toupper
- #undef tolower
- #endif
-
/*
* Placement of prompts and messages at the bottom of the screen.
*/
--- 59,64 ----
***************
*** 572,578 ****
c = getchar();
! switch ((int)(isupper(c) ? tolower(c) : c)) {
case 't':
h = &hmenu_to;
break;
--- 577,583 ----
c = getchar();
! switch (tolower(c)) {
case 't':
h = &hmenu_to;
break;
Index: src/help.c
Prereq: 5.3
*** ../elm2.4/src/help.c Sun Apr 11 23:15:49 1993
--- src/help.c Tue Aug 3 15:29:09 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: help.c,v 5.3 1993/04/12 03:15:41 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.3 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: help.c,v 5.4 1993/08/03 19:28:39 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.4 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,31 ----
*
*******************************************************************************
* $Log: help.c,v $
+ * Revision 5.4 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.3 1993/04/12 03:15:41 syd
* These patches makes 'T' (since it was free) do a Tag and Move command in the
* index and alias page, and in the builtin pager.
***************
*** 35,41 ****
***/
- #include <ctype.h>
#include "headers.h"
#include "s_elm.h"
--- 47,52 ----
Index: src/in_utils.c
Prereq: 5.11
*** ../elm2.4/src/in_utils.c Sun May 16 16:56:19 1993
--- src/in_utils.c Tue Aug 3 15:29:10 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: in_utils.c,v 5.11 1993/05/16 20:56:18 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.11 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: in_utils.c,v 5.13 1993/08/03 19:28:39 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.13 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,38 ----
*
*******************************************************************************
* $Log: in_utils.c,v $
+ * Revision 5.13 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.12 1993/08/03 19:10:50 syd
+ * Patch for Elm 2.4 PL22 to correct handling of SIGWINCH signals on
+ * DecStations with Ultrix 4.2.
+ * The problem was that elm running in an xterm exits silently when the
+ * window is resize. This was caused by incorrect signal handling for BSD.
+ * From:
[email protected]
+ *
* Revision 5.11 1993/05/16 20:56:18 syd
* fix want-to patch collision
* From: Jukka Ukkonen <
[email protected]>
***************
*** 84,94 ****
#include "headers.h"
#include "s_elm.h"
#include <errno.h>
- #include <ctype.h>
-
- #ifdef BSD
- # undef tolower
- #endif
extern int errno; /* system error number */
--- 103,108 ----
***************
*** 572,579 ****
alarm((unsigned) 0);
}
}
! else
! ch = ReadCh();
#else
errno = 0; /* we actually have to do this. *sigh* */
ch = ReadCh();
--- 586,595 ----
alarm((unsigned) 0);
}
}
! else {
! ch = ReadCh();
! if (errno == EINTR) ch = NO_OP_COMMAND;
! }
#else
errno = 0; /* we actually have to do this. *sigh* */
ch = ReadCh();
Index: src/init.c
Prereq: 5.16
*** ../elm2.4/src/init.c Sun Apr 11 23:30:24 1993
--- src/init.c Sun Sep 26 21:51:59 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: init.c,v 5.16 1993/04/12 03:30:23 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.16 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: init.c,v 5.19 1993/09/27 01:51:38 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.19 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,40 ----
*
*******************************************************************************
* $Log: init.c,v $
+ * Revision 5.19 1993/09/27 01:51:38 syd
+ * Add elm_chown to consolidate for Xenix not allowing -1
+ * From: Syd
+ *
+ * Revision 5.18 1993/08/23 03:26:24 syd
+ * Try setting group id separate from user id in chown to
+ * allow restricted systems to change group id of file
+ * From: Syd
+ *
+ * Revision 5.17 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.16 1993/04/12 03:30:23 syd
* On AIX, __STDC__ is not defined but it does use unistd.h, etc. In
* hdrs/def.h, ANS_C already gets defined if __STDC__ or _AIX. But this
***************
*** 128,141 ****
# include <sys/time.h>
#endif
- #include <ctype.h>
#include <errno.h>
- #ifdef BSD
- #undef toupper
- #undef tolower
- #endif
-
extern int errno; /* system error number on failure */
extern char version_buff[];
--- 149,156 ----
***************
*** 273,279 ****
"Could not open file %s for debug output!\n"),
filename));
}
! chown(filename, userid, groupid); /* file owned by user */
fprintf(debugfile,
"Debug output of the ELM program (at debug level %d). Version %s\n\n",
--- 288,294 ----
"Could not open file %s for debug output!\n"),
filename));
}
! (void) elm_chown(filename, userid, groupid); /* file owned by user */
fprintf(debugfile,
"Debug output of the ELM program (at debug level %d). Version %s\n\n",
Index: src/leavembox.c
Prereq: 5.17
*** ../elm2.4/src/leavembox.c Mon May 31 15:47:59 1993
--- src/leavembox.c Sun Sep 26 21:52:00 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: leavembox.c,v 5.17 1993/05/31 19:47:45 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.17 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: leavembox.c,v 5.20 1993/09/27 01:51:38 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.20 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,33 ----
*
*******************************************************************************
* $Log: leavembox.c,v $
+ * Revision 5.20 1993/09/27 01:51:38 syd
+ * Add elm_chown to consolidate for Xenix not allowing -1
+ * From: Syd
+ *
+ * Revision 5.19 1993/08/23 03:26:24 syd
+ * Try setting group id separate from user id in chown to
+ * allow restricted systems to change group id of file
+ * From: Syd
+ *
+ * Revision 5.18 1993/08/03 19:59:49 syd
+ * Check for chown restricted and if so, do copyover and
+ * back to avoid need for chown
+ * From: Syd
+ *
* Revision 5.17 1993/05/31 19:47:45 syd
* change is_symlink to no_restore and use it for special modes as well
* From: Syd
***************
*** 542,548 ****
}
fclose(temp);
dprint(2, (debugfile, "\n\n"));
! chown(recvd_mail, userid, groupid);
}
/* If there are any messages to keep, first copy them to a
--- 556,562 ----
}
fclose(temp);
dprint(2, (debugfile, "\n\n"));
! (void) elm_chown(recvd_mail, userid, groupid);
}
/* If there are any messages to keep, first copy them to a
***************
*** 689,694 ****
--- 703,722 ----
}
#endif
+ #ifdef _PC_CHOWN_RESTRICTED
+ if (!need_to_copy) {
+ /*
+ * Chown may or may not be restricted to root in SVR4, if it is,
+ * then need to copy must be true, and no restore of permissions
+ * should be performed.
+ */
+ if (pathconf(cur_folder, _PC_CHOWN_RESTRICTED)) {
+ need_to_copy = TRUE;
+ no_restore = TRUE;
+ }
+ }
+ #endif /* _PC_CHOWN_RESTRICTED */
+
#ifdef SAVE_GROUP_MAILBOX_ID
if (folder_type == SPOOL)
setgid(mailgroupid);
Index: src/mailmsg1.c
Prereq: 5.6
*** ../elm2.4/src/mailmsg1.c Sat May 8 16:25:42 1993
--- src/mailmsg1.c Mon Jul 19 22:46:14 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: mailmsg1.c,v 5.6 1993/05/08 20:25:33 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.6 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: mailmsg1.c,v 5.7 1993/07/20 02:46:14 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.7 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,23 ----
*
*******************************************************************************
* $Log: mailmsg1.c,v $
+ * Revision 5.7 1993/07/20 02:46:14 syd
+ * Handle reply-to in batch mode.
+ * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
+ *
* Revision 5.6 1993/05/08 20:25:33 syd
* Add sleepmsg to control transient message delays
* From: Syd
***************
*** 207,212 ****
--- 211,217 ----
**/
int copy_msg = FALSE, is_a_response = FALSE;
+ char *p;
/* First: zero all current global message strings */
***************
*** 215,233 ****
expanded_to[0] = expanded_cc[0] = expanded_bcc[0] = '\0';
expanded_reply_to[0] = precedence[0] = expires_days[0] = '\0';
! strcpy(subject, given_subject); /* copy given subject */
! strcpy(to, given_to); /* copy given to: */
! strcpy(cc, given_cc); /* and so on.. */
/******* And now the real stuff! *******/
! copy_msg=copy_the_msg(&is_a_response); /* copy msg into edit buffer? */
! if (get_to(to, expanded_to) == 0) /* get the To: address and expand */
return(0);
! if ( cc[0] != '\0' ) /* expand out CC addresses */
build_address(strip_commas(cc), expanded_cc);
/** if we're batchmailing, let's send it and GET OUTTA HERE! **/
if (batch_only) {
--- 220,251 ----
expanded_to[0] = expanded_cc[0] = expanded_bcc[0] = '\0';
expanded_reply_to[0] = precedence[0] = expires_days[0] = '\0';
! /* Then: fill in default values for some fields */
!
! strcpy(subject, given_subject);
! strcpy(to, given_to);
! strcpy(cc, given_cc);
!
! if ((p = getenv("REPLYTO")) != NULL)
! strcpy(reply_to, p);
/******* And now the real stuff! *******/
! /* copy msg into edit buffer? */
! copy_msg = copy_the_msg(&is_a_response);
! /* get the To: address and expand */
! if (! get_to(to, expanded_to))
return(0);
!
! /* expand the Cc: address */
! if (cc[0])
build_address(strip_commas(cc), expanded_cc);
+ /* expand the Reply-To: address */
+ if (reply_to[0])
+ build_address(strip_commas(reply_to), expanded_reply_to);
+
/** if we're batchmailing, let's send it and GET OUTTA HERE! **/
if (batch_only) {
Index: src/mailmsg2.c
Prereq: 5.30
*** ../elm2.4/src/mailmsg2.c Sun Jun 6 14:24:48 1993
--- src/mailmsg2.c Sun Sep 26 21:52:02 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.30 1993/06/06 17:53:06 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.30 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 5.35 1993/09/27 01:51:38 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.35 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,49 ----
*
*******************************************************************************
* $Log: mailmsg2.c,v $
+ * Revision 5.35 1993/09/27 01:51:38 syd
+ * Add elm_chown to consolidate for Xenix not allowing -1
+ * From: Syd
+ *
+ * Revision 5.34 1993/08/23 03:26:24 syd
+ * Try setting group id separate from user id in chown to
+ * allow restricted systems to change group id of file
+ * From: Syd
+ *
+ * Revision 5.33 1993/08/10 18:53:31 syd
+ * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
+ * some reads of unitialized memory.
+ * From:
[email protected]
+ *
+ * Revision 5.32 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.31 1993/07/20 01:47:47 syd
+ * Fix time() declaration
+ * From: Syd via prompt from Dan Mosedale
+ *
* Revision 5.30 1993/06/06 17:53:06 syd
* Remove extranious clear
* From: Chip
***************
*** 189,200 ****
#include "headers.h"
#include "s_elm.h"
#include <errno.h>
- #include <ctype.h>
-
- #ifdef BSD
- #undef tolower
- #undef toupper
- #endif
extern int errno;
extern char version_buff[];
--- 219,224 ----
***************
*** 331,337 ****
return(need_redraw);
}
! chown (filename, userid, groupid);
/* copy the message from standard input */
if (batch_only) {
--- 355,361 ----
return(need_redraw);
}
! (void) elm_chown(filename, userid, groupid);
/* copy the message from standard input */
if (batch_only) {
***************
*** 612,618 ****
mailer, mailerflags, expanded_to, whole_msg_file,
remove_cmd, whole_msg_file);
}
!
fclose(reply);
if(batch_only) {
--- 636,644 ----
mailer, mailerflags, expanded_to, whole_msg_file,
remove_cmd, whole_msg_file);
}
!
! free(whole_msg_file);
!
fclose(reply);
if(batch_only) {
***************
*** 955,961 ****
**/
char opentype[3];
! long time(), thetime;
char *ctime();
static FILE *filedesc; /* our friendly file descriptor */
char to_buf[VERY_LONG_STRING];
--- 981,987 ----
**/
char opentype[3];
! time_t time(), thetime;
char *ctime();
static FILE *filedesc; /* our friendly file descriptor */
char to_buf[VERY_LONG_STRING];
Index: src/mime.c
Prereq: 5.10
*** ../elm2.4/src/mime.c Thu May 13 23:56:20 1993
--- src/mime.c Sun Aug 22 22:55:06 1993
***************
*** 1,5 ****
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
+
+ static char rcsid[] = "@(#)$Id: mime.c,v 5.15 1993/08/23 02:55:05 syd Exp $";
+
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.15 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 11,16 ****
--- 14,66 ----
*
******************************************************************************
* $Log: mime.c,v $
+ * Revision 5.15 1993/08/23 02:55:05 syd
+ * Add missing parens
+ * From:
[email protected] (Dave Wolfe)
+ *
+ * Revision 5.14 1993/08/10 18:53:31 syd
+ * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
+ * some reads of unitialized memory.
+ * From:
[email protected]
+ *
+ * Revision 5.13 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.12 1993/07/20 02:41:24 syd
+ * Three changes to expand_env() in src/read_rc.c: make it non-destructive,
+ * have it return an error code instead of bailing out, and add a buffer
+ * size argument to avoid overwritting the destination. The first is to
+ * avoid all of the gymnastics Elm needed to go through (and occasionally
+ * forgot to go through) to protect the value handed to expand_env().
+ * The second is because expand_env() was originally written to support
+ * "elmrc" and bailing out was a reasonable thing to do there -- but not
+ * in the other places where it has since been used. The third is just
+ * a matter of practicing safe source code.
+ *
+ * This patch changes all invocations to expand_env() to eliminate making
+ * temporary copies (now that the routine is non-destructive) and to pass
+ * in a destination length. Since expand_env() no longer bails out on
+ * error, a do_expand_env() routine was added to src/read_rc.c handle
+ * this. Moreover, the error message now gives some indication of what
+ * the problem is rather than just saying "can't expand".
+ *
+ * Gratitous change to src/editmsg.c renaming filename variables to
+ * clarify the purpose.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.11 1993/06/10 03:12:10 syd
+ * Add missing rcs id lines
+ * From: Syd
+ *
* Revision 5.10 1993/05/14 03:56:19 syd
* A MIME body-part must end with a newline even when there was no newline
* at the end of the actual body or the body is null. Otherwise the next
***************
*** 73,79 ****
#ifdef MIME
#include <errno.h>
- #include <ctype.h>
#include <sys/stat.h>
int check_for_multipart(filedesc)
--- 123,128 ----
***************
*** 148,154 ****
sleep(sleepmsg);
return(-1);
}
! expand_env(Expanded_Filename, Include_Filename);
if (strlen(Content_Type) == 0) {
Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoContentTypeGiven,
--- 197,203 ----
sleep(sleepmsg);
return(-1);
}
! (void) expand_env(Expanded_Filename, Include_Filename, sizeof(Expanded_Filename));
if (strlen(Content_Type) == 0) {
Write_to_screen(catgets(elm_msg_cat, ElmSet, ElmNoContentTypeGiven,
***************
*** 272,278 ****
if (!s) return(1);
while (*s && isspace(*s)) ++s;
t = buf;
! while (*s && !isspace(*s) && ((t-buf) < SLEN)) *t++ = *s++;
EncType = check_encoding(buf);
if ((EncType == ENCODING_NONE) ||
(EncType == ENCODING_7BIT) ||
--- 321,328 ----
if (!s) return(1);
while (*s && isspace(*s)) ++s;
t = buf;
! while (*s && !isspace(*s) && ((t-buf) < (SLEN-1))) *t++ = *s++;
! *t = '\0';
EncType = check_encoding(buf);
if ((EncType == ENCODING_NONE) ||
(EncType == ENCODING_7BIT) ||
Index: src/newmbox.c
Prereq: 5.26
*** ../elm2.4/src/newmbox.c Thu May 13 23:55:14 1993
--- src/newmbox.c Sun Sep 26 21:52:06 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: newmbox.c,v 5.26 1993/05/14 03:55:13 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.26 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: newmbox.c,v 5.34 1993/09/27 01:51:38 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.34 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,63 ----
*
*******************************************************************************
* $Log: newmbox.c,v $
+ * Revision 5.34 1993/09/27 01:51:38 syd
+ * Add elm_chown to consolidate for Xenix not allowing -1
+ * From: Syd
+ *
+ * Revision 5.33 1993/09/19 23:38:16 syd
+ * Erroneous Content-Length:s that ended up beyond the end of the folder
+ * wasn't checked for, so the rest of the folder became one big message.
+ * From:
[email protected] (Jan Djarv)
+ *
+ * Revision 5.32 1993/09/19 23:32:35 syd
+ * Fix a code portability problem with Convex.
+ * From: Jukka Ukkonen <
[email protected]>
+ *
+ * Revision 5.31 1993/09/19 23:15:28 syd
+ * Changed a few buffers from LONG_STRING (512) to VERY_LONG_STRING
+ * to avoid long header lines overflowing the allocated space. At
+ * least 1024 bytes should be allowed in any header line/field.
+ * From: Jukka Ukkonen <
[email protected]>
+ *
+ * Revision 5.30 1993/08/23 03:26:24 syd
+ * Try setting group id separate from user id in chown to
+ * allow restricted systems to change group id of file
+ * From: Syd
+ *
+ * Revision 5.29 1993/08/23 02:46:51 syd
+ * Test ANSI_C, not __STDC__ (which is not set on e.g. AIX).
+ * From: decwrl!uunet.UU.NET!fin!chip (Chip Salzenberg)
+ *
+ * Revision 5.28 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.27 1993/07/20 15:32:36 syd
+ * no dprint should be at level 0
+ * From: Syd
+ *
* Revision 5.26 1993/05/14 03:55:13 syd
* The recent feature addition for the "readmsginc" variable did not modify
* the output statement that is used when MMDF is defined. The following
***************
*** 144,157 ****
/** read new folder **/
- #include <ctype.h>
#include "headers.h"
#include "s_elm.h"
- #ifdef BSD
- #undef tolower /* we have our own "tolower" routine instead! */
- #endif
-
#include <sys/stat.h>
#include <errno.h>
--- 188,196 ----
***************
*** 166,172 ****
char *error_description();
long bytes();
! #ifndef __STDC__ /* avoid problemswith systems that declare atol as a macro */
extern void rewind();
extern long atol();
#endif
--- 205,211 ----
char *error_description();
long bytes();
! #ifndef ANSI_C /* avoid problems with systems that declare atol as a macro */
extern void rewind();
extern long atol();
#endif
***************
*** 361,367 ****
FILE *temp;
struct header_rec *current_header = NULL;
! char buffer[LONG_STRING], tbuffer[LONG_STRING], *c;
long fbytes = 0L, line_bytes = 0L, content_start = 0L,
content_remaining = -1L, lines_start = 0L;
register long line = 0;
--- 400,406 ----
FILE *temp;
struct header_rec *current_header = NULL;
! char buffer[VERY_LONG_STRING], tbuffer[VERY_LONG_STRING], *c;
long fbytes = 0L, line_bytes = 0L, content_start = 0L,
content_remaining = -1L, lines_start = 0L;
register long line = 0;
***************
*** 406,412 ****
rm_temps_exit();
}
copyit++;
! chown(cur_tempfolder, userid, groupid);
chmod(cur_tempfolder, 0700); /* shut off file for other people! */
}
else {
--- 445,451 ----
rm_temps_exit();
}
copyit++;
! (void) elm_chown(cur_tempfolder, userid, groupid);
chmod(cur_tempfolder, 0700); /* shut off file for other people! */
}
else {
***************
*** 498,504 ****
while (fbytes < mailfile_size) {
! if ((line_bytes = mail_gets(buffer, LONG_STRING, mailfile)) == 0)
break;
if (copyit)
--- 537,543 ----
while (fbytes < mailfile_size) {
! if ((line_bytes = mail_gets(buffer, VERY_LONG_STRING, mailfile)) == 0)
break;
if (copyit)
***************
*** 705,711 ****
* reading headers of new messages that have just arrived,
* and the preceding message was one of the old ones.
*/
! if ((count) && (!add_new_only || count > message_count)) {
headers[count-1]->lines = line;
if (headers[count-1]->content_length < 0)
headers[count-1]->content_length = fbytes - content_start;
--- 744,750 ----
* reading headers of new messages that have just arrived,
* and the preceding message was one of the old ones.
*/
! if (count && (!add_new_only || (count > message_count))) {
headers[count-1]->lines = line;
if (headers[count-1]->content_length < 0)
headers[count-1]->content_length = fbytes - content_start;
***************
*** 825,831 ****
else if (header_cmp(buffer, "Content-Length", NULL)) {
buffer[line_bytes - 1] = '\0';
current_header->content_length = atol((char *) buffer + 15);
! content_length_found = TRUE;
}
else if (header_cmp(buffer, "Expires", NULL))
--- 864,875 ----
else if (header_cmp(buffer, "Content-Length", NULL)) {
buffer[line_bytes - 1] = '\0';
current_header->content_length = atol((char *) buffer + 15);
! /* Check if content_length is > remaining size of file */
! if (current_header->content_length > mailfile_size-fbytes)
! current_header->content_length = -1;
! else
! content_length_found = TRUE;
!
}
else if (header_cmp(buffer, "Expires", NULL))
***************
*** 975,981 ****
Raw(OFF);
printf(catgets(elm_msg_cat, ElmSet, ElmLengthNESpool,
"\nnewmbox - length of mbox. != spool mailbox length!!\n"));
! dprint(0, (debugfile, "newmbox - mbox. != spool mail length"));
rm_temps_exit();
}
if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
--- 1019,1025 ----
Raw(OFF);
printf(catgets(elm_msg_cat, ElmSet, ElmLengthNESpool,
"\nnewmbox - length of mbox. != spool mailbox length!!\n"));
! dprint(1, (debugfile, "newmbox - mbox. != spool mail length"));
rm_temps_exit();
}
if ((mailfile = fopen(cur_tempfolder,"r")) == NULL) {
Index: src/options.c
Prereq: 5.12
*** ../elm2.4/src/options.c Sat May 8 16:25:47 1993
--- src/options.c Tue Aug 3 15:29:15 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: options.c,v 5.12 1993/05/08 20:25:33 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.12 $ $State: Exp $
*
* Copyright (c) 1986,1987 Dave Taylor
* Copyright (c) 1988-1992 USENET Community Trust
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: options.c,v 5.16 1993/08/03 19:28:39 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.16 $ $State: Exp $
*
* Copyright (c) 1986,1987 Dave Taylor
* Copyright (c) 1988-1992 USENET Community Trust
***************
*** 14,19 ****
--- 14,71 ----
*
*******************************************************************************
* $Log: options.c,v $
+ * Revision 5.16 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.15 1993/07/20 02:41:24 syd
+ * Three changes to expand_env() in src/read_rc.c: make it non-destructive,
+ * have it return an error code instead of bailing out, and add a buffer
+ * size argument to avoid overwritting the destination. The first is to
+ * avoid all of the gymnastics Elm needed to go through (and occasionally
+ * forgot to go through) to protect the value handed to expand_env().
+ * The second is because expand_env() was originally written to support
+ * "elmrc" and bailing out was a reasonable thing to do there -- but not
+ * in the other places where it has since been used. The third is just
+ * a matter of practicing safe source code.
+ *
+ * This patch changes all invocations to expand_env() to eliminate making
+ * temporary copies (now that the routine is non-destructive) and to pass
+ * in a destination length. Since expand_env() no longer bails out on
+ * error, a do_expand_env() routine was added to src/read_rc.c handle
+ * this. Moreover, the error message now gives some indication of what
+ * the problem is rather than just saying "can't expand".
+ *
+ * Gratitous change to src/editmsg.c renaming filename variables to
+ * clarify the purpose.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.14 1993/06/12 05:32:00 syd
+ * fix calling sequence for new argument
+ * From: Syd
+ *
+ * Revision 5.13 1993/06/10 03:07:39 syd
+ * This fixes a bug in the MIME code. Include_Part() uses expand_env()
+ * to expand the include file name, but since expand_env() is destructive
+ * [it uses strtok()] the file name gets corrupted, and the "Content-Name"
+ * header can contain a bogus value. The easy fix would be a one-line
+ * hack to Include_Part to use a temporary buffer. This patch does not
+ * implement the easy fix. *Every* place expand_env() is used, its side
+ * effects cause problems. I think the right fix is to make expand_env()
+ * non-destructive (i.e. have it duplicate the input to a temporary buffer
+ * and work from there). The attached patch modifies expand_env() in
+ * that manner, and eliminates all of the `copy to a temporary buffer'
+ * calls that precede it throughout elm.
+ * From:
[email protected] (Chip Rosenthal)
+ *
* Revision 5.12 1993/05/08 20:25:33 syd
* Add sleepmsg to control transient message delays
* From: Syd
***************
*** 120,129 ****
#include "save_opts.h"
#include "s_elm.h"
- #ifdef BSD
- #undef tolower
- #endif
-
#undef onoff
#define onoff(n) (n == 1? on_name : off_name)
--- 172,177 ----
***************
*** 133,154 ****
static char *on_name = NULL;
static char *off_name = NULL;
static int resort = 0;
! static char temp[SLEN]; /* needed when an option is run through
! * expand_env(), because that function
! * is destructive of the original
! */
!
! static post_cal(f) int f; {strcpy(temp,raw_calendar_file); expand_env(calendar_file,temp);}
! static post_editor(f) int f; {strcpy(temp,raw_editor); expand_env(editor,temp);}
! static post_pager(f) int f; {
! strcpy(temp, raw_pager); expand_env(pager, temp);
! clear_pages=(equal(pager,"builtin+")||equal(pager,"internal+"));
! }
! static post_folder(f) int f; {strcpy(temp,raw_folders); expand_env(folders,temp);}
! static post_sort(f) int f; {if (f) resort++;}
! static post_sent(f) int f; {strcpy(temp,raw_sentmail); expand_env(sent_mail,temp);}
! static post_print(f) int f; {strcpy(temp,raw_printout); expand_env(printout,temp);}
! static post_menu(f) int f; {headers_per_page=LINES-(mini_menu?13:8);}
opts_menu cfg_opts[] = {
--- 181,237 ----
static char *on_name = NULL;
static char *off_name = NULL;
static int resort = 0;
!
!
! static post_cal(f)
! int f;
! {
! (void) expand_env(calendar_file, raw_calendar_file, sizeof(calendar_file));
! }
!
! static post_editor(f)
! int f;
! {
! (void) expand_env(editor, raw_editor, sizeof(editor));
! }
!
! static post_pager(f)
! int f;
! {
! (void) expand_env(pager, raw_pager, sizeof(pager));
! clear_pages = (equal(pager, "builtin+") || equal(pager, "internal+"));
! }
!
! static post_folder(f)
! int f;
! {
! (void) expand_env(folders, raw_folders, sizeof(folders));
! }
!
! static post_sort(f)
! int f;
! {
! if (f)
! resort++;
! }
!
! static post_sent(f)
! int f;
! {
! (void) expand_env(sent_mail, raw_sentmail, sizeof(sent_mail));
! }
!
! static post_print(f)
! int f;
! {
! (void) expand_env(printout, raw_printout, sizeof(printout));
! }
!
! static post_menu(f)
! int f;
! {
! headers_per_page = LINES - (mini_menu ? 13 : 8);
! }
opts_menu cfg_opts[] = {
***************
*** 689,695 ****
if (sleepmsg > 0)
sleep((sleepmsg + 1) / 2);
main_state();
! sort_aliases(message_count, FALSE);
main_state();
}
ClearLine(LINES-2); /* clear alias_sort_one_liner()! */
--- 772,778 ----
if (sleepmsg > 0)
sleep((sleepmsg + 1) / 2);
main_state();
! sort_aliases(message_count, FALSE, FALSE);
main_state();
}
ClearLine(LINES-2); /* clear alias_sort_one_liner()! */
Index: src/pattern.c
Prereq: 5.9
*** ../elm2.4/src/pattern.c Thu May 13 23:53:50 1993
--- src/pattern.c Sun Sep 19 19:15:30 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: pattern.c,v 5.9 1993/05/14 03:53:46 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.9 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: pattern.c,v 5.10 1993/09/19 23:15:28 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,25 ----
*
*******************************************************************************
* $Log: pattern.c,v $
+ * Revision 5.10 1993/09/19 23:15:28 syd
+ * Changed a few buffers from LONG_STRING (512) to VERY_LONG_STRING
+ * to avoid long header lines overflowing the allocated space. At
+ * least 1024 bytes should be allowed in any header line/field.
+ * From: Jukka Ukkonen <
[email protected]>
+ *
* Revision 5.9 1993/05/14 03:53:46 syd
* Fix wrong message being displayed and then overwritten
* for long aliases.
***************
*** 394,400 ****
Returns 1 if found, 0 if not
**/
! char buffer[LONG_STRING];
int message_number, lines, line, line_len, err;
message_number = current-1;
--- 400,406 ----
Returns 1 if found, 0 if not
**/
! char buffer[VERY_LONG_STRING];
int message_number, lines, line, line_len, err;
message_number = current-1;
***************
*** 420,426 ****
line = 0;
lines = headers[message_number]->lines;
! while ((line_len = mail_gets(buffer, LONG_STRING, mailfile)) && line < lines) {
if(buffer[line_len - 1] == '\n') line++;
--- 426,433 ----
line = 0;
lines = headers[message_number]->lines;
! while ((line_len = mail_gets(buffer, VERY_LONG_STRING, mailfile)) &&
! line < lines) {
if(buffer[line_len - 1] == '\n') line++;
Index: src/read_rc.c
Prereq: 5.16
*** ../elm2.4/src/read_rc.c Sun May 16 16:59:20 1993
--- src/read_rc.c Sun Aug 22 22:58:06 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: read_rc.c,v 5.16 1993/05/16 20:59:14 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.16 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: read_rc.c,v 5.25 1993/08/23 02:58:04 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.25 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,100 ----
*
*******************************************************************************
* $Log: read_rc.c,v $
+ * Revision 5.25 1993/08/23 02:58:04 syd
+ * Call to expand_env for pager should be call to do_expand_env.
+ * temp_dir not initialized.
+ * From:
[email protected] (Jan Djarv)
+ *
+ * Revision 5.24 1993/08/10 18:49:32 syd
+ * When an environment variable was given as the tmpdir definition the src
+ * and dest overlapped in expand_env. This made elm produce a garbage
+ * expansion because expand_env cannot cope with overlapping src and
+ * dest. I added a new variable raw_temp_dir to keep src and dest not to
+ * overlap.
+ * From: Jukka Ukkonen <
[email protected]>
+ *
+ * Revision 5.23 1993/08/03 19:28:39 syd
+ * Elm tries to replace the system toupper() and tolower() on current
+ * BSD systems, which is unnecessary. Even worse, the replacements
+ * collide during linking with routines in isctype.o. This patch adds
+ * a Configure test to determine whether replacements are really needed
+ * (BROKE_CTYPE definition). The <ctype.h> header file is now included
+ * globally through hdrs/defs.h and the BROKE_CTYPE patchup is handled
+ * there. Inclusion of <ctype.h> was removed from *all* the individual
+ * files, and the toupper() and tolower() routines in lib/opt_utils.c
+ * were dropped.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.22 1993/08/03 18:57:21 syd
+ * default_weedlist() can't use pmalloc, because weedout() calls free when
+ * it encounters *clear-weed-list*.
+ * From:
[email protected] (Jan Djarv)
+ *
+ * Revision 5.21 1993/08/03 18:55:42 syd
+ * Spaces in weedout strings wasn't preserved ("From " became "From").
+ * From:
[email protected] (Jan Djarv)
+ *
+ * Revision 5.20 1993/07/20 02:41:24 syd
+ * Three changes to expand_env() in src/read_rc.c: make it non-destructive,
+ * have it return an error code instead of bailing out, and add a buffer
+ * size argument to avoid overwritting the destination. The first is to
+ * avoid all of the gymnastics Elm needed to go through (and occasionally
+ * forgot to go through) to protect the value handed to expand_env().
+ * The second is because expand_env() was originally written to support
+ * "elmrc" and bailing out was a reasonable thing to do there -- but not
+ * in the other places where it has since been used. The third is just
+ * a matter of practicing safe source code.
+ *
+ * This patch changes all invocations to expand_env() to eliminate making
+ * temporary copies (now that the routine is non-destructive) and to pass
+ * in a destination length. Since expand_env() no longer bails out on
+ * error, a do_expand_env() routine was added to src/read_rc.c handle
+ * this. Moreover, the error message now gives some indication of what
+ * the problem is rather than just saying "can't expand".
+ *
+ * Gratitous change to src/editmsg.c renaming filename variables to
+ * clarify the purpose.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.19 1993/06/10 03:08:38 syd
+ * I have been repetedly crashing elm 2.4.22 until I discovered that a
+ * test for failing to open the system elmrc file is mising. This could
+ * usefully be added in read_rc.c. Version info and patch follows:
+ * From: "C.R. Ritson" <
[email protected]>
+ *
+ * Revision 5.18 1993/06/10 03:07:39 syd
+ * This fixes a bug in the MIME code. Include_Part() uses expand_env()
+ * to expand the include file name, but since expand_env() is destructive
+ * [it uses strtok()] the file name gets corrupted, and the "Content-Name"
+ * header can contain a bogus value. The easy fix would be a one-line
+ * hack to Include_Part to use a temporary buffer. This patch does not
+ * implement the easy fix. *Every* place expand_env() is used, its side
+ * effects cause problems. I think the right fix is to make expand_env()
+ * non-destructive (i.e. have it duplicate the input to a temporary buffer
+ * and work from there). The attached patch modifies expand_env() in
+ * that manner, and eliminates all of the `copy to a temporary buffer'
+ * calls that precede it throughout elm.
+ * From:
[email protected] (Chip Rosenthal)
+ *
+ * Revision 5.17 1993/06/10 02:55:34 syd
+ * Write options to elmrc even if their values are empty strings.
+ * Rationalize code that reads and writes weedouts and alternates.
+ * From: chip%
[email protected]
+ *
* Revision 5.16 1993/05/16 20:59:14 syd
* fix not closing file
* From: Syd
***************
*** 172,187 ****
**/
#define SAVE_OPTS
- #include <ctype.h>
#include "headers.h"
#include "save_opts.h"
#include "s_elm.h"
#include <errno.h>
- #ifdef BSD
- #undef tolower
- #endif
-
extern opts_menu *find_cfg_opts();
extern int errno;
--- 253,263 ----
***************
*** 203,208 ****
--- 279,299 ----
static int lineno = 0;
static int errors = 0;
+
+ static void
+ do_expand_env(descr, dest, src, destlen)
+ char *descr, *dest, *src;
+ unsigned destlen;
+ {
+ if (expand_env(dest, src, destlen) != 0) {
+ printf(catgets(elm_msg_cat, ElmSet, ElmCannotInitErrorExpanding,
+ "\r\nCannot initialize \"%s\" - error expanding \"%s\".\r\n"),
+ descr, src);
+ leave(0);
+ }
+ }
+
+
read_rc_file()
{
/** this routine does all the actual work of reading in the
***************
*** 237,270 ****
strcpy(raw_shell, ((cp = getenv("SHELL")) == NULL)? default_shell : cp);
! strcpy(temp, raw_shell);
! expand_env(shell, temp);
strcpy(raw_pager, ((cp = getenv("PAGER")) == NULL)? default_pager : cp);
! strcpy(temp, raw_pager);
! expand_env(pager, temp);
!
! strcpy(raw_editor, ((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
! strcpy(temp_dir, ((cp = getenv("TMPDIR")) == NULL)? default_temp:cp);
if (temp_dir[strlen (temp_dir)-1] != '/')
! strcat(temp_dir, "/");
strcpy(alternative_editor, raw_editor);
! strcpy(temp, raw_editor);
! expand_env(editor, temp);
strcpy(raw_printout, default_printout);
! strcpy(temp, raw_printout);
! expand_env(printout, temp);
sprintf(raw_folders, "~/%s", default_folders);
! strcpy(temp, raw_folders);
! expand_env(folders, temp);
sprintf(raw_calendar_file, "~/%s", dflt_calendar_file);
! strcpy(temp, raw_calendar_file);
! expand_env(calendar_file, temp);
strcpy(e_editor, emacs_editor);
strcpy(v_editor, default_editor);
--- 328,356 ----
strcpy(raw_shell, ((cp = getenv("SHELL")) == NULL)? default_shell : cp);
! do_expand_env("shell", shell, raw_shell, sizeof(shell));
strcpy(raw_pager, ((cp = getenv("PAGER")) == NULL)? default_pager : cp);
! do_expand_env("pager", pager, raw_pager, sizeof(pager));
! strcpy(raw_temp_dir, (cp = getenv("TMPDIR")) ? cp : default_temp);
! do_expand_env("temp_dir", temp_dir, raw_temp_dir, sizeof(temp_dir));
if (temp_dir[strlen (temp_dir)-1] != '/')
! strcat(temp_dir, "/");
+ strcpy(raw_editor, ((cp = getenv("EDITOR")) == NULL)? default_editor:cp);
strcpy(alternative_editor, raw_editor);
! do_expand_env("editor", editor, raw_editor, sizeof(editor));
strcpy(raw_printout, default_printout);
! do_expand_env("printout", printout, raw_printout, sizeof(printout));
sprintf(raw_folders, "~/%s", default_folders);
! do_expand_env("folders", folders, raw_folders, sizeof(folders));
sprintf(raw_calendar_file, "~/%s", dflt_calendar_file);
! do_expand_env("calendar_file", calendar_file, raw_calendar_file,
! sizeof(calendar_file));
strcpy(e_editor, emacs_editor);
strcpy(v_editor, default_editor);
***************
*** 306,312 ****
fflush(stdout);
ch=getchar();
! if (isupper(ch)) ch = tolower(ch);
if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
ch = *def_ans_no;
--- 392,398 ----
fflush(stdout);
ch=getchar();
! ch = tolower(ch);
if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
ch = *def_ans_no;
***************
*** 332,339 ****
/* try system-wide rc file */
file = fopen(system_rc_file, "r");
! do_rc(file, SYSTEM_RC);
! fclose(file);
/* Look for the elmrc file */
sprintf(filename, "%s/%s", home, elmrcfile);
--- 418,427 ----
/* try system-wide rc file */
file = fopen(system_rc_file, "r");
! if ( file != NULL ) {
! do_rc(file, SYSTEM_RC);
! fclose(file);
! }
/* Look for the elmrc file */
sprintf(filename, "%s/%s", home, elmrcfile);
***************
*** 381,416 ****
}
*t = '\0';
}
! strcpy(buffer, raw_folders);
! expand_env(folders, buffer);
!
! strcpy(buffer, temp_dir);
! expand_env(temp_dir, buffer);
! if (temp_dir[strlen (temp_dir)-1] != '/')
! strcat(temp_dir, "/");
! strcpy(buffer, raw_shell);
! expand_env(shell, buffer);
! strcpy(buffer, raw_editor);
! expand_env(editor, buffer);
! strcpy(buffer, raw_calendar_file);
! expand_env(calendar_file, buffer);
! strcpy(buffer, raw_printout);
! expand_env(printout, buffer);
! strcpy(buffer, raw_pager);
! expand_env(pager, buffer);
if (equal(pager, "builtin+") || equal(pager, "internal+"))
clear_pages++;
! strcpy(buffer, raw_local_signature);
! expand_env(local_signature, buffer);
!
! strcpy(buffer, raw_remote_signature);
! expand_env(remote_signature, buffer);
if (equal(local_signature, remote_signature) &&
(equal(shift_lower(local_signature), "on") ||
--- 469,497 ----
}
*t = '\0';
}
! do_expand_env("folders", folders, raw_folders, sizeof(folders));
! do_expand_env("temp_dir", temp_dir, raw_temp_dir, sizeof(temp_dir));
! if (temp_dir[strlen (temp_dir)-1] != '/')
! strcat(temp_dir, "/");
!
! do_expand_env("shell", shell, raw_shell, sizeof(shell));
! do_expand_env("editor", editor, raw_editor, sizeof(editor));
! do_expand_env("calendar_file", calendar_file, raw_calendar_file,
! sizeof(calendar_file));
! do_expand_env("printout", printout, raw_printout, sizeof(printout));
! do_expand_env("pager", pager, raw_pager, sizeof(pager));
if (equal(pager, "builtin+") || equal(pager, "internal+"))
clear_pages++;
! do_expand_env("local_signature", local_signature,
! raw_local_signature, sizeof(local_signature));
! do_expand_env("remote_signature", remote_signature,
! raw_remote_signature, sizeof(remote_signature));
if (equal(local_signature, remote_signature) &&
(equal(shift_lower(local_signature), "on") ||
***************
*** 477,483 ****
fflush(stdout);
ch=getchar();
! if (isupper(ch)) ch = tolower(ch);
if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
ch = *def_ans_yes;
--- 558,564 ----
fflush(stdout);
ch=getchar();
! ch = tolower(ch);
if (ch == '\n' || ch == '\r') /* they took the default by pressing cr */
ch = *def_ans_yes;
***************
*** 510,517 ****
strcpy(raw_recvdmail, default_recvdmail);
}
! strcpy(buffer, raw_recvdmail);
! expand_env(recvd_mail, buffer);
if(metachar(recvd_mail[0])) {
strcpy(buffer, &recvd_mail[1]);
--- 591,598 ----
strcpy(raw_recvdmail, default_recvdmail);
}
! do_expand_env("recvd_mail", recvd_mail, raw_recvdmail,
! sizeof(recvd_mail));
if(metachar(recvd_mail[0])) {
strcpy(buffer, &recvd_mail[1]);
***************
*** 523,530 ****
sprintf(sent_mail, default_sentmail);
}
! strcpy(buffer, raw_sentmail);
! expand_env(sent_mail, buffer);
if(metachar(sent_mail[0])) {
strcpy(buffer, &sent_mail[1]);
--- 604,610 ----
sprintf(sent_mail, default_sentmail);
}
! do_expand_env("sent_mail", sent_mail, raw_sentmail, sizeof(sent_mail));
if(metachar(sent_mail[0])) {
strcpy(buffer, &sent_mail[1]);
***************
*** 744,783 ****
{
/** This routine is called with a list of headers to weed out. **/
! char *strptr, *header;
! register int i, len;
strptr = string;
! while ((header = strtok(strptr, "\t ,\"'")) != NULL) {
! if (strlen(header) > 0) {
! if (! istrcmp(header, "*end-of-user-headers*")) break;
! if (! istrcmp(header, "*clear-weed-list*")) {
! weedlist[0] = "*end-of-defaults*";
! weedcount = 1;
! }
! if (weedcount > MAX_IN_WEEDLIST) {
! printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedHeaders,
! "Too many weed headers! Leaving...\n\r"));
! exit(1);
! }
! if ((weedlist[weedcount] = pmalloc(strlen(header) + 1)) == NULL) {
! printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedPmalloc,
! "Too many weed headers! Out of memory! Leaving...\n\r"));
! exit(1);
! }
! for (i=0, len = strlen(header); i< len; i++)
! if (header[i] == '_') header[i] = ' ';
! if(!matches_weedlist(header)) {
! strcpy(weedlist[weedcount], header);
! weedcount++;
! }
! /* since this used both for system defaults and user's */
! if (equal(header, "*end-of-defaults*")) break;
}
! strptr = NULL;
}
}
--- 824,872 ----
{
/** This routine is called with a list of headers to weed out. **/
! char *strptr, *header, *p;
! int finished;
+ finished = FALSE;
strptr = string;
+ while (!finished && (header = strtokq(strptr, "\t ,", TRUE)) != NULL) {
+ strptr = NULL;
! if (!*header)
! continue;
!
! for (p = header; *p; ++p) {
! if (*p == '_')
! *p = ' ';
! }
! if (! istrcmp(header, "*end-of-user-headers*"))
! break;
! if (! istrcmp(header, "*end-of-defaults*"))
! finished = TRUE;
!
! if (! istrcmp(header, "*clear-weed-list*")) {
! while (weedcount)
! free(weedlist[--weedcount]);
! header = "*end-of-defaults*";
}
!
! if (matches_weedlist(header))
! continue;
!
! if (weedcount > MAX_IN_WEEDLIST) {
! printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedHeaders,
! "Too many weed headers! Leaving...\n\r"));
! exit(1);
! }
! if ((p = malloc(strlen(header) + 1)) == NULL) {
! printf(catgets(elm_msg_cat, ElmSet, ElmTooManyWeedPmalloc,
! "Too many weed headers! Out of memory! Leaving...\n\r"));
! exit(1);
! }
! strcpy(p, header);
! weedlist[weedcount++] = p;
}
}
***************
*** 840,846 ****
for (weedcount = 0; default_list[weedcount] != (char *) 0;weedcount++){
if ((weedlist[weedcount] =
! pmalloc(strlen(default_list[weedcount]) + 1)) == NULL) {
printf(catgets(elm_msg_cat, ElmSet, ElmNoMemDefaultWeed,
"\nNot enough memory for default weedlist. Leaving.\n"));
leave(1);
--- 929,935 ----
for (weedcount = 0; default_list[weedcount] != (char *) 0;weedcount++){
if ((weedlist[weedcount] =
! malloc(strlen(default_list[weedcount]) + 1)) == NULL) {
printf(catgets(elm_msg_cat, ElmSet, ElmNoMemDefaultWeed,
"\nNot enough memory for default weedlist. Leaving.\n"));
leave(1);
***************
*** 883,892 ****
for (i=0;buffer[i] != '\0' && ok_rc_char(buffer[i]); i++)
if (buffer[i] == '_')
word1[i] = '-';
- else if (isupper(buffer[i]))
- word1[i] = tolower(buffer[i]);
else
! word1[i] = buffer[i];
word1[i++] = '\0'; /* that's the first word! */
--- 972,979 ----
for (i=0;buffer[i] != '\0' && ok_rc_char(buffer[i]); i++)
if (buffer[i] == '_')
word1[i] = '-';
else
! word1[i] = tolower(buffer[i]);
word1[i++] = '\0'; /* that's the first word! */
***************
*** 913,967 ****
}
! expand_env(dest, buffer)
! char *dest, *buffer;
{
! /** expand possible metacharacters in buffer and then copy
! to dest...
! BEWARE!! Because strtok() is used on buffer, buffer may be changed.
! This routine knows about "~" being the home directory,
! and "$xxx" being an environment variable.
! **/
! char *word, *string, next_word[SLEN];
!
! if (buffer[0] == '/') {
! dest[0] = '/';
! dest[1] = '\0';
! /* Added for Apollos - handle //node */
! if (buffer[1] == '/') {
! dest[1] = '/';
! dest[2] = '\0';
! }
! }
! else
! dest[0] = '\0';
! string = (char *) buffer;
! while ((word = strtok(string, "/")) != NULL) {
! if (word[0] == '$') {
! next_word[0] = '\0';
! if (getenv((char *) (word + 1)) != NULL)
! strcpy(next_word, getenv((char *) (word + 1)));
! if (strlen(next_word) == 0)
! leave(printf(catgets(elm_msg_cat, ElmSet, ElmCantExpandEnvVar,
! "\n\rCan't expand environment variable '%s'.\n\r"),
! word));
! }
! else if (word[0] == '~' && word[1] == '\0')
! strcpy(next_word, home);
! else
! strcpy(next_word, word);
! sprintf(dest, "%s%s%s", dest,
! (strlen(dest) > 0 && lastch(dest) != '/' ? "/":""),
! next_word);
- string = (char *) NULL;
}
}
#define on_off(s) (s == 1? "ON " : "OFF")
--- 1000,1098 ----
}
!
! /*
! * expand_env() - Perform environment expansion on a pathname. Also
! * replaces "~" at the front of the path with the user's home directory.
! * Environment expansion occurs at the path component boundaries, e.g.
! * "/foo/$BAR/baz" is subject to expansion but "/foo/zzz$BAR/baz" is not.
! * Returns 0 if expansion successful, -1 if an error occurs (result too
! * long, cannot get home directory, or environment expansion failed).
! */
! expand_env(dest, src, destlen)
! char *dest; /* pointer to space to hold the result */
! char *src; /* pointer to string to expand */
! unsigned destlen; /* size of the destination buffer */
{
! char envname_buf[SLEN], *envname_front, *expval;
! int check_for_env, len, ret;
! --destlen; /* reserve space for trailing '\0' */
! ret = 0; /* assume success */
! /*
! * Replace "~" at front with user's home directory.
! */
! if (src[0] == '~' && (src[1] == '\0' || src[1] == '/')) {
! if (home[0] == '\0') {
! expval = "~";
! ret = -1;
! } else {
! expval = home;
! }
! if ((len = strlen(expval)) > destlen)
! len = destlen;
! strfcpy(dest, expval, len+1);
! dest += len;
! destlen -= len;
! ++src;
! }
!
! /*
! * Copy through the rest, performing $NAME expansion where appropriate.
! */
! check_for_env = TRUE;
! while (destlen > 0 && *src != '\0') {
! /*
! * Check for "$NAME" at the start of every path component.
! */
! if (check_for_env && *src == '$') {
! /*
! * Get the environment parameter name into "envname_buf"
! * and advance "src" to the next path component.
! */
! envname_front = ++src;
! if ((len = strcspn(src, "/")) == 0)
! len = strlen(src);
! src += len;
! if (len > sizeof(envname_buf)-1)
! len = sizeof(envname_buf)-1;
! strfcpy(envname_buf, envname_front, len+1);
!
! /*
! * Copy over the environment expansion. If the environment
! * parameter is undefined then copy over unchanged and set
! * a fail return status.
! */
! if ((expval = getenv(envname_buf)) == NULL) {
! *dest++ = '$';
! --destlen;
! expval = envname_buf;
! ret = -1;
! }
! if ((len = strlen(expval)) > destlen)
! len = destlen;
! strfcpy(dest, expval, len+1);
! dest += len;
! destlen -= len;
! check_for_env = FALSE;
! } else {
! check_for_env = (*src == '/');
! *dest++ = *src++;
! --destlen;
}
+
+ }
+
+ *dest = '\0';
+ if (destlen <= 0)
+ ret = -1;
+ return ret;
}
#define on_off(s) (s == 1? "ON " : "OFF")
***************
*** 1045,1051 ****
register int i, j;
for (i=0, j=0; word[i] != '\0'; i++)
! mybuffer[j++] = isupper(word[i]) ? tolower(word[i]) : word[i];
mybuffer[j] = '\0';
return( (strncmp(mybuffer, "on", 2) == 0) ||
--- 1176,1182 ----
register int i, j;
for (i=0, j=0; word[i] != '\0'; i++)
! mybuffer[j++] = tolower(word[i]);
mybuffer[j] = '\0';
return( (strncmp(mybuffer, "on", 2) == 0) ||
Index: src/remail.c
Prereq: 5.10
*** ../elm2.4/src/remail.c Tue Apr 20 21:25:47 1993
--- src/remail.c Sun Sep 26 21:52:07 1993
***************
*** 1,8 ****
! static char rcsid[] = "@(#)$Id: remail.c,v 5.10 1993/04/21 01:25:45 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.10 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
--- 1,8 ----
! static char rcsid[] = "@(#)$Id: remail.c,v 5.13 1993/09/27 01:51:38 syd Exp $";
/*******************************************************************************
! * The Elm Mail System - $Revision: 5.13 $ $State: Exp $
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
***************
*** 14,19 ****
--- 14,33 ----
*
*******************************************************************************
* $Log: remail.c,v $
+ * Revision 5.13 1993/09/27 01:51:38 syd
+ * Add elm_chown to consolidate for Xenix not allowing -1
+ * From: Syd
+ *
+ * Revision 5.12 1993/08/23 03:26:24 syd
+ * Try setting group id separate from user id in chown to
+ * allow restricted systems to change group id of file
+ * From: Syd
+ *
+ * Revision 5.11 1993/08/10 18:53:31 syd
+ * I compiled elm 2.4.22 with Purify 2 and fixed some memory leaks and
+ * some reads of unitialized memory.
+ * From:
[email protected]
+ *
* Revision 5.10 1993/04/21 01:25:45 syd
* I'm using Elm 2.4.21 under Linux. Linux has no Bourne shell. Each
* user installs her favorite shell as /bin/sh. I use Bash 1.12.
***************
*** 127,139 ****
"Sorry - couldn't open file %s for writing (%s)."),
error_description(err));
set_error(buffer);
return(1);
}
/** now let's copy the message into the newly opened
buffer... **/
! chown (filename, userid, groupid);
#ifdef MMDF
if (strcmp(submitmail, mailer) == 0)
--- 141,154 ----
"Sorry - couldn't open file %s for writing (%s)."),
error_description(err));
set_error(buffer);
+ free(filename);
return(1);
}
/** now let's copy the message into the newly opened
buffer... **/
! (void) elm_chown(filename, userid, groupid);
#ifdef MMDF
if (strcmp(submitmail, mailer) == 0)
***************
*** 158,163 ****
--- 173,179 ----
set_error(catgets(elm_msg_cat, ElmSet, ElmBounceCancelled,
"Bounce of message canceled."));
(void) unlink(filename);
+ free(filename);
return(1);
}
***************
*** 185,190 ****
--- 201,208 ----
(void) system_call(buffer, 0);
set_error(catgets(elm_msg_cat, ElmSet, ElmMailResent, "Mail resent."));
+ free(filename);
+
return(1);
}
#ifdef MMDF