1 |
commit: fc4c22fc0de9daba8b528c57a7f515a5da7bc332 |
2 |
Author: Rolf Eike Beer <eike <AT> sf-mail <DOT> de> |
3 |
AuthorDate: Sat Sep 21 18:08:04 2019 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 26 15:59:56 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc4c22fc |
7 |
|
8 |
net-mail/vpopmail: add some more patches |
9 |
|
10 |
I have been running all but the strncat patch on my server for years now. The |
11 |
strncat patch was taken from upstream bugtracker and looks sane to me. |
12 |
|
13 |
While at it also package the upgrade instructions and let the user look them up |
14 |
there. |
15 |
|
16 |
Closes: https://bugs.gentoo.org/472420 |
17 |
Closes: https://bugs.gentoo.org/479432 |
18 |
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de> |
19 |
Closes: https://github.com/gentoo/gentoo/pull/12990 |
20 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
21 |
|
22 |
...vpopmail-5.4.33-clean-up-calling-maildrop.patch | 74 ++++++ |
23 |
...n-case-spamassassin-changed-the-file-size.patch | 96 ++++++++ |
24 |
...se-vfork-instances-that-do-more-than-exec.patch | 77 ++++++ |
25 |
....4.33-remove-unneeded-forward-declaration.patch | 24 ++ |
26 |
.../vpopmail/files/vpopmail-5.4.33-strncat.patch | 166 +++++++++++++ |
27 |
.../vpopmail/files/vpopmail-5.4.33-unistd.patch | 9 + |
28 |
.../vpopmail-5.4.33-vdelivermail-add-static.patch | 34 +++ |
29 |
net-mail/vpopmail/vpopmail-5.4.33-r4.ebuild | 266 +++++++++++++++++++++ |
30 |
8 files changed, 746 insertions(+) |
31 |
|
32 |
diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-clean-up-calling-maildrop.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-clean-up-calling-maildrop.patch |
33 |
new file mode 100644 |
34 |
index 00000000000..c85c1b3150d |
35 |
--- /dev/null |
36 |
+++ b/net-mail/vpopmail/files/vpopmail-5.4.33-clean-up-calling-maildrop.patch |
37 |
@@ -0,0 +1,74 @@ |
38 |
+From 692e6f75056d93f0e9a024e3638259d5ba0fe398 Mon Sep 17 00:00:00 2001 |
39 |
+From: Rolf Eike Beer <eike@×××××××.de> |
40 |
+Date: Thu, 21 Aug 2014 17:55:27 +0200 |
41 |
+Subject: [PATCH 4/5] clean up calling maildrop |
42 |
+ |
43 |
+-add const for arguments |
44 |
+-do not prepend "| " to call for preline, run_command() will then just skip |
45 |
+ over this anyway |
46 |
+-put the buffer for the maildrop command in the most local scope |
47 |
+--- |
48 |
+ vdelivermail.c | 14 ++++++-------- |
49 |
+ 1 file changed, 6 insertions(+), 8 deletions(-) |
50 |
+ |
51 |
+diff --git a/vpopmail-5.4.33/vdelivermail.c b/vpopmail-5.4.33/vdelivermail.c |
52 |
+index be83a2a..2ad2e12 100644 |
53 |
+--- a/vdelivermail.c |
54 |
++++ b/vdelivermail.c |
55 |
+@@ -94,7 +94,7 @@ ssize_t get_message_size(); |
56 |
+ void deliver_mail(char *address, char *quota); |
57 |
+ int check_forward_deliver(char *dir); |
58 |
+ int is_looping( char *address ); |
59 |
+-void run_command(char *prog); |
60 |
++static void run_command(const char *prog); |
61 |
+ void checkuser(void); |
62 |
+ void usernotfound(void); |
63 |
+ int is_loop_match( const char *dt, const char *address); |
64 |
+@@ -360,9 +360,6 @@ static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t |
65 |
+ long unsigned pid; |
66 |
+ int pim[2]; |
67 |
+ #endif |
68 |
+-#ifdef MAILDROP |
69 |
+- char maildrop_command[256]; |
70 |
+-#endif |
71 |
+ |
72 |
+ /* write the Return-Path: and Delivered-To: headers */ |
73 |
+ if (headerlen > 0) { |
74 |
+@@ -409,7 +406,8 @@ static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t |
75 |
+ #ifdef MAILDROP |
76 |
+ if ( limits.disable_maildrop==0 && vpw!=NULL && |
77 |
+ !(vpw->pw_gid & NO_MAILDROP) ) { |
78 |
+- sprintf(maildrop_command, "| preline %s", MAILDROP_PROG); |
79 |
++ char maildrop_command[256]; |
80 |
++ sprintf(maildrop_command, "preline %s", MAILDROP_PROG); |
81 |
+ run_command(maildrop_command); |
82 |
+ DeleteMail = 1; |
83 |
+ return(0); |
84 |
+@@ -896,13 +894,13 @@ void (*f)(); |
85 |
+ /* open a pipe to a command |
86 |
+ * return the pid or -1 if error |
87 |
+ */ |
88 |
+-void run_command(char *prog) |
89 |
++void run_command(const char *prog) |
90 |
+ { |
91 |
+ |
92 |
+ #define MAX_ENV_BUFF 100 |
93 |
+ |
94 |
+ int child; |
95 |
+- char *(args[4]); |
96 |
++ const char *(args[4]); |
97 |
+ int wstat; |
98 |
+ |
99 |
+ while ((*prog == ' ') || (*prog == '|')) ++prog; |
100 |
+@@ -915,7 +913,7 @@ void run_command(char *prog) |
101 |
+ case 0: |
102 |
+ |
103 |
+ putenv("SHELL=/bin/sh"); |
104 |
+- args[0] = "/bin/sh"; args[1] = "-c"; args[2] = prog; args[3] = 0; |
105 |
++ args[0] = "/bin/sh"; args[1] = "-c"; args[2] = prog; args[3] = NULL; |
106 |
+ sig_catch(SIGPIPE,SIG_DFL); |
107 |
+ execv(*args,args); |
108 |
+ printf("Unable to run /bin/sh: %d.", errno); |
109 |
+-- |
110 |
+1.8.4.5 |
111 |
+ |
112 |
|
113 |
diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-fix-S-tag-in-case-spamassassin-changed-the-file-size.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-fix-S-tag-in-case-spamassassin-changed-the-file-size.patch |
114 |
new file mode 100644 |
115 |
index 00000000000..db22a6efde4 |
116 |
--- /dev/null |
117 |
+++ b/net-mail/vpopmail/files/vpopmail-5.4.33-fix-S-tag-in-case-spamassassin-changed-the-file-size.patch |
118 |
@@ -0,0 +1,96 @@ |
119 |
+From fd0a1034e3842ceb573851e62547b26a2b389263 Mon Sep 17 00:00:00 2001 |
120 |
+From: Rolf Eike Beer <eike@×××××××.de> |
121 |
+Date: Thu, 21 Aug 2014 18:48:52 +0200 |
122 |
+Subject: [PATCH 5/5] fix ,S= tag in case spamassassin changed the file size |
123 |
+ |
124 |
+--- |
125 |
+ vdelivermail.c | 24 +++++++++++++++++++++--- |
126 |
+ 1 file changed, 21 insertions(+), 3 deletions(-) |
127 |
+ |
128 |
+diff --git a/vpopmail-5.4.33/vdelivermail.c b/vpopmail-5.4.33/vdelivermail.c |
129 |
+index 2ad2e12..3631c3c 100644 |
130 |
+--- a/vdelivermail.c |
131 |
++++ b/vdelivermail.c |
132 |
+@@ -351,6 +351,12 @@ static pid_t qmail_inject_open(char *address) |
133 |
+ return(pid); |
134 |
+ } |
135 |
+ |
136 |
++/** |
137 |
++ * @returns if delivery worked |
138 |
++ * @retval 0 message was delivered as is |
139 |
++ * @retval 1 the file has changed the size during delivery |
140 |
++ * @retval -1 error |
141 |
++ */ |
142 |
+ static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t headerlen, char *address) |
143 |
+ { |
144 |
+ char msgbuf[4096]; |
145 |
+@@ -360,6 +366,7 @@ static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t |
146 |
+ long unsigned pid; |
147 |
+ int pim[2]; |
148 |
+ #endif |
149 |
++ int has_changed_size = 0; |
150 |
+ |
151 |
+ /* write the Return-Path: and Delivered-To: headers */ |
152 |
+ if (headerlen > 0) { |
153 |
+@@ -399,6 +406,7 @@ static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t |
154 |
+ close(pim[1]); |
155 |
+ dup2(pim[0], 0); |
156 |
+ close(pim[0]); |
157 |
++ has_changed_size = 1; |
158 |
+ } |
159 |
+ } |
160 |
+ #endif |
161 |
+@@ -431,7 +439,7 @@ static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t |
162 |
+ if ( write(write_fd, msgbuf, file_count) == -1 ) return -1; |
163 |
+ } |
164 |
+ |
165 |
+- return 0; |
166 |
++ return has_changed_size; |
167 |
+ } |
168 |
+ |
169 |
+ void read_quota_from_maildir (const char *maildir, char *qbuf, size_t qlen) |
170 |
+@@ -493,6 +501,7 @@ int deliver_to_maildir ( |
171 |
+ size_t headerlen; |
172 |
+ int write_fd; |
173 |
+ char quota[80]; |
174 |
++ int fdr; |
175 |
+ |
176 |
+ headerlen = strlen (extra_headers); |
177 |
+ msgsize += headerlen; |
178 |
+@@ -518,7 +527,8 @@ int deliver_to_maildir ( |
179 |
+ } |
180 |
+ |
181 |
+ local = 1; |
182 |
+- if (fdcopy(write_fd, read_fd, extra_headers, headerlen, maildir_to_email(maildir)) != 0) { |
183 |
++ fdr = fdcopy(write_fd, read_fd, extra_headers, headerlen, maildir_to_email(maildir)); |
184 |
++ if (fdr < 0) { |
185 |
+ /* Did the write fail because we were over quota? */ |
186 |
+ if ( errno == EDQUOT ) { |
187 |
+ close(write_fd); |
188 |
+@@ -530,6 +540,14 @@ int deliver_to_maildir ( |
189 |
+ unlink (local_file_tmp); |
190 |
+ return -2; |
191 |
+ } |
192 |
++ } else if (fdr == 1) { |
193 |
++ /* the file has changed it's size during delivery, e.g. because |
194 |
++ * SpamAssassin has written it's report to it. */ |
195 |
++ struct stat st; |
196 |
++ |
197 |
++ if (fstat(write_fd, &st) == 0 && st.st_size != msgsize) |
198 |
++ snprintf(local_file_new, sizeof(local_file_new), "%snew/%lu.%lu.%.32s,S=%lu", |
199 |
++ maildir, tm, pid, hostname, (long unsigned) st.st_size); |
200 |
+ } |
201 |
+ |
202 |
+ /* completed write to tmp directory, now move it into the new directory */ |
203 |
+@@ -777,7 +795,7 @@ void deliver_mail(char *address, char *quota) |
204 |
+ } |
205 |
+ |
206 |
+ local = 0; |
207 |
+- if (fdcopy (fdm, 0, DeliveredTo, strlen(DeliveredTo), address) != 0) { |
208 |
++ if (fdcopy (fdm, 0, DeliveredTo, strlen(DeliveredTo), address) < 0) { |
209 |
+ printf ("write to qmail-inject failed: %d\n", errno); |
210 |
+ close(fdm); |
211 |
+ waitpid(inject_pid,&child,0); |
212 |
+-- |
213 |
+1.8.4.5 |
214 |
+ |
215 |
|
216 |
diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-fix-those-vfork-instances-that-do-more-than-exec.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-fix-those-vfork-instances-that-do-more-than-exec.patch |
217 |
new file mode 100644 |
218 |
index 00000000000..4f154fcc8d3 |
219 |
--- /dev/null |
220 |
+++ b/net-mail/vpopmail/files/vpopmail-5.4.33-fix-those-vfork-instances-that-do-more-than-exec.patch |
221 |
@@ -0,0 +1,77 @@ |
222 |
+From de58b5d05fdabf2f17d8a6ec3ef804b59a013242 Mon Sep 17 00:00:00 2001 |
223 |
+From: Rolf Eike Beer <eike@×××××××.de> |
224 |
+Date: Thu, 21 Aug 2014 17:36:36 +0200 |
225 |
+Subject: [PATCH 2/5] fix those vfork() instances that do more than exec*() |
226 |
+ |
227 |
+--- |
228 |
+ vdelivermail.c | 4 ++-- |
229 |
+ vpopmail.c | 8 ++++---- |
230 |
+ vqmaillocal.c | 2 +- |
231 |
+ 3 files changed, 7 insertions(+), 7 deletions(-) |
232 |
+ |
233 |
+diff --git a/vpopmail-5.4.33/vdelivermail.c b/vpopmail-5.4.33/vdelivermail.c |
234 |
+index 241106e..be83a2a 100644 |
235 |
+--- a/vdelivermail.c |
236 |
++++ b/vdelivermail.c |
237 |
+@@ -330,7 +330,7 @@ static pid_t qmail_inject_open(char *address) |
238 |
+ |
239 |
+ if ( pipe(pim) == -1) return 0; |
240 |
+ |
241 |
+- switch(pid=vfork()){ |
242 |
++ switch(pid=fork()){ |
243 |
+ case -1: |
244 |
+ close(pim[0]); |
245 |
+ close(pim[1]); |
246 |
+@@ -381,7 +381,7 @@ static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t |
247 |
+ !(vpw->pw_gid & NO_SPAMASSASSIN) ) { |
248 |
+ |
249 |
+ if (!pipe(pim)) { |
250 |
+- pid = vfork(); |
251 |
++ pid = fork(); |
252 |
+ switch (pid) { |
253 |
+ case -1: |
254 |
+ close(pim[0]); |
255 |
+diff --git a/vpopmail-5.4.33/vpopmail.c b/vpopmail-5.4.33/vpopmail.c |
256 |
+index 5aaeb32..334a8ab 100644 |
257 |
+--- a/vpopmail.c |
258 |
++++ b/vpopmail.c |
259 |
+@@ -1473,9 +1473,9 @@ int update_newu() |
260 |
+ { |
261 |
+ int pid; |
262 |
+ |
263 |
+- pid=vfork(); |
264 |
++ pid=fork(); |
265 |
+ if ( pid==0){ |
266 |
+- umask(022); |
267 |
++ umask(022); |
268 |
+ execl(QMAILNEWU,"qmail-newu", NULL); |
269 |
+ exit(127); |
270 |
+ } else { |
271 |
+@@ -3366,9 +3366,9 @@ long unsigned tcprules_open() |
272 |
+ /* create a pair of filedescriptors for our pipe */ |
273 |
+ if (pipe(pim) == -1) { return(-1);} |
274 |
+ |
275 |
+- switch( pid=vfork()){ |
276 |
++ switch( pid=fork()){ |
277 |
+ case -1: |
278 |
+- /* vfork error. close pipes and exit */ |
279 |
++ /* fork error. close pipes and exit */ |
280 |
+ close(pim[0]); close(pim[1]); |
281 |
+ return(-1); |
282 |
+ case 0: |
283 |
+diff --git a/vpopmail-5.4.33/vqmaillocal.c b/vpopmail-5.4.33/vqmaillocal.c |
284 |
+index 6d3068c..80efa24 100644 |
285 |
+--- a/vqmaillocal.c |
286 |
++++ b/vqmaillocal.c |
287 |
+@@ -359,7 +359,7 @@ long unsigned qmail_inject_open(char *address) |
288 |
+ |
289 |
+ if ( pipe(pim) == -1) return(-1); |
290 |
+ |
291 |
+- switch(pid=vfork()){ |
292 |
++ switch(pid=fork()){ |
293 |
+ case -1: |
294 |
+ close(pim[0]); |
295 |
+ close(pim[1]); |
296 |
+-- |
297 |
+1.8.4.5 |
298 |
+ |
299 |
|
300 |
diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-remove-unneeded-forward-declaration.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-remove-unneeded-forward-declaration.patch |
301 |
new file mode 100644 |
302 |
index 00000000000..23ec43be024 |
303 |
--- /dev/null |
304 |
+++ b/net-mail/vpopmail/files/vpopmail-5.4.33-remove-unneeded-forward-declaration.patch |
305 |
@@ -0,0 +1,24 @@ |
306 |
+From 32ce986d86695dd55d4c888c30fe62b910b99f17 Mon Sep 17 00:00:00 2001 |
307 |
+From: Rolf Eike Beer <eike@×××××××.de> |
308 |
+Date: Thu, 21 Aug 2014 17:45:28 +0200 |
309 |
+Subject: [PATCH 3/5] remove unneeded forward declaration |
310 |
+ |
311 |
+--- |
312 |
+ vchkpw.c | 1 - |
313 |
+ 1 file changed, 1 deletion(-) |
314 |
+ |
315 |
+diff --git a/vpopmail-5.4.33/vchkpw.c b/vpopmail-5.4.33/vchkpw.c |
316 |
+index b1c8a5d..d7d4351 100644 |
317 |
+--- a/vchkpw.c |
318 |
++++ b/vchkpw.c |
319 |
+@@ -91,7 +91,6 @@ void login_system_user(); |
320 |
+ void read_user_pass(); |
321 |
+ void vlog(int verror, char *TheUser, char *TheDomain, char *ThePass, char *TheName, char *IpAddr, char *LogLine); |
322 |
+ void vchkpw_exit(int err); |
323 |
+-void run_command(char *prog); |
324 |
+ int authcram( char *response, char *challenge, char *password); |
325 |
+ int authapop( char *password, char *timestamp, char *clearpass); |
326 |
+ |
327 |
+-- |
328 |
+1.8.4.5 |
329 |
+ |
330 |
|
331 |
diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-strncat.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-strncat.patch |
332 |
new file mode 100644 |
333 |
index 00000000000..f3c9c71b299 |
334 |
--- /dev/null |
335 |
+++ b/net-mail/vpopmail/files/vpopmail-5.4.33-strncat.patch |
336 |
@@ -0,0 +1,166 @@ |
337 |
+https://sourceforge.net/p/vpopmail/patches/98/ |
338 |
+ |
339 |
+--- a/vpopmaild.c (revision 998) |
340 |
++++ b/vpopmaild.c (working copy) |
341 |
+@@ -1326,7 +1326,7 @@ |
342 |
+ } |
343 |
+ } |
344 |
+ snprintf(newpath, MAXPATH, "%s",myvpw->pw_dir); |
345 |
+- strncat(newpath, &path[i], MAXPATH ); |
346 |
++ strncat(newpath, &path[i], MAXPATH-strlen(newpath)-1); |
347 |
+ } else { /* may be domain name */ |
348 |
+ for(i=0;path[i]!='/'&&path[i]!=0&&i<256;++i) { |
349 |
+ thedomain[i] = path[i]; |
350 |
+@@ -1337,7 +1337,7 @@ |
351 |
+ return(9); |
352 |
+ } |
353 |
+ snprintf(newpath, MAXPATH, "%s", thedir); |
354 |
+- strncat(newpath, &path[i], MAXPATH ); |
355 |
++ strncat(newpath, &path[i], MAXPATH-strlen(newpath)-1); |
356 |
+ } |
357 |
+ } |
358 |
+ |
359 |
+@@ -1459,23 +1459,23 @@ |
360 |
+ } |
361 |
+ snprintf( WriteBuf, sizeof(WriteBuf), "%s", mydirent->d_name); |
362 |
+ if ( S_ISREG(statbuf.st_mode ) ) { |
363 |
+- strncat(WriteBuf," file", sizeof(WriteBuf)); |
364 |
++ strncat(WriteBuf," file", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
365 |
+ } else if ( S_ISDIR(statbuf.st_mode ) ) { |
366 |
+- strncat(WriteBuf," dir", sizeof(WriteBuf)); |
367 |
++ strncat(WriteBuf," dir", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
368 |
+ } else if ( S_ISCHR(statbuf.st_mode ) ) { |
369 |
+- strncat(WriteBuf," chardev", sizeof(WriteBuf)); |
370 |
++ strncat(WriteBuf," chardev", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
371 |
+ } else if ( S_ISBLK(statbuf.st_mode ) ) { |
372 |
+- strncat(WriteBuf," blkdev", sizeof(WriteBuf)); |
373 |
++ strncat(WriteBuf," blkdev", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
374 |
+ } else if ( S_ISFIFO(statbuf.st_mode ) ) { |
375 |
+- strncat(WriteBuf," fifo", sizeof(WriteBuf)); |
376 |
++ strncat(WriteBuf," fifo", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
377 |
+ } else if ( S_ISLNK(statbuf.st_mode ) ) { |
378 |
+- strncat(WriteBuf," link", sizeof(WriteBuf)); |
379 |
++ strncat(WriteBuf," link", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
380 |
+ } else if ( S_ISSOCK(statbuf.st_mode ) ) { |
381 |
+- strncat(WriteBuf," sock", sizeof(WriteBuf)); |
382 |
++ strncat(WriteBuf," sock", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
383 |
+ } else { |
384 |
+- strncat(WriteBuf," unknown", sizeof(WriteBuf)); |
385 |
++ strncat(WriteBuf," unknown", sizeof(WriteBuf)-strlen(WriteBuf)-1); |
386 |
+ } |
387 |
+- strncat(WriteBuf,RET_CRLF, sizeof(WriteBuf)); |
388 |
++ strncat(WriteBuf,RET_CRLF, sizeof(WriteBuf)-strlen(WriteBuf)-1); |
389 |
+ wait_write(); |
390 |
+ } |
391 |
+ if ( closedir(mydir) < 0 ) { |
392 |
+@@ -1604,7 +1604,7 @@ |
393 |
+ while(fgets(tmpbuf,sizeof(tmpbuf),fs)!=NULL){ |
394 |
+ if ( strcmp(tmpbuf, "." RET_CRLF) == 0 || strcmp(tmpbuf, ".\n") == 0 ) { |
395 |
+ snprintf(WriteBuf, sizeof(WriteBuf), "%s", "."); |
396 |
+- strncat(WriteBuf, tmpbuf, sizeof(WriteBuf)); |
397 |
++ strncat(WriteBuf, tmpbuf, sizeof(WriteBuf)-strlen(WriteBuf)-1); |
398 |
+ } else { |
399 |
+ memcpy(WriteBuf,tmpbuf,sizeof(tmpbuf)); |
400 |
+ } |
401 |
+--- a/vmysql.c (revision 998) |
402 |
++++ b/vmysql.c (working copy) |
403 |
+@@ -731,7 +731,7 @@ |
404 |
+ ); |
405 |
+ |
406 |
+ if ( sortit == 1 ) { |
407 |
+- strncat( SqlBufRead, " order by pw_name", SQL_BUF_SIZE); |
408 |
++ strncat( SqlBufRead, " order by pw_name", SQL_BUF_SIZE-strlen(SqlBufRead)-1); |
409 |
+ } |
410 |
+ |
411 |
+ if (res_read!=NULL) mysql_free_result(res_read_getall); |
412 |
+--- a/vldap.c (revision 998) |
413 |
++++ b/vldap.c (working copy) |
414 |
+@@ -1022,7 +1022,7 @@ |
415 |
+ |
416 |
+ /* if we are lucky the domain is in the assign file */ |
417 |
+ if ( vget_assign(domain,dir_control_file,MAX_DIR_NAME,NULL,NULL)!=NULL ) { |
418 |
+- strncat(dir_control_file, "/.dir-control", MAX_DIR_NAME); |
419 |
++ strncat(dir_control_file, "/.dir-control", MAX_DIR_NAME-strlen(dir_control_file)-1); |
420 |
+ |
421 |
+ /* it isn't in the assign file so we have to get it from /etc/passwd */ |
422 |
+ } else { |
423 |
+@@ -1041,7 +1041,7 @@ |
424 |
+ } |
425 |
+ |
426 |
+ /* stick on the rest of the path */ |
427 |
+- strncat(dir_control_file, "/" DOMAINS_DIR "/.dir-control", MAX_DIR_NAME); |
428 |
++ strncat(dir_control_file, "/" DOMAINS_DIR "/.dir-control", MAX_DIR_NAME-strlen(dir_control_file)-1); |
429 |
+ } |
430 |
+ return(dir_control_file); |
431 |
+ } |
432 |
+@@ -1177,7 +1177,7 @@ |
433 |
+ char dir_control_file[MAX_DIR_NAME]; |
434 |
+ |
435 |
+ vget_assign(domain, dir_control_file, 156, NULL,NULL); |
436 |
+- strncat(dir_control_file,"/.dir-control", MAX_DIR_NAME); |
437 |
++ strncat(dir_control_file,"/.dir-control", MAX_DIR_NAME-strlen(dir_control_file)-1); |
438 |
+ return(unlink(dir_control_file)); |
439 |
+ } |
440 |
+ |
441 |
+--- a/vpopmail.c (revision 998) |
442 |
++++ b/vpopmail.c (working copy) |
443 |
+@@ -1900,8 +1900,8 @@ |
444 |
+ |
445 |
+ // Copy the rest of the terms into the domain name |
446 |
+ for(j=1;j<i;j++) { |
447 |
+- strncat( domain, ".", MAX_BUFF ); |
448 |
+- strncat( domain, parts[j], MAX_BUFF ); |
449 |
++ strncat( domain, ".", MAX_BUFF-strlen(domain)-1); |
450 |
++ strncat( domain, parts[j], MAX_BUFF-strlen(domain)-1); |
451 |
+ } |
452 |
+ |
453 |
+ } |
454 |
+--- a/vcdb.c (revision 998) |
455 |
++++ b/vcdb.c (working copy) |
456 |
+@@ -271,7 +271,7 @@ |
457 |
+ } |
458 |
+ |
459 |
+ strncpy(line,user,sizeof(line)); |
460 |
+- strncat(line,":",sizeof(line)); |
461 |
++ strncat(line,":",sizeof(line)-strlen(line)-1); |
462 |
+ ptr = line; |
463 |
+ while (*ptr != ':') { ptr++; } |
464 |
+ ptr++; |
465 |
+@@ -1055,7 +1055,7 @@ |
466 |
+ char dir_control_file[MAX_DIR_NAME]; |
467 |
+ |
468 |
+ vget_assign(domain, dir_control_file, 156, NULL,NULL); |
469 |
+- strncat(dir_control_file,"/.dir-control", MAX_DIR_NAME); |
470 |
++ strncat(dir_control_file,"/.dir-control", MAX_DIR_NAME-strlen(dir_control_file)-1); |
471 |
+ return(unlink(dir_control_file)); |
472 |
+ } |
473 |
+ |
474 |
+@@ -1120,7 +1120,7 @@ |
475 |
+ |
476 |
+ /* if we are lucky the domain is in the assign file */ |
477 |
+ if ( vget_assign(domain,dir_control_file,MAX_DIR_NAME,NULL,NULL)!=NULL ) { |
478 |
+- strncat(dir_control_file, "/.dir-control", MAX_DIR_NAME); |
479 |
++ strncat(dir_control_file, "/.dir-control", MAX_DIR_NAME-strlen(dir_control_file)-1); |
480 |
+ |
481 |
+ /* it isn't in the assign file so we have to get it from /etc/passwd */ |
482 |
+ } else { |
483 |
+@@ -1139,7 +1139,7 @@ |
484 |
+ } |
485 |
+ |
486 |
+ /* stick on the rest of the path */ |
487 |
+- strncat(dir_control_file, "/" DOMAINS_DIR "/.dir-control", MAX_DIR_NAME); |
488 |
++ strncat(dir_control_file, "/" DOMAINS_DIR "/.dir-control", MAX_DIR_NAME-strlen(dir_control_file)-1); |
489 |
+ } |
490 |
+ return(dir_control_file); |
491 |
+ } |
492 |
+--- a/vpgsql.c (revision 998) |
493 |
++++ b/vpgsql.c (working copy) |
494 |
+@@ -522,7 +522,7 @@ |
495 |
+ #endif |
496 |
+ ); |
497 |
+ if ( sortit == 1 ) { |
498 |
+- strncat( SqlBufRead, " order by pw_name", SQL_BUF_SIZE); |
499 |
++ strncat( SqlBufRead, " order by pw_name", SQL_BUF_SIZE-strlen(SqlBufRead)-1); |
500 |
+ } |
501 |
+ if ( pgres ) { /* reset state if we had previous result */ |
502 |
+ PQclear(pgres); // clear previous result |
503 |
|
504 |
diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-unistd.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-unistd.patch |
505 |
new file mode 100644 |
506 |
index 00000000000..803276f89ad |
507 |
--- /dev/null |
508 |
+++ b/net-mail/vpopmail/files/vpopmail-5.4.33-unistd.patch |
509 |
@@ -0,0 +1,9 @@ |
510 |
+--- vpopmail-5.4.33-orig/cdb/cdb_seek.c 2019-09-25 23:01:01.332000000 +0200 |
511 |
++++ vpopmail-5.4.33/cdb/cdb_seek.c 2019-09-25 23:03:04.112000000 +0200 |
512 |
+@@ -1,5 +1,6 @@ |
513 |
+ #include <sys/types.h> |
514 |
+ #include <errno.h> |
515 |
++#include <unistd.h> |
516 |
+ #include "cdb.h" |
517 |
+ |
518 |
+ #ifndef SEEK_SET |
519 |
|
520 |
diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-vdelivermail-add-static.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-vdelivermail-add-static.patch |
521 |
new file mode 100644 |
522 |
index 00000000000..88306872b48 |
523 |
--- /dev/null |
524 |
+++ b/net-mail/vpopmail/files/vpopmail-5.4.33-vdelivermail-add-static.patch |
525 |
@@ -0,0 +1,34 @@ |
526 |
+From 31bef5aeeaf1e24eb40e84e41312dd6ae865ee03 Mon Sep 17 00:00:00 2001 |
527 |
+From: Rolf Eike Beer <eike@×××××××.de> |
528 |
+Date: Thu, 21 Aug 2014 17:34:27 +0200 |
529 |
+Subject: [PATCH 1/5] vdelivermail: add static |
530 |
+ |
531 |
+--- |
532 |
+ vdelivermail.c | 4 ++-- |
533 |
+ 1 file changed, 2 insertions(+), 2 deletions(-) |
534 |
+ |
535 |
+diff --git a/vpopmail-5.4.33/vdelivermail.c b/vpopmail-5.4.33/vdelivermail.c |
536 |
+index d94129f..241106e 100644 |
537 |
+--- a/vdelivermail.c |
538 |
++++ b/vdelivermail.c |
539 |
+@@ -322,7 +322,7 @@ int process_valias(void) |
540 |
+ #endif |
541 |
+ |
542 |
+ /* Forks off qmail-inject. Returns PID of child, or 0 for failure. */ |
543 |
+-pid_t qmail_inject_open(char *address) |
544 |
++static pid_t qmail_inject_open(char *address) |
545 |
+ { |
546 |
+ int pim[2]; |
547 |
+ pid_t pid; |
548 |
+@@ -351,7 +351,7 @@ pid_t qmail_inject_open(char *address) |
549 |
+ return(pid); |
550 |
+ } |
551 |
+ |
552 |
+-int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t headerlen, char *address) |
553 |
++static int fdcopy (int write_fd, int read_fd, const char *extra_headers, size_t headerlen, char *address) |
554 |
+ { |
555 |
+ char msgbuf[4096]; |
556 |
+ ssize_t file_count; |
557 |
+-- |
558 |
+1.8.4.5 |
559 |
+ |
560 |
|
561 |
diff --git a/net-mail/vpopmail/vpopmail-5.4.33-r4.ebuild b/net-mail/vpopmail/vpopmail-5.4.33-r4.ebuild |
562 |
new file mode 100644 |
563 |
index 00000000000..4b291b71351 |
564 |
--- /dev/null |
565 |
+++ b/net-mail/vpopmail/vpopmail-5.4.33-r4.ebuild |
566 |
@@ -0,0 +1,266 @@ |
567 |
+# Copyright 1999-2019 Gentoo Authors |
568 |
+# Distributed under the terms of the GNU General Public License v2 |
569 |
+ |
570 |
+EAPI=7 |
571 |
+ |
572 |
+inherit autotools eutils fixheadtails qmail user |
573 |
+ |
574 |
+HOMEPAGE="http://www.inter7.com/index.php?page=vpopmail" |
575 |
+DESCRIPTION="Collection of programs to manage virtual email on Qmail servers" |
576 |
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" |
577 |
+ |
578 |
+LICENSE="GPL-2" |
579 |
+SLOT="0" |
580 |
+KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
581 |
+IUSE="clearpasswd ipalias maildrop mysql postgres spamassassin" |
582 |
+REQUIRED_USE="mysql? ( !postgres )" |
583 |
+ |
584 |
+DEPEND=" |
585 |
+ acct-group/vpopmail |
586 |
+ virtual/qmail |
587 |
+ maildrop? ( mail-filter/maildrop ) |
588 |
+ mysql? ( dev-db/mysql-connector-c:0= ) |
589 |
+ postgres? ( dev-db/postgresql:=[server] ) |
590 |
+ spamassassin? ( mail-filter/spamassassin )" |
591 |
+RDEPEND="${DEPEND}" |
592 |
+ |
593 |
+PATCHES=( |
594 |
+ "${FILESDIR}"/${PN}-5.4.9-access.violation.patch |
595 |
+ "${FILESDIR}"/${PN}-lazy.patch |
596 |
+ "${FILESDIR}"/${PN}-vpgsql.patch |
597 |
+ "${FILESDIR}"/${PN}-double-free.patch |
598 |
+ "${FILESDIR}"/${PN}-5.4.33-vdelivermail-add-static.patch |
599 |
+ "${FILESDIR}"/${PN}-5.4.33-fix-those-vfork-instances-that-do-more-than-exec.patch |
600 |
+ "${FILESDIR}"/${PN}-5.4.33-remove-unneeded-forward-declaration.patch |
601 |
+ "${FILESDIR}"/${PN}-5.4.33-clean-up-calling-maildrop.patch |
602 |
+ "${FILESDIR}"/${PN}-5.4.33-fix-S-tag-in-case-spamassassin-changed-the-file-size.patch |
603 |
+ "${FILESDIR}"/${PN}-5.4.33-strncat.patch |
604 |
+ "${FILESDIR}"/${PN}-5.4.33-unistd.patch |
605 |
+) |
606 |
+DOCS=( |
607 |
+ doc/. |
608 |
+) |
609 |
+HTML_DOCS=( |
610 |
+ doc_html/. |
611 |
+ man_html/. |
612 |
+) |
613 |
+ |
614 |
+# This makes sure the variable is set, and that it isn't null. |
615 |
+VPOP_DEFAULT_HOME="/var/vpopmail" |
616 |
+ |
617 |
+vpopmail_set_homedir() { |
618 |
+ VPOP_HOME=$(egethome vpopmail) |
619 |
+ if [[ -z "${VPOP_HOME}" ]]; then |
620 |
+ eerror "vpopmail's home directory is null in passwd data!" |
621 |
+ eerror "You probably want to check that out." |
622 |
+ eerror "Continuing with default." |
623 |
+ VPOP_HOME="${VPOP_DEFAULT_HOME}" |
624 |
+ else |
625 |
+ einfo "Setting VPOP_HOME to: $VPOP_HOME" |
626 |
+ fi |
627 |
+} |
628 |
+ |
629 |
+pkg_setup() { |
630 |
+ enewuser vpopmail 89 -1 ${VPOP_DEFAULT_HOME} vpopmail |
631 |
+ upgradewarning |
632 |
+} |
633 |
+ |
634 |
+src_prepare() { |
635 |
+ default |
636 |
+ |
637 |
+ echo 'install-recursive: install-exec-am' \ |
638 |
+ >>"${S}"/Makefile.am |
639 |
+ |
640 |
+ # fix maildir paths |
641 |
+ sed -i -e 's|Maildir|.maildir|g' \ |
642 |
+ vchkpw.c vconvert.c vdelivermail.c \ |
643 |
+ vpopbull.c vpopmail.c vqmaillocal.c \ |
644 |
+ vuserinfo.c maildirquota.c || die |
645 |
+ |
646 |
+ # remove vpopmail advertisement |
647 |
+ sed -i -e '/printf.*vpopmail/s:vpopmail (:(:' \ |
648 |
+ vdelivermail.c vpopbull.c vqmaillocal.c || die |
649 |
+ |
650 |
+ # automake/autoconf |
651 |
+ mv -f "${S}"/configure.{in,ac} || die |
652 |
+ sed -i -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' \ |
653 |
+ configure.ac || die |
654 |
+ |
655 |
+ # _FORTIFY_SOURCE |
656 |
+ sed -i \ |
657 |
+ -e 's/\(snprintf(\s*\(LI->[a-zA-Z_]\+\),\s*\)[a-zA-Z_]\+,/\1 sizeof(\2),/' \ |
658 |
+ vlistlib.c || die |
659 |
+ |
660 |
+ eautoreconf |
661 |
+ ht_fix_file cdb/Makefile |
662 |
+} |
663 |
+ |
664 |
+src_configure() { |
665 |
+ vpopmail_set_homedir |
666 |
+ |
667 |
+ local authopts |
668 |
+ if use mysql; then |
669 |
+ incdir=$(mysql_config --variable=pkgincludedir || die) |
670 |
+ libdir=$(mysql_config --variable=pkglibdir || die) |
671 |
+ authopts+=" --enable-auth-module=mysql" |
672 |
+ authopts+=" --enable-incdir=${incdir}" |
673 |
+ authopts+=" --enable-libdir=${libdir}" |
674 |
+ authopts+=" --enable-sql-logging" |
675 |
+ authopts+=" --enable-valias" |
676 |
+ authopts+=" --disable-mysql-replication" |
677 |
+ authopts+=" --enable-mysql-limits" |
678 |
+ elif use postgres; then |
679 |
+ libdir=$(pg_config --libdir || die) |
680 |
+ incdir=$(pg_config --pkgincludedir || die) |
681 |
+ authopts+=" --enable-auth-module=pgsql" |
682 |
+ authopts+=" --enable-incdir=${incdir}" |
683 |
+ authopts+=" --enable-libdir=${libdir}" |
684 |
+ authopts+=" --enable-sql-logging" |
685 |
+ authopts+=" --enable-valias" |
686 |
+ else |
687 |
+ authopts+=" --enable-auth-module=cdb" |
688 |
+ fi |
689 |
+ |
690 |
+ econf ${authopts} \ |
691 |
+ --sysconfdir=${VPOP_HOME}/etc \ |
692 |
+ --enable-non-root-build \ |
693 |
+ --enable-qmaildir=${QMAIL_HOME} \ |
694 |
+ --enable-qmail-newu=${QMAIL_HOME}/bin/qmail-newu \ |
695 |
+ --enable-qmail-inject=${QMAIL_HOME}/bin/qmail-inject \ |
696 |
+ --enable-qmail-newmrh=${QMAIL_HOME}/bin/qmail-newmrh \ |
697 |
+ --enable-vpopuser=vpopmail \ |
698 |
+ --enable-vpopgroup=vpopmail \ |
699 |
+ --enable-many-domains \ |
700 |
+ --enable-file-locking \ |
701 |
+ --enable-file-sync \ |
702 |
+ --enable-md5-passwords \ |
703 |
+ --enable-logging \ |
704 |
+ --enable-auth-logging \ |
705 |
+ --enable-log-name=vpopmail \ |
706 |
+ --enable-qmail-ext \ |
707 |
+ --disable-tcpserver-file \ |
708 |
+ --disable-roaming-users \ |
709 |
+ $(use_enable ipalias ip-alias-domains) \ |
710 |
+ $(use_enable clearpasswd clear-passwd) \ |
711 |
+ $(use_enable maildrop) \ |
712 |
+ $(use_enable maildrop maildrop-prog /usr/bin/maildrop) \ |
713 |
+ $(use_enable spamassassin) |
714 |
+} |
715 |
+ |
716 |
+src_install() { |
717 |
+ vpopmail_set_homedir |
718 |
+ |
719 |
+ emake DESTDIR="${D}" install |
720 |
+ keepdir "${VPOP_HOME}"/domains |
721 |
+ |
722 |
+ # install helper script for maildir conversion |
723 |
+ into "${VPOP_HOME}" |
724 |
+ dobin "${FILESDIR}"/vpopmail-Maildir-dotmaildir-fix.sh |
725 |
+ into /usr |
726 |
+ |
727 |
+ mv doc/doc_html/ doc/man_html/ . || die |
728 |
+ einstalldocs |
729 |
+ rm -r "${D}/${VPOP_HOME}"/doc || die |
730 |
+ dosym \ |
731 |
+ $(realpath --relative-to "${D}/${VPOP_HOME}"/ "${D}"/usr/share/doc/${PF}/ || die) \ |
732 |
+ "${VPOP_HOME}"/doc |
733 |
+ |
734 |
+ # create /etc/vpopmail.conf |
735 |
+ if use mysql; then |
736 |
+ insinto /etc |
737 |
+ newins "${D}${VPOP_HOME}"/etc/vpopmail.mysql vpopmail.conf |
738 |
+ dosym \ |
739 |
+ $(realpath --relative-to "${D}/${VPOP_HOME}"/etc/ "${D}"/etc/vpopmail.conf || die) \ |
740 |
+ "${VPOP_HOME}"/etc/vpopmail.mysql |
741 |
+ |
742 |
+ sed -e '12d' -i "${D}"/etc/vpopmail.conf || die |
743 |
+ echo '# Read-only DB' >> "${D}"/etc/vpopmail.conf |
744 |
+ echo 'localhost|0|vpopmail|secret|vpopmail' >> "${D}"/etc/vpopmail.conf |
745 |
+ echo '# Write DB' >> "${D}"/etc/vpopmail.conf |
746 |
+ echo 'localhost|0|vpopmail|secret|vpopmail' >> "${D}"/etc/vpopmail.conf |
747 |
+ |
748 |
+ # lock down perms |
749 |
+ fperms 640 /etc/vpopmail.conf |
750 |
+ fowners root:vpopmail /etc/vpopmail.conf |
751 |
+ fi |
752 |
+ |
753 |
+ insinto "${VPOP_HOME}"/etc |
754 |
+ doins vusagec.conf |
755 |
+ dosym "${VPOP_HOME}"/etc/vusagec.conf /etc/vusagec.conf |
756 |
+ sed -i 's/Disable = False;/Disable = True;/g' "${D}${VPOP_HOME}"/etc/vusagec.conf || die |
757 |
+ |
758 |
+ einfo "Installing env.d entry" |
759 |
+ dodir /etc/env.d |
760 |
+ doenvd "${FILESDIR}"/99vpopmail |
761 |
+ |
762 |
+ einfo "Locking down vpopmail permissions" |
763 |
+ fowners -R root:0 "${VPOP_HOME}"/{bin,etc,include} |
764 |
+ fowners root:vpopmail "${VPOP_HOME}"/bin/vchkpw |
765 |
+ fperms 4711 "${VPOP_HOME}"/bin/vchkpw |
766 |
+} |
767 |
+ |
768 |
+pkg_postinst() { |
769 |
+ if use mysql ; then |
770 |
+ elog |
771 |
+ elog "You have 'mysql' turned on in your USE" |
772 |
+ elog "Vpopmail needs a VALID MySQL USER. Let's call it 'vpopmail'" |
773 |
+ elog "You MUST add it and then specify its passwd in the /etc/vpopmail.conf file" |
774 |
+ elog |
775 |
+ elog "First log into mysql as your mysql root user and pass. Then:" |
776 |
+ elog "> create database vpopmail;" |
777 |
+ elog "> use mysql;" |
778 |
+ elog "> grant select, insert, update, delete, create, drop on vpopmail.* to" |
779 |
+ elog " vpopmail@localhost identified by 'your password';" |
780 |
+ elog "> flush privileges;" |
781 |
+ elog |
782 |
+ elog "If you have problems with vpopmail not accepting mail properly," |
783 |
+ elog "please ensure that /etc/vpopmail.conf is chmod 640 and" |
784 |
+ elog "owned by root:vpopmail" |
785 |
+ elog |
786 |
+ fi |
787 |
+ |
788 |
+ # do this for good measure |
789 |
+ if [[ -e /etc/vpopmail.conf ]]; then |
790 |
+ chmod 640 /etc/vpopmail.conf || die |
791 |
+ chown root:vpopmail /etc/vpopmail.conf || die |
792 |
+ fi |
793 |
+ |
794 |
+ upgradewarning |
795 |
+} |
796 |
+ |
797 |
+pkg_postrm() { |
798 |
+ vpopmail_set_homedir |
799 |
+ |
800 |
+ elog "The vpopmail DATA will NOT be removed automatically." |
801 |
+ elog "You can delete them manually by removing the ${VPOP_HOME} directory." |
802 |
+} |
803 |
+ |
804 |
+upgradewarning() { |
805 |
+ ewarn |
806 |
+ ewarn "Massive important warning if you are upgrading to 5.2.1-r8 or older" |
807 |
+ ewarn "The internal structure of the mail storage has changed for" |
808 |
+ ewarn "consistancy with the rest of Gentoo! Please review and utilize the " |
809 |
+ ewarn "script at ${VPOP_HOME}/bin/vpopmail-Maildir-dotmaildir-fix.sh" |
810 |
+ ewarn "to upgrade your system! (It can do conversions both ways)." |
811 |
+ ewarn "You should be able to run it right away without any changes." |
812 |
+ ewarn |
813 |
+ |
814 |
+ elog |
815 |
+ elog "Use of vpopmail's tcp.smtp[.cdb] is also deprecated now, consider" |
816 |
+ elog "using net-mail/relay-ctrl instead." |
817 |
+ elog |
818 |
+ |
819 |
+ if use mysql; then |
820 |
+ elog |
821 |
+ elog "If you are upgrading from 5.4.17 or older, you have to fix your" |
822 |
+ elog "MySQL tables, please see the UPGRADE file in the documentation!" |
823 |
+ elog |
824 |
+ fi |
825 |
+ |
826 |
+ ewarn |
827 |
+ ewarn "Newer versions of vpopmail contain a quota daemon called vusaged." |
828 |
+ ewarn "This ebuild DOES NOT INSTALL vusaged and has therefore disabled" |
829 |
+ ewarn "its usage in ${VPOP_HOME}/etc/vusagec.conf. DO NOT ENABLE!" |
830 |
+ ewarn "Otherwise mail delivery WILL BREAK" |
831 |
+ ewarn |
832 |
+} |