aboutsummaryrefslogtreecommitdiffstats
path: root/main/procmail/procmail-3.23pre.patch
blob: 4250a5bf54d7fa9d25a7da0e614ea1cc555304d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
From: Santiago Vila <sanvila@debian.org>
Subject: diff from procmail-3.22 to procmail-3.23pre
X-Debian-version: 3.22-1

--- a/HISTORY
+++ b/HISTORY
@@ -491,8 +491,8 @@
 	       - Root owned lockfiles aren't bogus
 	       - A lone trailing '$' wasn't terminated properly when expanded
 	    Changes to formail:
-	       - Replies without the -t flag go to the envelope sender
-	       - Replies without "-a Resent-" and -t flag ignore the
+	       - Replies without the -t option go to the envelope sender
+	       - Replies without "-a Resent-" and -t option ignore the
 		 Resent-* headers
 	       - Prevent corrupt idcaches by suppressing the -n option when
 		 splitting with the -D option
@@ -509,7 +509,7 @@
 	    Changed the form of tempfile names to make them `more' unique
 	     and deal with filename length limits more gracefully
 	    Updated the FAQ and the list of mirrors in the README
-	    Documented the exact behavior of lockfile's -! flag
+	    Documented the exact behavior of lockfile's -! option
 	    Documented the suggested usage of -r vs -rt
 2000/08/25: v3.15
 	    Changes to procmail:
@@ -588,7 +588,7 @@
 	    Changes to lockfile:
 	       - Include the system mailbox lockfile path in the -v output
 	       - Resist attempts to use a setuid lockfile command
-	       - Fix infinite loop on -l, -r, or -s flag with no value
+	       - Fix infinite loop on -l, -r, or -s option with no value
 	    Documented formail's treatment of >From_ lines as continuations
 	       of the From_ line and warned of problems caused by non-RFC822
 	       field names like 'Old-From '
@@ -623,3 +623,8 @@
 	    More paranoia: start to use strlcpy()
 	    Generate safe temp and maildir filenames when the hostname
 	       contains / or : by mapping them to \ooo
+2001/09/13: v3.23pre
+	    Changes to procmail:
+	       - Don't coredump in comsat code if interrupted early
+	       - Correctly handle COMSAT=on
+	       - Once used the 'H' flag would never be cleared
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1,5 +1,5 @@
 #define VERSION "\
- v3.22 2001/09/10\n\
+ v3.23pre 2001/09/13\n\
     Copyright (c) 1990-2001, Stephen R. van den Berg\t<srb@cuci.nl>\n\
     Copyright (c) 1997-2001, Philip A. Guenther\t\t<guenther@sendmail.com>\n\
 \n\
--- a/src/comsat.c
+++ b/src/comsat.c
@@ -9,7 +9,7 @@
 
 #ifdef RCS
 static /*const*/char rcsid[]=
- "$Id: comsat.c,v 1.5 2001/07/03 15:05:47 guenther Exp $";
+ "$Id: comsat.c,v 1.7 2001/09/13 19:08:49 guenther Exp $";
 #endif
 
 #include "procmail.h"
@@ -92,7 +92,7 @@
    }
   if(newvalid)						  /* so far, so good */
    { int s;
-     if(!*chp)						       /* no service */
+     if(!chad||!*chp)					       /* no service */
 	chp=BIFF_serviceport;				/* new balls please! */
      s=strtol(chp,&chad,10);
      if(chp!=chad)			       /* the service is not numeric */
@@ -120,7 +120,7 @@
 { int s;const char*p;
   if(!csvalid||!buf)		  /* is comat on and set to a valid address? */
      return;
-  if(!*cslgname||strlen(cslgname)+2>linebuf)	       /* is $LOGNAME bogus? */
+  if(!cslgname||!*cslgname||strlen(cslgname)+2>linebuf)/* is $LOGNAME bogus? */
      return;
   if(!(p=folder?folder:cslastf))		     /* do we have a folder? */
      return;
--- a/src/header.h
+++ b/src/header.h
@@ -4,12 +4,11 @@
  *	"-m nnn" fields encountered should be among them or one of	*
  *	the special From_, Article_ or X- fields).			*
  *									*
- *	If you need to add one (be sure to update "cdigest" below as	*
- *	well!), drop me a mail, I might be interested in including	*
- *	it in the next release.						*
+ *	If you need to add one, drop me an email at bug@procmail.org.	*
+ *	I might be interested in including it in the next release.	*
  *									*
  ************************************************************************/
-/*$Id: header.h,v 1.44 1999/07/06 06:12:22 guenther Exp $*/
+/*$Id: header.h,v 1.45 2001/09/24 03:38:08 guenther Exp $*/
 
 X(returnpath,		"Return-Path:")				  /* RFC 822 */
 X(received,		"Received:")				/* ditto ... */
--- a/src/lmtp.c
+++ b/src/lmtp.c
@@ -7,7 +7,7 @@
  ************************************************************************/
 #ifdef RCS
 static /*const*/char rcsid[]=
- "$Id: lmtp.c,v 1.13 2001/06/28 21:44:28 guenther Exp $"
+ "$Id: lmtp.c,v 1.14 2001/09/23 20:17:57 guenther Exp $"
 #endif
 #include "procmail.h"
 #ifdef LMTP
@@ -708,7 +708,7 @@
      got-=in-p;				     /* correct for what disappeared */
    }
   while(left-=got);				/* change listed buffer size */
-  *(long*)statep=state;					       /* save state */
+  *(int*)statep=state;					       /* save state */
   return 0;
 }
 
@@ -765,7 +765,7 @@
      got-=in-p;				     /* correct for what disappeared */
    }
   while(left-=got);				/* change listed buffer size */
-  *(long*)statep=state;					       /* save state */
+  *(int*)statep=state;					       /* save state */
   return 0;
 }
 
--- a/src/memblk.c
+++ b/src/memblk.c
@@ -8,7 +8,7 @@
  ************************************************************************/
 #ifdef RCS
 static /*const*/char rcsid[]=
- "$Id: memblk.c,v 1.6 2001/06/28 22:55:09 guenther Exp $"
+ "$Id: memblk.c,v 1.7 2001/09/18 21:59:08 guenther Exp $"
 #endif
 #include "procmail.h"
 #include "robust.h"
@@ -51,11 +51,11 @@
 {
 #ifdef USE_MMAP
   if(mb->fd>=0)
-   { long len=mb->len+1;
-     if(munmap(mb->p,len))
-	mmapfailed(len);		      /* don't want to continue here */
-     if((mb->p=mmap(0,len,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
-	mmapfailed(len);
+   { long mlen=mb->len+1;
+     if(munmap(mb->p,mlen))
+	mmapfailed(mlen);		      /* don't want to continue here */
+     if((mb->p=mmap(0,mlen,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
+	mmapfailed(mlen);
      close(mb->fd);
      mb->fd=ropen(devnull,O_RDWR,0);		/* XXX Perhaps -1 is better? */
    }
@@ -77,8 +77,8 @@
      strcpy(filename,MMAP_DIR);
      if(unique(filename,strchr(filename,'\0'),MMAP_FILE_LEN,MMAP_PERM,0,0)&&
 	(mb->fd=ropen(filename,O_RDWR,MMAP_PERM),unlink(filename),mb->fd>=0))
-      { mb->filelen=len;
-	if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
+      { mb->filelen=len+1;
+	if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
 dropf:	 { close(mb->fd);mb->fd= -1;
 	   if(verbose)nlog("Unable to extend or use tempfile");
 	 }
@@ -98,9 +98,9 @@
       }
    }
   if(mb->fd>=0)
-   { if(len>mb->filelen)				  /* need to extend? */
-      { mb->filelen=len;
-	if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
+   { if(len>=mb->filelen)				  /* need to extend? */
+      { mb->filelen=len+1;
+	if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
 	 { char*p=malloc(len+1);	   /* can't extend, switch to malloc */
 	   tmemmove(p,mb->p,mb->len);
 	   munmap(mb->p,mb->len+1);
@@ -124,9 +124,9 @@
    }
   else
      mb->p=realloc(mb->p,len+1);
-  mb->len=len+1;
-  mb->p[len]='\0';
+  mb->len=len;
 ret1:
+  mb->p[len]='\0';
   return 1;
 }
 
--- a/src/memblk.h
+++ b/src/memblk.h
@@ -1,6 +1,6 @@
 typedef struct memblk {
     char*p;						  /* where it starts */
-    long len;					 /* currently allocated size */
+    long len;			 /* current size, not including trailing NUL */
 #ifdef USE_MMAP
     off_t filelen;				     /* how long is the file */
     int fd;					   /* file which is mmap()ed */
--- a/src/pipes.c
+++ b/src/pipes.c
@@ -8,7 +8,7 @@
  ************************************************************************/
 #ifdef RCS
 static /*const*/char rcsid[]=
- "$Id: pipes.c,v 1.73 2001/08/27 08:43:59 guenther Exp $";
+ "$Id: pipes.c,v 1.74 2001/09/18 22:01:27 guenther Exp $";
 #endif
 #include "procmail.h"
 #include "robust.h"
@@ -145,7 +145,9 @@
   if(Stdout)
    { *(eq=strchr(Stdout,'\0')-1)='\0';			     /* chop the '=' */
      if(!(backblock=getenv(Stdout)))			/* no current value? */
-	PRDB=PWRB= -1;
+      { PRDB=PWRB= -1;
+	backlen=0;
+      }
      else
       { backlen=strlen(backblock);
 	goto pip;
@@ -155,9 +157,7 @@
 pip: rpipe(pbackfd);
   rpipe(pinfd);						 /* main pipes setup */
   if(!(pidchild=sfork()))			/* create a sending procmail */
-   { if(Stdout&&backblock)
-	backlen=strlen(backblock);
-     else
+   { if(!Stdout)
 	backblock=source,backlen=len;
      childsetup();rclose(PRDI);rclose(PRDB);
      rpipe(poutfd);rclose(STDOUT);
--- a/src/procmail.c
+++ b/src/procmail.c
@@ -14,7 +14,7 @@
  ************************************************************************/
 #ifdef RCS
 static /*const*/char rcsid[]=
- "$Id: procmail.c,v 1.183 2001/08/31 04:57:36 guenther Exp $";
+ "$Id: procmail.c,v 1.184 2001/09/14 05:54:19 guenther Exp $";
 #endif
 #include "../patchlevel.h"
 #include "procmail.h"
@@ -652,8 +652,7 @@
 	      nrcond= -1;
 	   if(tolock)		 /* clear temporary buffer for lockfile name */
 	      free(tolock);
-	   for(i=maxindex(flags);i;i--)			  /* clear the flags */
-	      flags[i]=0;
+	   bbzero(flags,maxindex(flags));		  /* clear the flags */
 	   for(tolock=0,locknext=0;;)
 	    { chp=skpspace(chp);
 	      switch(i= *chp++)