summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/procmail
diff options
context:
space:
mode:
authorLi xin <lixin.fnst@cn.fujitsu.com>2014-12-02 17:21:46 +0800
committerMartin Jansa <Martin.Jansa@gmail.com>2014-12-09 11:34:42 +0100
commit8bb82f0851b6fe687ad8090a5c7fd6976b523ab6 (patch)
tree2968ee32dd52c7e3fffcf94a5246ff3785b60758 /meta-oe/recipes-support/procmail
parent8cd982aeeaf0d7c00f3495e6a5a44c35cb7854da (diff)
downloadmeta-openembedded-8bb82f0851b6fe687ad8090a5c7fd6976b523ab6.tar.gz
procmail: add new recipe
Procmail can be used to create mail-servers, mailing lists, sort your incoming mail into separate folders/files,preprocess your mail, start any programs upon mail arrival or selectively forward certain incoming mail automatically to someone. Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-support/procmail')
-rw-r--r--meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-compile-errors.patch606
-rw-r--r--meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-man-file.patch83
-rw-r--r--meta-oe/recipes-support/procmail/procmail/from-debian-to-modify-parameters.patch127
-rw-r--r--meta-oe/recipes-support/procmail/procmail/man-file-mailstat.1-from-debian.patch60
-rw-r--r--meta-oe/recipes-support/procmail/procmail_3.22.bb44
5 files changed, 920 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-compile-errors.patch b/meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-compile-errors.patch
new file mode 100644
index 000000000..8341a8ecd
--- /dev/null
+++ b/meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-compile-errors.patch
@@ -0,0 +1,606 @@
1From 898e9514bc889b4a540f667efed95a5af101c824 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 2 Dec 2014 07:00:36 +0900
4Subject: [PATCH 1/3] From debian to fix compile errors
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 src/Makefile.0 | 7 +++----
9 src/autoconf | 64 +++++++++++++-------------------------------------------
10 src/comsat.c | 65 +++++++++++++++++++--------------------------------------
11 src/fields.c | 6 +++---
12 src/foldinfo.h | 2 +-
13 src/formail.c | 6 +++---
14 src/formisc.c | 2 +-
15 src/formisc.h | 2 +-
16 src/mailfold.c | 14 ++++++++++---
17 src/manconf.c | 2 +-
18 src/memblk.c | 24 ++++++++++-----------
19 src/memblk.h | 2 +-
20 src/network.h | 10 ++-------
21 src/pipes.c | 10 ++++-----
22 src/procmail.c | 3 +--
23 src/recommend.c | 2 +-
24 16 files changed, 81 insertions(+), 140 deletions(-)
25
26diff --git a/src/Makefile.0 b/src/Makefile.0
27index 6eb5b51..15a2039 100644
28--- a/src/Makefile.0
29+++ b/src/Makefile.0
30@@ -40,7 +40,7 @@ multigram: multigram.$(O) $(MG_OBJ) setid
31 @cd ..; $(MAKE) config.check
32
33 _autotst: _autotst.$(O) sublib.c sublib.h
34- $(CC) $(CFLAGS) $@.$(O) -o $@ $(LDFLAGS)
35+ gcc $@.$(O) -o $@ $(LDFLAGS)
36
37 ../autoconf.h: autoconf Makefile ../patchlevel.h
38 @echo No this was not make -n >make_n
39@@ -175,17 +175,16 @@ recommend: recommend.$(O) sublib.$(O)
40
41 ../man/man.sed: manconf.c ../autoconf.h ../config.h includes.h procmail.h
42 ../man/man.sed: ../patchlevel.h
43- @$(CC) $(CFLAGS) "-DBINDIR=\"$(VISIBLE_BINDIR)\"" -o _autotst \
44+ gcc "-DBINDIR=\"$(VISIBLE_BINDIR)\"" -o _autotst \
45 manconf.c $(LDFLAGS)
46 @./_autotst $@
47 @echo Housekeeping file >$@
48- @$(RM) _autotst
49
50 clean:
51 $(RM) -r _locktest
52 $(RM) procmail.$(O) $(PM_OBJ) lockfile.$(O) $(LF_OBJ) formail.$O \
53 $(FM_OBJ) multigram.$(O) $(MG_OBJ) $(BINSS) multigram ../autoconf.h \
54- _autotst* lookfor _locktst* grepfor recommend recommend.$(O) manconf \
55+ lookfor _locktst* grepfor recommend recommend.$(O) manconf \
56 _Makefile lock.log *core* targetdir.h setid setid.$(O) gethome \
57 gethome.$(O) make_n realloc.log
58
59diff --git a/src/autoconf b/src/autoconf
60index 1cb4c42..ff78048 100755
61--- a/src/autoconf
62+++ b/src/autoconf
63@@ -68,8 +68,6 @@
64 # #define NOfsync
65 #Ok #define endpwent()
66 #Ok #define endgrent()
67-#Ok #define endhostent()
68-#Ok #define endservent()
69 #Ok #define endprotoent()
70 # #define h_0addr_list h_addr
71 #Ok #define NOpw_passwd
72@@ -896,7 +894,7 @@ int main(){int i=0;
73 {uid_t vuid_t;i+=vuid_t=1;}
74 {gid_t vgid_t;i+=vgid_t=1;}
75 #ifndef NO_COMSAT
76- {struct hostent vhostent;i+=!(vhostent.h_addr_list=0);}
77+ {struct addrinfo res; i+=!(res.ai_socktype=0);}
78 #endif
79 #ifndef NOuname
80 {struct utsname vutsname;i+=!(*vutsname.nodename='\0');}
81@@ -917,8 +915,6 @@ do
82 test -z "$i3" && grepfor mode_t 'typedef int mode_t;' && i3=I
83 test -z "$i4" && grepfor uid_t 'typedef int uid_t;' && i4=I
84 test -z "$i5" && grepfor gid_t 'typedef int gid_t;' && i5=I
85- test -z "$i6" && grepfor h_addr_list '#define h_0addr_list h_addr' && i6=I
86- test -z "$i6" && grepfor hostent '#define h_0addr_list h_addr' && i6=I
87 test -z "$i6" && grepfor member '#define h_0addr_list h_addr' && i6=I
88 test -z "$i7" && grepfor utsname "#define NOuname \
89 /* <sys/utsname.h> is there, but empty */" && i7=I
90@@ -1048,8 +1044,12 @@ int main(){char a[2];
91 {struct utsname b;uname(&b);}
92 #endif
93 #ifndef NO_COMSAT
94- gethostbyname("0");getprotobyname(COMSATprotocol);endhostent();endservent();
95- endprotoent();
96+ {
97+ struct addrinfo *res, hints;
98+ memset(&hints, '\0', sizeof(hints));
99+ if(getaddrinfo(COMSAThost,BIFF_serviceport,&hints,&res))
100+ freeaddrinfo(res);
101+ }
102 #endif
103 _exit(0);
104 return 0;}
105@@ -1103,14 +1103,9 @@ grepfor uname "\
106 /* <sys/utsname.h> defines it, the libraries don't */"
107 grepfor endpwent '#define endpwent()'
108 grepfor endgrent '#define endgrent()'
109-if grepfor gethostbyname '#define NO_COMSAT'
110+if grepfor getaddrinfo '#define NO_COMSAT'
111 then
112 :
113-else
114- grepfor getprotobyname '#define UDP_protocolno 17'
115- grepfor endhostent '#define endhostent()'
116- grepfor endservent '#define endservent()'
117- grepfor endprotoent '#define endprotoent()'
118 fi
119 grepfor strstr '#define SLOWstrstr' ||
120 grepfor clock '#define SLOWstrstr'
121@@ -1239,39 +1234,9 @@ int main(argc,argv)int argc;const char*argv[];
122 printf("/* Insufficient memory to perform the benchmark! */\n");
123 #endif /* SLOWstrstr */
124 #ifndef NO_COMSAT
125-#ifndef UDP_protocolno
126- ;{ const struct protoent*p;
127- if(p=getprotobyname(COMSATprotocol))
128- { printf("#define UDP_protocolno %d\n",p->p_proto);
129-#else
130- ;{ if(1)
131- {
132-#endif
133- ;{ const struct servent*serv;
134- if(serv=getservbyname(COMSATservice,COMSATprotocol))
135- printf("#define BIFF_serviceport \"%d\"\n",
136- ntohs(serv->s_port));
137- }
138-#ifdef AF_INET
139- ;{ const struct hostent*host;
140- if(!strcmp("localhost",COMSAThost)&&
141- (host=gethostbyname(COMSAThost))&&
142- host->h_0addr_list&&host->h_addrtype==AF_INET&&
143- host->h_length)
144- { int j=host->h_length;
145- const unsigned char*ad=(void*)host->h_0addr_list;
146- printf("#define IP_localhost {");
147- printf("%d",*ad++);
148- while(--j)
149- printf(",%d",*ad++);
150- puts("}");
151- }
152- }
153+#ifndef AF_INET
154+ puts("#define NO_COMSAT");
155 #endif /* AF_INET */
156- }
157- else
158- puts("#define NO_COMSAT");
159- }
160 #endif /* NO_COMSAT */
161 ;{ unsigned long s=(size_t)~0;int bits;
162 for(bits=1;s>>=1;bits++);
163@@ -1470,15 +1435,14 @@ cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
164 grep 'Mlocal.*procmail' >$DEVNULL ||
165 echo '#define CF_no_procmail_yet' >>$ACONF
166
167-cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
168- grep '^V' >$DEVNULL ||
169- echo '#define buggy_SENDMAIL' >>$ACONF
170+# cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
171+# grep '^V' >$DEVNULL ||
172+# echo '#define buggy_SENDMAIL' >>$ACONF
173
174 lpath='/bin'
175 bins="/bin"
176
177-for newd in /usr/bin /usr/ucb /usr/5bin $BINDIR /local/bin /usr/local/bin \
178- /global/bin /usr/bin/X11 /usr/X*/bin
179+for newd in /usr/bin $BINDIR /usr/bin/X11 /usr/X*/bin
180 do
181 if test -d $newd
182 then
183diff --git a/src/comsat.c b/src/comsat.c
184index 77dba34..5082b16 100644
185--- a/src/comsat.c
186+++ b/src/comsat.c
187@@ -27,7 +27,8 @@ static /*const*/char rcsid[]=
188 #include "comsat.h"
189
190 static int csvalid; /* is it turned on with a good address? */
191-static struct sockaddr_in csaddr;
192+static struct addrinfo cai;
193+static struct sockaddr *csaddr;
194 static char*cslastf,*cslgname;
195
196 void setlfcs(folder)const char*folder; /* set lastfolder for comsat */
197@@ -62,56 +63,32 @@ void setlgcs(name)const char*name; /* set logname for comsat */
198 }
199
200 int setcomsat(chp)const char*chp;
201-{ char*chad;int newvalid; struct sockaddr_in newaddr;
202+{ char*chad;int newvalid; struct addrinfo *res, hints;
203 chad=strchr(chp,SERV_ADDRsep); /* @ separator? */
204 if(!chad&&!renvint(-1L,chp))
205 return csvalid=0; /* turned off comsat */
206 newvalid=1;
207 if(chad)
208 *chad++='\0'; /* split the specifier */
209+ if(!chad||!*chp) /* no service */
210+ chp=BIFF_serviceport; /* new balls please! */
211 if(!chad||!*chad) /* no host */
212-#ifndef IP_localhost /* Is "localhost" preresolved? */
213 chad=COMSAThost; /* nope, use default */
214-#else /* IP_localhost */
215- { static const unsigned char ip_localhost[]=IP_localhost;
216- newaddr.sin_family=AF_INET;
217- tmemmove(&newaddr.sin_addr,ip_localhost,sizeof ip_localhost);
218- }
219- else
220-#endif /* IP_localhost */
221- { const struct hostent*host; /* what host? paranoid checks */
222- if(!(host=gethostbyname(chad))||!host->h_0addr_list)
223- { bbzero(&newaddr.sin_addr,sizeof newaddr.sin_addr);
224- newvalid=0; /* host can't be found, too bad */
225- }
226- else
227- { newaddr.sin_family=host->h_addrtype; /* address number found */
228- tmemmove(&newaddr.sin_addr,host->h_0addr_list,host->h_length);
229- }
230- endhostent();
231- }
232- if(newvalid) /* so far, so good */
233- { int s;
234- if(!*chp) /* no service */
235- chp=BIFF_serviceport; /* new balls please! */
236- s=strtol(chp,&chad,10);
237- if(chp!=chad) /* the service is not numeric */
238- newaddr.sin_port=htons((short)s); /* network order */
239- else
240- { const struct servent*serv;
241- serv=getservbyname(chp,COMSATprotocol); /* so get its no. */
242- if(serv)
243- newaddr.sin_port=serv->s_port;
244- else
245- { newaddr.sin_port=htons((short)0); /* no such service */
246- newvalid=0;
247- }
248- endservent();
249- }
250- }
251+ bzero(&hints,sizeof(hints));
252+ hints.ai_socktype=SOCK_DGRAM;
253+ hints.ai_flags=AI_ADDRCONFIG;
254+ if(getaddrinfo(chad,chp,&hints,&res))
255+ newvalid=0;
256+
257 onguard(); /* update the address atomically */
258 if(csvalid=newvalid)
259- tmemmove(&csaddr,&newaddr,sizeof(newaddr));
260+ { if(csaddr)
261+ free(csaddr);
262+ csaddr=malloc(res->ai_addrlen);
263+ tmemmove(csaddr,res->ai_addr,res->ai_addrlen);
264+ tmemmove(&cai,res,sizeof(cai));
265+ freeaddrinfo(res);
266+ }
267 offguard();
268 return newvalid;
269 }
270@@ -120,7 +97,7 @@ void sendcomsat(folder)const char*folder;
271 { int s;const char*p;
272 if(!csvalid||!buf) /* is comat on and set to a valid address? */
273 return;
274- if(!*cslgname||strlen(cslgname)+2>linebuf) /* is $LOGNAME bogus? */
275+ if(!cslgname||!*cslgname||strlen(cslgname)+2>linebuf)/* is $LOGNAME bogus? */
276 return;
277 if(!(p=folder?folder:cslastf)) /* do we have a folder? */
278 return;
279@@ -132,8 +109,8 @@ void sendcomsat(folder)const char*folder;
280 }
281 strlcat(buf,COMSATxtrsep,linebuf); /* custom seperator */
282 strlcat(buf,p,linebuf); /* where was it delivered? */
283- if((s=socket(AF_INET,SOCK_DGRAM,UDP_protocolno))>=0)
284- { sendto(s,buf,strlen(buf),0,(struct sockaddr*)&csaddr,sizeof(csaddr));
285+ if((s=socket(cai.ai_family,cai.ai_socktype,cai.ai_protocol))>=0)
286+ { sendto(s,buf,strlen(buf),0,csaddr,cai.ai_addrlen);
287 rclose(s);
288 yell("Notified comsat:",buf);
289 }
290diff --git a/src/fields.c b/src/fields.c
291index a2bd77f..37ed154 100644
292--- a/src/fields.c
293+++ b/src/fields.c
294@@ -110,16 +110,16 @@ void dispfield(p)register const struct field*p;
295 /* try and append one valid field to rdheader from stdin */
296 int readhead P((void))
297 { int idlen;
298- getline();
299+ get_line();
300 if((idlen=breakfield(buf,buffilled))<=0) /* not the start of a valid field */
301 return 0;
302 if(idlen==STRLEN(FROM)&&eqFrom_(buf)) /* it's a From_ line */
303 { if(rdheader)
304 return 0; /* the From_ line was a fake! */
305- for(;buflast=='>';getline()); /* gather continued >From_ lines */
306+ for(;buflast=='>';get_line()); /* gather continued >From_ lines */
307 }
308 else
309- for(;;getline()) /* get the rest of the continued field */
310+ for(;;get_line()) /* get the rest of the continued field */
311 { switch(buflast) /* will this line be continued? */
312 { case ' ':case '\t': /* yep, it sure is */
313 continue;
314diff --git a/src/foldinfo.h b/src/foldinfo.h
315index 9e4ebb6..797f9be 100644
316--- a/src/foldinfo.h
317+++ b/src/foldinfo.h
318@@ -10,7 +10,7 @@
319
320 #define ft_lock(type) ((type)>ft_MAILDIR) /* kernel lock fd */
321 #define ft_atime(type) ((type)==ft_FILE) /* force atime < mtime */
322-#define ft_dotlock(type) ((type)==ft_FILE) /* dotlock $DEFAULT */
323+#define ft_dotlock(type) ((type)>ft_MAILDIR) /* dotlock $DEFAULT */
324 #define ft_delim(type) ((type)==ft_FILE) /* add MMDF delim */
325 #define ft_checkcloser(type) ((type)>ft_MH)
326 #define ft_forceblank(type) ((type)!=ft_MAILDIR) /* force blank line at end */
327diff --git a/src/formail.c b/src/formail.c
328index fe5e6be..1f5c9dd 100644
329--- a/src/formail.c
330+++ b/src/formail.c
331@@ -758,9 +758,9 @@ startover:
332 lputssn(buf,buffilled),ctlength-=buffilled,buffilled=lnl=0;
333 ;{ int tbl=buflast,lwr='\n';
334 while(--ctlength>=0&&tbl!=EOF) /* skip Content-Length: bytes */
335- lnl=lwr==tbl&&lwr=='\n',putcs(lwr=tbl),tbl=getchar();
336+ lnl=lwr==tbl&&lwr=='\n',lputcs(lwr=tbl),tbl=getchar();
337 if((buflast=tbl)=='\n'&&lwr!=tbl) /* just before a line break? */
338- putcs('\n'),buflast=getchar(); /* wrap up loose end */
339+ lputcs('\n'),buflast=getchar(); /* wrap up loose end */
340 }
341 if(!quiet&&ctlength>0)
342 { charNUM(num,ctlength);
343@@ -819,7 +819,7 @@ splitit: { if(!lnl) /* did the previous mail end with an empty line? */
344 { if(split) /* gobble up the next start separator */
345 { buffilled=0;
346 #ifdef sMAILBOX_SEPARATOR
347- getline();buffilled=0; /* but only if it's defined */
348+ get_line();buffilled=0; /* but only if it's defined */
349 #endif
350 if(buflast!=EOF) /* if any */
351 goto splitit;
352diff --git a/src/formisc.c b/src/formisc.c
353index d6cab90..338733b 100644
354--- a/src/formisc.c
355+++ b/src/formisc.c
356@@ -115,7 +115,7 @@ void loadchar(c)const int c; /* append one character to buf */
357 buf[buffilled++]=c;
358 }
359
360-int getline P((void)) /* read a newline-terminated line */
361+int get_line P((void)) /* read a newline-terminated line */
362 { if(buflast==EOF) /* at the end of our Latin already? */
363 { loadchar('\n'); /* fake empty line */
364 return EOF; /* spread the word */
365diff --git a/src/formisc.h b/src/formisc.h
366index 1c4ca20..f25211c 100644
367--- a/src/formisc.h
368+++ b/src/formisc.h
369@@ -17,4 +17,4 @@ void
370 char*
371 skipwords P((char*start));
372 int
373- getline P((void));
374+ get_line P((void));
375diff --git a/src/mailfold.c b/src/mailfold.c
376index 917b502..6c8bcf4 100644
377--- a/src/mailfold.c
378+++ b/src/mailfold.c
379@@ -30,6 +30,7 @@ static /*const*/char rcsid[]=
380
381 int logopened,rawnonl;
382 off_t lasttell;
383+static int trunced;
384 static long lastdump;
385 static volatile int mailread; /* if the mail is completely read in already */
386 static struct dyna_array confield; /* escapes, concatenations */
387@@ -81,6 +82,7 @@ long dump(s,type,source,len)const int s,type;const char*source;
388 long len;
389 { int i;long part;
390 lasttell=i= -1;SETerrno(EBADF);
391+ trunced=0;
392 if(s>=0)
393 { if(ft_lock(type)&&(lseek(s,(off_t)0,SEEK_END),fdlock(s)))
394 nlog("Kernel-lock failed\n");
395@@ -120,13 +122,18 @@ jin: while(part&&(i=rwrite(s,source,BLKSIZ<part?BLKSIZ:(int)part)))
396 }
397 writefin:
398 i=type!=ft_PIPE&&fsync(s)&&errno!=EINVAL; /* EINVAL => wasn't a file */
399+ if ((i||len)&&lasttell>=0)
400+ { int serrno=errno;
401+ if(!ftruncate(s,lasttell)) trunced=1;
402+ SETerrno(serrno);
403+ }
404 if(ft_lock(type))
405 { int serrno=errno; /* save any error information */
406 if(fdunlock())
407 nlog("Kernel-unlock failed\n");
408 SETerrno(serrno);
409 }
410- i=rclose(s)||i;
411+ i=rclose(s)||i; /* if this fails, we should truncate, but it's too late */
412 } /* return an error even if nothing was to be sent */
413 return i&&!len?-1:len;
414 }
415@@ -237,7 +244,7 @@ dumpf: { switch(errno)
416 #endif
417 default:writeerr(buf);
418 }
419- if(lasttell>=0&&!truncate(boxname,lasttell)&&(logopened||verbose))
420+ if(lasttell>=0&&trunced&&(logopened||verbose))
421 nlog("Truncated file to former size\n"); /* undo garbage */
422 ret0: return 0;
423 }
424@@ -378,7 +385,8 @@ void readmail(rhead,tobesent)const long tobesent;
425 dfilled=mailread=0;
426 else if(rhead) /* only read in a new header */
427 { memblk new;
428- dfilled=mailread=0;makeblock(&new,0);readdyn(&new,&dfilled,0);
429+ dfilled=mailread=0;makeblock(&new,0);
430+ readdyn(&new,&dfilled,thebody-themail.p);
431 if(tobesent>dfilled&&isprivate) /* put it in place here */
432 { tmemmove(themail.p+dfilled,thebody,filled-=tobesent);
433 tmemmove(themail.p,new.p,dfilled);
434diff --git a/src/manconf.c b/src/manconf.c
435index a9e9f1c..5c8ec36 100644
436--- a/src/manconf.c
437+++ b/src/manconf.c
438@@ -233,7 +233,7 @@ a security violation was found (e.g. \1.B \2-@PRESERVOPT@\1or variable\
439 \2-@PRESERVOPT@\1and\1.BR \2-@FROMWHOPT@ .\1");
440 pc("LMTPOPT",LMTPOPT);
441 #else
442- ps("LMTPOPTdesc","");ps("LMTPusage","");
443+ ps("LMTPOPTdesc","");ps("LMTPusage","\1");
444 #endif
445 pname("INIT_UMASK",0);printf("0%lo/g\n",(unsigned long)INIT_UMASK);lines--;
446 pn("DEFlinebuf",DEFlinebuf);
447diff --git a/src/memblk.c b/src/memblk.c
448index e2f13f0..97e02d3 100644
449--- a/src/memblk.c
450+++ b/src/memblk.c
451@@ -51,11 +51,11 @@ void lockblock(mb)memblk*const mb;
452 {
453 #ifdef USE_MMAP
454 if(mb->fd>=0)
455- { long len=mb->len+1;
456- if(munmap(mb->p,len))
457- mmapfailed(len); /* don't want to continue here */
458- if((mb->p=mmap(0,len,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
459- mmapfailed(len);
460+ { long mlen=mb->len+1;
461+ if(munmap(mb->p,mlen))
462+ mmapfailed(mlen); /* don't want to continue here */
463+ if((mb->p=mmap(0,mlen,PROT_READ,MAP_PRIVATE,mb->fd,(off_t)0))==MAP_FAILED)
464+ mmapfailed(mlen);
465 close(mb->fd);
466 mb->fd=ropen(devnull,O_RDWR,0); /* XXX Perhaps -1 is better? */
467 }
468@@ -77,8 +77,8 @@ int resizeblock(mb,len,nonfatal)memblk*const mb;const long len;
469 strcpy(filename,MMAP_DIR);
470 if(unique(filename,strchr(filename,'\0'),MMAP_FILE_LEN,MMAP_PERM,0,0)&&
471 (mb->fd=ropen(filename,O_RDWR,MMAP_PERM),unlink(filename),mb->fd>=0))
472- { mb->filelen=len;
473- if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
474+ { mb->filelen=len+1;
475+ if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
476 dropf: { close(mb->fd);mb->fd= -1;
477 if(verbose)nlog("Unable to extend or use tempfile");
478 }
479@@ -98,9 +98,9 @@ dropf: { close(mb->fd);mb->fd= -1;
480 }
481 }
482 if(mb->fd>=0)
483- { if(len>mb->filelen) /* need to extend? */
484- { mb->filelen=len;
485- if(lseek(mb->fd,mb->filelen-1,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
486+ { if(len>=mb->filelen) /* need to extend? */
487+ { mb->filelen=len+1;
488+ if(lseek(mb->fd,len,SEEK_SET)<0||1!=rwrite(mb->fd,empty,1))
489 { char*p=malloc(len+1); /* can't extend, switch to malloc */
490 tmemmove(p,mb->p,mb->len);
491 munmap(mb->p,mb->len+1);
492@@ -124,9 +124,9 @@ mmap: if((mb->p=mmap(0,len+1,P_RW,MAP_SHARED,mb->fd,(off_t)0))==MAP_FAILED)
493 }
494 else
495 mb->p=realloc(mb->p,len+1);
496- mb->len=len+1;
497- mb->p[len]='\0';
498+ mb->len=len;
499 ret1:
500+ mb->p[len]='\0';
501 return 1;
502 }
503
504diff --git a/src/memblk.h b/src/memblk.h
505index 6fd1d1d..b57f369 100644
506--- a/src/memblk.h
507+++ b/src/memblk.h
508@@ -1,6 +1,6 @@
509 typedef struct memblk {
510 char*p; /* where it starts */
511- long len; /* currently allocated size */
512+ long len; /* current size, not including trailing NUL */
513 #ifdef USE_MMAP
514 off_t filelen; /* how long is the file */
515 int fd; /* file which is mmap()ed */
516diff --git a/src/network.h b/src/network.h
517index d7d08f2..b09b6c4 100644
518--- a/src/network.h
519+++ b/src/network.h
520@@ -1,19 +1,13 @@
521 /*$Id: network.h,v 1.7 1997/04/02 03:15:41 srb Exp $*/
522
523-#include <sys/socket.h> /* socket() sendto() AF_INET
524+#include <sys/socket.h> /* socket() sendto() */
525 /* SOCK_DGRAM */
526-#include <netdb.h> /* gethostbyname() getservbyname()
527- /* getprotobyname() */
528-#include <netinet/in.h> /* htons() struct sockaddr_in */
529+#include <netdb.h> /* getaddrinfo() */
530
531 #ifndef BIFF_serviceport
532 #define BIFF_serviceport COMSATservice
533 #endif
534
535-#ifndef h_0addr_list
536-#define h_0addr_list h_addr_list[0] /* POSIX struct member */
537-#endif
538-
539 #ifndef NO_const /* since network.h is outside the autoconf const check */
540 #ifdef const /* loop, we need this backcheck for some systems */
541 #undef const
542diff --git a/src/pipes.c b/src/pipes.c
543index 1fdb9e6..7754300 100644
544--- a/src/pipes.c
545+++ b/src/pipes.c
546@@ -145,7 +145,9 @@ int pipthrough(line,source,len)char*line,*source;const long len;
547 if(Stdout)
548 { *(eq=strchr(Stdout,'\0')-1)='\0'; /* chop the '=' */
549 if(!(backblock=getenv(Stdout))) /* no current value? */
550- PRDB=PWRB= -1;
551+ { PRDB=PWRB= -1;
552+ backlen=0;
553+ }
554 else
555 { backlen=strlen(backblock);
556 goto pip;
557@@ -155,9 +157,7 @@ int pipthrough(line,source,len)char*line,*source;const long len;
558 pip: rpipe(pbackfd);
559 rpipe(pinfd); /* main pipes setup */
560 if(!(pidchild=sfork())) /* create a sending procmail */
561- { if(Stdout&&backblock)
562- backlen=strlen(backblock);
563- else
564+ { if(!Stdout)
565 backblock=source,backlen=len;
566 childsetup();rclose(PRDI);rclose(PRDB);
567 rpipe(poutfd);rclose(STDOUT);
568@@ -194,7 +194,7 @@ perr: progerr(line,excode,pwait==4); /* I'm going to tell my mommy! */
569 makeblock(&temp,Stdfilled);
570 tmemmove(temp.p,Stdout,Stdfilled);
571 readdyn(&temp,&Stdfilled,Stdfilled+backlen+1);
572- Stdout=realloc(Stdout,&Stdfilled+1);
573+ Stdout=realloc(Stdout,Stdfilled+1);
574 tmemmove(Stdout,temp.p,Stdfilled+1);
575 freeblock(&temp);
576 retStdout(Stdout,pwait&&pipw,!backblock);
577diff --git a/src/procmail.c b/src/procmail.c
578index 4a232f2..2bb449b 100644
579--- a/src/procmail.c
580+++ b/src/procmail.c
581@@ -652,8 +652,7 @@ commint:do skipspace(); /* skip whitespace */
582 nrcond= -1;
583 if(tolock) /* clear temporary buffer for lockfile name */
584 free(tolock);
585- for(i=maxindex(flags);i;i--) /* clear the flags */
586- flags[i]=0;
587+ bbzero(flags,sizeof(flags)); /* clear the flags */
588 for(tolock=0,locknext=0;;)
589 { chp=skpspace(chp);
590 switch(i= *chp++)
591diff --git a/src/recommend.c b/src/recommend.c
592index 5d41e01..9002268 100644
593--- a/src/recommend.c
594+++ b/src/recommend.c
595@@ -47,7 +47,7 @@ int main(argc,argv)const int argc;const char*const argv[];
596 printf("chmod %lo %s\n",(unsigned long)(sgid|PERMIS),argv[2]);
597 else if(chmdir==1)
598 goto nogchmod;
599- if(chmdir)
600+ if(0)
601 printf("chmod %c+w %s/.\n",chmdir==1?'g':'a',mailspooldir);
602 nogchmod:
603 return EXIT_SUCCESS;
604--
6051.8.4.2
606
diff --git a/meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-man-file.patch b/meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-man-file.patch
new file mode 100644
index 000000000..7b3c643b2
--- /dev/null
+++ b/meta-oe/recipes-support/procmail/procmail/from-debian-to-fix-man-file.patch
@@ -0,0 +1,83 @@
1From 3cbc5e6e624235f9ba40cfd5a2b18c11be371399 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 2 Dec 2014 07:02:01 +0900
4Subject: [PATCH 2/3] From debian to fix man file
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 man/procmail.man | 24 +++++++++++++++++-------
9 man/procmailrc.man | 2 +-
10 2 files changed, 18 insertions(+), 8 deletions(-)
11
12diff --git a/man/procmail.man b/man/procmail.man
13index 175043a..1274ce8 100644
14--- a/man/procmail.man
15+++ b/man/procmail.man
16@@ -44,11 +44,11 @@ at the end.
17 should be invoked automatically over the
18 .B @DOT_FORWARD@
19 file mechanism as soon as mail arrives. Alternatively, when installed by
20-a system administrator, it can be invoked from within the mailer immediately.
21-When invoked, it first sets some environment variables to default values,
22-reads the mail message from stdin until an EOF, separates the body from the
23-header, and then, if no command line arguments are present, it starts to look
24-for a file named
25+a system administrator (and in the standard Red Hat Linux configuration), it
26+can be invoked from within the mailer immediately. When invoked, it
27+first sets some environment variables to default values, reads the mail message from
28+stdin until an EOF, separates the body from the header, and then, if no command line
29+arguments are present, it starts to look for a file named
30 .BR @PROCMAILRC@ .
31 According to the processing recipes in this file,
32 the mail message that just arrived gets distributed into the right folder
33@@ -166,7 +166,8 @@ must be specified on the command line. After the rcfile, procmail will
34 accept an unlimited number of arguments.@ETCRCS_desc@
35 For some advanced usage of this option you should look in the
36 .B EXAMPLES
37-section below.@LMTPOPTdesc@.SH ARGUMENTS
38+section below.@LMTPOPTdesc@
39+.SH ARGUMENTS
40 Any arguments containing an '=' are considered to be environment variable
41 assignments, they will
42 .I all
43@@ -723,6 +724,15 @@ path.@FW_comment@
44 .fi
45 .ad
46 .PP
47+Some mailers (notably exim) do not currently accept the above syntax.
48+In such case use this instead:
49+.PP
50+.na
51+.nf
52+|/usr/bin/procmail
53+.fi
54+.ad
55+.PP
56 Procmail can also be invoked to postprocess an already filled system
57 mailbox. This can be useful if you don't want to or can't use a
58 $HOME/@DOT_FORWARD@ file (in which case the following script could
59@@ -754,7 +764,7 @@ exit 0
60 .SS "A sample small @PROCMAILRC@:"
61 .na
62 .nf
63-PATH=/bin:/usr/bin:@BINDIR@
64+PATH=/usr/local/bin:/usr/bin:/bin
65 MAILDIR=$HOME/Mail #you'd better make sure it exists
66 DEFAULT=$MAILDIR/mbox #completely optional
67 LOGFILE=$MAILDIR/from #recommended
68diff --git a/man/procmailrc.man b/man/procmailrc.man
69index 472035f..7bf08dd 100644
70--- a/man/procmailrc.man
71+++ b/man/procmailrc.man
72@@ -779,7 +779,7 @@ one trailing newline will be stripped.
73 .PP
74 Some non-optimal and non-obvious regexps set MATCH to an incorrect
75 value. The regexp can be made to work by removing one or more unneeded
76-'*', '+', or '?' operator on the left-hand side of the \e/ token.
77+\&'*', '+', or '?' operator on the left-hand side of the \e/ token.
78 .SH MISCELLANEOUS
79 If the regular expression contains `\fB@TO_key@\fP' it will be substituted by
80 .na
81--
821.8.4.2
83
diff --git a/meta-oe/recipes-support/procmail/procmail/from-debian-to-modify-parameters.patch b/meta-oe/recipes-support/procmail/procmail/from-debian-to-modify-parameters.patch
new file mode 100644
index 000000000..a94e43670
--- /dev/null
+++ b/meta-oe/recipes-support/procmail/procmail/from-debian-to-modify-parameters.patch
@@ -0,0 +1,127 @@
1From 95c742242769721f963c50702e1445fb70c6a45a Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 2 Dec 2014 07:07:33 +0900
4Subject: [PATCH 3/3] From debian to modify parameters
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 Makefile | 16 ++++++++--------
9 config.h | 13 +++++++------
10 2 files changed, 15 insertions(+), 14 deletions(-)
11
12diff --git a/Makefile b/Makefile
13index 1e9568c..9e48201 100644
14--- a/Makefile
15+++ b/Makefile
16@@ -23,7 +23,7 @@ MAN5DIR = $(MANDIR)/man$(MAN5SUFFIX)
17
18 # Uncomment to install compressed man pages (possibly add extra suffix
19 # to the definitions of MAN?DIR and/or MAN?SUFFIX by hand)
20-#MANCOMPRESS = compress
21+# MANCOMPRESS = compress
22
23 ############################*#
24 # Things that can be made are:
25@@ -55,7 +55,7 @@ MAN5DIR = $(MANDIR)/man$(MAN5SUFFIX)
26
27 LOCKINGTEST=__defaults__
28
29-#LOCKINGTEST=/tmp . # Uncomment and add any directories you see fit.
30+LOCKINGTEST=/tmp . # Uncomment and add any directories you see fit.
31 # If LOCKINGTEST is defined, autoconf will NOT
32 # prompt you to enter additional directories.
33 # See INSTALL for more information about the
34@@ -65,7 +65,7 @@ LOCKINGTEST=__defaults__
35 # Only edit below this line if you *think* you know what you are doing #
36 ########################################################################
37
38-#LOCKINGTEST=100 # Uncomment (and change) if you think you know
39+LOCKINGTEST=100 # Uncomment (and change) if you think you know
40 # it better than the autoconf lockingtests.
41 # This will cause the lockingtests to be hotwired.
42 # 100 to enable fcntl()
43@@ -74,20 +74,20 @@ LOCKINGTEST=__defaults__
44 # Or them together to get the desired combination.
45
46 # Optional system libraries we search for
47-SEARCHLIBS = -lm -ldir -lx -lsocket -lnet -linet -lnsl_s -lnsl_i -lnsl -lsun \
48- -lgen -lsockdns -ldl
49+SEARCHLIBS = -lm -ldir -lx -lsocket -lnet -linet -lnsl_s -lnsl_i -lsun \
50+ -lgen -lsockdns
51 # -lresolv # not really needed, is it?
52
53 # Informal list of directories where we look for the libraries in SEARCHLIBS
54-LIBPATHS=/lib /usr/lib /usr/local/lib
55+LIBPATHS=/lib /usr/lib
56
57 GCC_WARNINGS = -O2 -pedantic -Wreturn-type -Wunused -Wformat -Wtraditional \
58 -Wpointer-arith -Wconversion -Waggregate-return \
59 #-Wimplicit -Wshadow -Wid-clash-6 #-Wuninitialized
60
61 # The place to put your favourite extra cc flag
62-CFLAGS0 = -O #$(GCC_WARNINGS)
63-LDFLAGS0= -s
64+CFLAGS0 = $(RPM_OPT_FLAGS) #$(GCC_WARNINGS)
65+LDFLAGS0=
66 # Read my libs :-)
67 LIBS=
68
69diff --git a/config.h b/config.h
70index c4135a9..a07453f 100644
71--- a/config.h
72+++ b/config.h
73@@ -35,7 +35,8 @@
74 */
75 /*#define DEFSPATH "PATH=/bin:/usr/bin" /* */
76 /*#define DEFPATH "PATH=$HOME/bin:/bin:/usr/bin" /* */
77-
78+#define DEFPATH "PATH=$HOME/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin" /* */
79+
80 /* every environment variable appearing in PRESTENV will be set or wiped
81 * out of the environment (variables without an '=' sign will be thrown
82 * out), e.g. you could define PRESTENV as follows:
83@@ -46,13 +47,13 @@
84 */
85 #define PRESTENV {"IFS","ENV","PWD",0}
86
87-/*#define GROUP_PER_USER /* uncomment this if each
88+#define GROUP_PER_USER /* uncomment this if each
89 user has his or her own
90 group and procmail can therefore trust a $HOME/.procmailrc that
91 is group writable or contained in a group writable home directory
92 if the group involved is the user's default group. */
93
94-/*#define LMTP /* uncomment this if you
95+#define LMTP /* uncomment this if you
96 want to use procmail
97 as an LMTP (rfc2033) server, presumably for invocation by an MTA.
98 The file examples/local_procmail_lmtp.m4 contains info on how to
99@@ -79,7 +80,7 @@
100
101 /*#define NO_fcntl_LOCK /* uncomment any of these three if you */
102 /*#define NO_lockf_LOCK /* definitely do not want procmail to make */
103-/*#define NO_flock_LOCK /* use of those kernel-locking methods */
104+#define NO_flock_LOCK /* use of those kernel-locking methods */
105 /* If you set LOCKINGTEST to a binary number
106 than there's no need to set these. These #defines are only useful
107 if you want to disable particular locking styles but are unsure which
108@@ -91,14 +92,14 @@
109 restriction does not apply to the /etc/procmailrc and
110 /etc/procmailrcs files) */
111
112-/*#define NO_NFS_ATIME_HACK /* uncomment if you're definitely not using
113+#define NO_NFS_ATIME_HACK /* uncomment if you're definitely not using
114 NFS mounted filesystems and can't afford
115 procmail to sleep for 1 sec. before writing to an empty regular
116 mailbox. This lets programs correctly judge whether there is unread
117 mail present. procmail automatically suppresses this when it isn't
118 needed or under heavy load. */
119
120-/*#define DEFsendmail "/usr/sbin/sendmail" /* uncomment and/or change if
121+#define DEFsendmail "/usr/sbin/sendmail" /* uncomment and/or change if
122 the autoconfigured default
123 SENDMAIL is not suitable. This program should quack like a sendmail:
124 it should accept the -oi flag (to tell it to _not_ treat a line
125--
1261.8.4.2
127
diff --git a/meta-oe/recipes-support/procmail/procmail/man-file-mailstat.1-from-debian.patch b/meta-oe/recipes-support/procmail/procmail/man-file-mailstat.1-from-debian.patch
new file mode 100644
index 000000000..46d973e06
--- /dev/null
+++ b/meta-oe/recipes-support/procmail/procmail/man-file-mailstat.1-from-debian.patch
@@ -0,0 +1,60 @@
1From 8ac56108e5f0a72d1bec0fb4f1fa4763a2479331 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Tue, 2 Dec 2014 06:56:14 +0900
4Subject: [PATCH] man file mailstat.1 from debian
5
6Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
7---
8 debian/mailstat.1 | 40 ++++++++++++++++++++++++++++++++++++++++
9 1 file changed, 40 insertions(+)
10 create mode 100644 debian/mailstat.1
11
12diff --git a/debian/mailstat.1 b/debian/mailstat.1
13new file mode 100644
14index 0000000..f13265a
15--- /dev/null
16+++ b/debian/mailstat.1
17@@ -0,0 +1,40 @@
18+.TH MAILSTAT 1
19+.SH NAME
20+mailstat \- shows mail-arrival statistics
21+.SH SYNOPSIS
22+.B mailstat
23+[\-klmots] [logfile]
24+.SH DESCRIPTION
25+.B mailstat
26+parses a procmail-generated $LOGFILE and displays
27+a summary about the messages delivered to all folders
28+(total size, average size, nr of messages).
29+The $LOGFILE is truncated to zero length, unless the
30+.B -k
31+option is used.
32+Exit code 0 if mail arrived, 1 if no mail arrived.
33+.SH OPTIONS
34+.TP
35+.I \-k
36+keep logfile intact
37+.TP
38+.I \-l
39+long display format
40+.TP
41+.I \-m
42+merge any errors into one line
43+.TP
44+.I \-o
45+use the old logfile
46+.TP
47+.I \-t
48+terse display format
49+.TP
50+.I \-s
51+silent in case of no mail
52+.SH NOTES
53+Customise to your heart's content, this program is only provided as a
54+guideline.
55+.SH AUTHOR
56+This manual page was written by Santiago Vila <sanvila@debian.org>
57+for the Debian GNU/Linux distribution (but may be used by others).
58--
591.8.4.2
60
diff --git a/meta-oe/recipes-support/procmail/procmail_3.22.bb b/meta-oe/recipes-support/procmail/procmail_3.22.bb
new file mode 100644
index 000000000..dacda28f6
--- /dev/null
+++ b/meta-oe/recipes-support/procmail/procmail_3.22.bb
@@ -0,0 +1,44 @@
1SUMMARY = "Mail processing program"
2DESCRIPTION = "Procmail can be used to create mail-servers, mailing lists, sort your\
3incoming mail into separate folders/files (real convenient when subscribing\
4to one or more mailing lists or for prioritising your mail), preprocess\
5your mail, start any programs upon mail arrival (e.g. to generate different\
6chimes on your workstation for different types of mail) or selectively\
7forward certain incoming mail automatically to someone."
8HOMEPAGE = "http://www.procmail.org/"
9SECTION = "Applications/System"
10
11SRC_URI = "http://www.ring.gr.jp/archives/net/mail/${PN}/${BP}.tar.gz \
12 file://from-debian-to-fix-compile-errors.patch \
13 file://from-debian-to-modify-parameters.patch \
14 file://from-debian-to-fix-man-file.patch \
15 file://man-file-mailstat.1-from-debian.patch"
16SRC_URI[md5sum] = "1678ea99b973eb77eda4ecf6acae53f1"
17SRC_URI[sha256sum] = "087c75b34dd33d8b9df5afe9e42801c9395f4bf373a784d9bc97153b0062e117"
18
19LICENSE = "GPL-2.0 Artistic-1.0"
20LIC_FILES_CHKSUM = "file://COPYING;md5=a71e50e197a992c862379e576e669757 \
21 file://Artistic;md5=505e00d03c3428cde21b17b2a386590e"
22
23DEPENDS = "libnet"
24inherit autotools-brokensep
25do_configure() {
26 find examples -type f | xargs chmod 644
27 export CC="${BUILD_CC}"
28 export LD="${BUILD_LD}"
29 export CFLAGS="${BUILD_CFLAGS}"
30 export AR="${BUILD_AR}"
31 export AS="${BUILD_AS}"
32 make TARGET_CFLAGS="$TARGET_CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" autoconf.h
33}
34
35do_compile() {
36 oe_runmake -i TARGET_CFLAGS="$TARGET_CFLAGS -Wno-comments -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
37}
38
39do_install() {
40 install -d ${D}${bindir}
41 install -d ${D}${mandir}/man{1,5}
42 oe_runmake -i BASENAME=${D}/usr MANDIR=${D}${mandir} install
43 install -m 0644 debian/mailstat.1 ${D}${mandir}/man1
44}