procmail.patch 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. --- man/procmail.man Tue Sep 11 06:54:43 2001
  2. +++ man/procmail.man Sun Mar 30 21:13:44 2003
  3. @@ -166,7 +166,8 @@
  4. accept an unlimited number of arguments.@ETCRCS_desc@
  5. For some advanced usage of this option you should look in the
  6. .B EXAMPLES
  7. -section below.@LMTPOPTdesc@.SH ARGUMENTS
  8. +section below.@LMTPOPTdesc@
  9. +.SH ARGUMENTS
  10. Any arguments containing an '=' are considered to be environment variable
  11. assignments, they will
  12. .I all
  13. @@ -720,6 +721,15 @@
  14. .na
  15. .nf
  16. @FW_content@
  17. +.fi
  18. +.ad
  19. +.PP
  20. +Some mailers (notably exim) do not currently accept the above syntax.
  21. +In such case use this instead:
  22. +.PP
  23. +.na
  24. +.nf
  25. +|/usr/bin/procmail
  26. .fi
  27. .ad
  28. .PP
  29. --- man/procmailrc.man Tue Sep 11 06:55:03 2001
  30. +++ man/procmailrc.man Sun Mar 30 21:13:44 2003
  31. @@ -779,7 +779,7 @@
  32. .PP
  33. Some non-optimal and non-obvious regexps set MATCH to an incorrect
  34. value. The regexp can be made to work by removing one or more unneeded
  35. -'*', '+', or '?' operator on the left-hand side of the \e/ token.
  36. +\&'*', '+', or '?' operator on the left-hand side of the \e/ token.
  37. .SH MISCELLANEOUS
  38. If the regular expression contains `\fB@TO_key@\fP' it will be substituted by
  39. .na
  40. --- new/mailstat.1 Thu Jan 1 01:00:00 1970
  41. +++ new/mailstat.1 Sun Mar 30 21:13:44 2003
  42. @@ -0,0 +1,40 @@
  43. +.TH MAILSTAT 1
  44. +.SH NAME
  45. +mailstat \- shows mail-arrival statistics
  46. +.SH SYNOPSIS
  47. +.B mailstat
  48. +[\-klmots] [logfile]
  49. +.SH DESCRIPTION
  50. +.B mailstat
  51. +parses a procmail-generated $LOGFILE and displays
  52. +a summary about the messages delivered to all folders
  53. +(total size, average size, nr of messages).
  54. +The $LOGFILE is truncated to zero length, unless the
  55. +.B -k
  56. +option is used.
  57. +Exit code 0 if mail arrived, 1 if no mail arrived.
  58. +.SH OPTIONS
  59. +.TP
  60. +.I \-k
  61. +keep logfile intact
  62. +.TP
  63. +.I \-l
  64. +long display format
  65. +.TP
  66. +.I \-m
  67. +merge any errors into one line
  68. +.TP
  69. +.I \-o
  70. +use the old logfile
  71. +.TP
  72. +.I \-t
  73. +terse display format
  74. +.TP
  75. +.I \-s
  76. +silent in case of no mail
  77. +.SH NOTES
  78. +Customise to your heart's content, this program is only provided as a
  79. +guideline.
  80. +.SH AUTHOR
  81. +This manual page was written by Santiago Vila <sanvila@debian.org>
  82. +for the Debian GNU/Linux distribution (but may be used by others).
  83. --- src/comsat.c Tue Sep 11 06:55:46 2001
  84. +++ src/comsat.c Sun Mar 30 21:13:45 2003
  85. @@ -92,7 +92,7 @@
  86. }
  87. if(newvalid) /* so far, so good */
  88. { int s;
  89. - if(!*chp) /* no service */
  90. + if(!chad||!*chp) /* no service */
  91. chp=BIFF_serviceport; /* new balls please! */
  92. s=strtol(chp,&chad,10);
  93. if(chp!=chad) /* the service is not numeric */
  94. @@ -120,7 +120,7 @@
  95. { int s;const char*p;
  96. if(!csvalid||!buf) /* is comat on and set to a valid address? */
  97. return;
  98. - if(!*cslgname||strlen(cslgname)+2>linebuf) /* is $LOGNAME bogus? */
  99. + if(!cslgname||!*cslgname||strlen(cslgname)+2>linebuf)/* is $LOGNAME bogus? */
  100. return;
  101. if(!(p=folder?folder:cslastf)) /* do we have a folder? */
  102. return;
  103. --- src/foldinfo.h Tue Dec 5 07:34:25 2000
  104. +++ src/foldinfo.h Sun Mar 30 21:13:45 2003
  105. @@ -10,7 +10,7 @@
  106. #define ft_lock(type) ((type)>ft_MAILDIR) /* kernel lock fd */
  107. #define ft_atime(type) ((type)==ft_FILE) /* force atime < mtime */
  108. -#define ft_dotlock(type) ((type)==ft_FILE) /* dotlock $DEFAULT */
  109. +#define ft_dotlock(type) ((type)>ft_MAILDIR) /* dotlock $DEFAULT */
  110. #define ft_delim(type) ((type)==ft_FILE) /* add MMDF delim */
  111. #define ft_checkcloser(type) ((type)>ft_MH)
  112. #define ft_forceblank(type) ((type)!=ft_MAILDIR) /* force blank line at end */
  113. --- src/mailfold.c Tue Sep 11 06:58:34 2001
  114. +++ src/mailfold.c Sun Mar 30 21:13:45 2003
  115. @@ -378,7 +378,8 @@
  116. dfilled=mailread=0;
  117. else if(rhead) /* only read in a new header */
  118. { memblk new;
  119. - dfilled=mailread=0;makeblock(&new,0);readdyn(&new,&dfilled,0);
  120. + dfilled=mailread=0;makeblock(&new,0);
  121. + readdyn(&new,&dfilled,thebody-themail.p);
  122. if(tobesent>dfilled&&isprivate) /* put it in place here */
  123. { tmemmove(themail.p+dfilled,thebody,filled-=tobesent);
  124. tmemmove(themail.p,new.p,dfilled);
  125. --- src/manconf.c Tue Sep 11 06:58:34 2001
  126. +++ src/manconf.c Sun Mar 30 21:13:44 2003
  127. @@ -139,7 +139,7 @@
  128. sh before procmail ever sees it; it is however a necessary kludge against\1\
  129. overoptimising sendmail programs:\1");
  130. #else
  131. - ps("FW_content","\"|exec @BINDIR@/procmail\"");
  132. + ps("FW_content","\"|exec @BINDIR@/procmail || exit 75\"");
  133. ps("FW_comment","");
  134. #endif
  135. #else
  136. @@ -233,7 +233,7 @@
  137. \2-@PRESERVOPT@\1and\1.BR \2-@FROMWHOPT@ .\1");
  138. pc("LMTPOPT",LMTPOPT);
  139. #else
  140. - ps("LMTPOPTdesc","");ps("LMTPusage","");
  141. + ps("LMTPOPTdesc","");ps("LMTPusage","\1");
  142. #endif
  143. pname("INIT_UMASK",0);printf("0%lo/g\n",(unsigned long)INIT_UMASK);lines--;
  144. pn("DEFlinebuf",DEFlinebuf);
  145. --- src/memblk.c Fri Jun 29 04:20:56 2001
  146. +++ src/memblk.c Sun Mar 30 21:13:44 2003
  147. @@ -51,11 +51,11 @@
  148. {
  149. #ifdef USE_MMAP
  150. if(mb->fd>=0)
  151. - { long len=mb->len+1;
  152. - if(munmap(mb->p,len))
  153. - mmapfailed(len); /* don't want to continue here */
  154. - if((mb->p=mmap(0,len,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
  155. - mmapfailed(len);
  156. + { long mlen=mb->len+1;
  157. + if(munmap(mb->p,mlen))
  158. + mmapfailed(mlen); /* don't want to continue here */
  159. + if((mb->p=mmap(0,mlen,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
  160. + mmapfailed(mlen);
  161. close(mb->fd);
  162. mb->fd=ropen(devnull,O_RDWR,0); /* XXX Perhaps -1 is better? */
  163. }
  164. @@ -77,8 +77,8 @@
  165. strcpy(filename,MMAP_DIR);
  166. if(unique(filename,strchr(filename,'\0'),MMAP_FILE_LEN,MMAP_PERM,0,0)&&
  167. (mb->fd=ropen(filename,O_RDWR,MMAP_PERM),unlink(filename),mb->fd>=0))
  168. - { mb->filelen=len;
  169. - if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
  170. + { mb->filelen=len+1;
  171. + if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
  172. dropf: { close(mb->fd);mb->fd= -1;
  173. if(verbose)nlog("Unable to extend or use tempfile");
  174. }
  175. @@ -98,9 +98,9 @@
  176. }
  177. }
  178. if(mb->fd>=0)
  179. - { if(len>mb->filelen) /* need to extend? */
  180. - { mb->filelen=len;
  181. - if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
  182. + { if(len>=mb->filelen) /* need to extend? */
  183. + { mb->filelen=len+1;
  184. + if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
  185. { char*p=malloc(len+1); /* can't extend, switch to malloc */
  186. tmemmove(p,mb->p,mb->len);
  187. munmap(mb->p,mb->len+1);
  188. @@ -124,9 +124,9 @@
  189. }
  190. else
  191. mb->p=realloc(mb->p,len+1);
  192. - mb->len=len+1;
  193. - mb->p[len]='\0';
  194. + mb->len=len;
  195. ret1:
  196. + mb->p[len]='\0';
  197. return 1;
  198. }
  199. --- src/memblk.h Sat Jun 30 06:12:18 2001
  200. +++ src/memblk.h Sun Mar 30 21:13:44 2003
  201. @@ -1,6 +1,6 @@
  202. typedef struct memblk {
  203. char*p; /* where it starts */
  204. - long len; /* currently allocated size */
  205. + long len; /* current size, not including trailing NUL */
  206. #ifdef USE_MMAP
  207. off_t filelen; /* how long is the file */
  208. int fd; /* file which is mmap()ed */
  209. --- src/pipes.c Tue Sep 11 06:58:44 2001
  210. +++ src/pipes.c Sun Mar 30 21:13:45 2003
  211. @@ -145,7 +145,9 @@
  212. if(Stdout)
  213. { *(eq=strchr(Stdout,'\0')-1)='\0'; /* chop the '=' */
  214. if(!(backblock=getenv(Stdout))) /* no current value? */
  215. - PRDB=PWRB= -1;
  216. + { PRDB=PWRB= -1;
  217. + backlen=0;
  218. + }
  219. else
  220. { backlen=strlen(backblock);
  221. goto pip;
  222. @@ -155,9 +157,7 @@
  223. pip: rpipe(pbackfd);
  224. rpipe(pinfd); /* main pipes setup */
  225. if(!(pidchild=sfork())) /* create a sending procmail */
  226. - { if(Stdout&&backblock)
  227. - backlen=strlen(backblock);
  228. - else
  229. + { if(!Stdout)
  230. backblock=source,backlen=len;
  231. childsetup();rclose(PRDI);rclose(PRDB);
  232. rpipe(poutfd);rclose(STDOUT);
  233. @@ -194,7 +194,7 @@
  234. makeblock(&temp,Stdfilled);
  235. tmemmove(temp.p,Stdout,Stdfilled);
  236. readdyn(&temp,&Stdfilled,Stdfilled+backlen+1);
  237. - Stdout=realloc(Stdout,&Stdfilled+1);
  238. + Stdout=realloc(Stdout,Stdfilled+1);
  239. tmemmove(Stdout,temp.p,Stdfilled+1);
  240. freeblock(&temp);
  241. retStdout(Stdout,pwait&&pipw,!backblock);
  242. --- src/procmail.c Tue Sep 11 06:59:14 2001
  243. +++ src/procmail.c Sun Mar 30 21:13:45 2003
  244. @@ -652,8 +652,7 @@
  245. nrcond= -1;
  246. if(tolock) /* clear temporary buffer for lockfile name */
  247. free(tolock);
  248. - for(i=maxindex(flags);i;i--) /* clear the flags */
  249. - flags[i]=0;
  250. + bbzero(flags,sizeof(flags)); /* clear the flags */
  251. for(tolock=0,locknext=0;;)
  252. { chp=skpspace(chp);
  253. switch(i= *chp++)