Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/vpopmail/, net-mail/vpopmail/files/
Date: Sun, 17 Nov 2019 09:30:45
Message-Id: 1573983035.6248c40cc4b4411223a9a4f1bf98204c4c05f147.mgorny@gentoo
1 commit: 6248c40cc4b4411223a9a4f1bf98204c4c05f147
2 Author: Rolf Eike Beer <eike <AT> sf-mail <DOT> de>
3 AuthorDate: Sat Oct 26 17:30:11 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 17 09:30:35 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6248c40c
7
8 net-mail/vpopmail: add 2 more patches
9
10 Things I hit during testing.
11
12 Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de>
13 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
14
15 ...-5.4.33-check-crypt-return-value-for-NULL.patch | 146 ++++++++++++
16 ...l-5.4.33-use-proper-printf-format-strings.patch | 217 ++++++++++++++++++
17 net-mail/vpopmail/vpopmail-5.4.33-r5.ebuild | 249 +++++++++++++++++++++
18 3 files changed, 612 insertions(+)
19
20 diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-check-crypt-return-value-for-NULL.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-check-crypt-return-value-for-NULL.patch
21 new file mode 100644
22 index 00000000000..cfe5ce90e07
23 --- /dev/null
24 +++ b/net-mail/vpopmail/files/vpopmail-5.4.33-check-crypt-return-value-for-NULL.patch
25 @@ -0,0 +1,146 @@
26 +From b3a21a4a6d7af3dc14417c89ec2ef2732a24939b Mon Sep 17 00:00:00 2001
27 +From: Rolf Eike Beer <eike@×××××××.de>
28 +Date: Sat, 26 Oct 2019 18:14:13 +0200
29 +Subject: [PATCH 1/2] check crypt() return value for NULL
30 +
31 +Passing NULL to strcmp() would lead to a crash otherwise.
32 +---
33 + vcdb.c | 7 ++++++-
34 + vchkpw.c | 11 +++++++++--
35 + vldap.c | 8 +++++++-
36 + vmysql.c | 8 +++++++-
37 + vpgsql.c | 8 +++++++-
38 + vsybase.c | 8 +++++++-
39 + 6 files changed, 43 insertions(+), 7 deletions(-)
40 +
41 +diff --git a/vcdb.c b/vcdb.c
42 +index 55c1cb5..1bf9cd8 100644
43 +--- a/vcdb.c
44 ++++ b/vcdb.c
45 +@@ -1160,7 +1160,12 @@ void vcdb_strip_char( char *instr )
46 +
47 + int vauth_crypt(char *user,char *domain,char *clear_pass,struct vqpasswd *vpw)
48 + {
49 ++ const char *c;
50 + if ( vpw == NULL ) return(-1);
51 +
52 +- return(strcmp(crypt(clear_pass,vpw->pw_passwd),vpw->pw_passwd));
53 ++ c = crypt(clear_pass,vpw->pw_passwd);
54 ++
55 ++ if ( c == NULL ) return(-1);
56 ++
57 ++ return(strcmp(c,vpw->pw_passwd));
58 + }
59 +diff --git a/vchkpw.c b/vchkpw.c
60 +index d7d4351..a7c4b9e 100644
61 +--- a/vchkpw.c
62 ++++ b/vchkpw.c
63 +@@ -607,6 +607,7 @@ void login_system_user()
64 + struct spwd *spw;
65 + #endif
66 + struct passwd *pw;
67 ++ const char *c;
68 +
69 + if ((pw=getpwnam(TheUser)) == NULL ) {
70 + snprintf(LogLine, sizeof(LogLine), "%s: system user not found %s:%s",
71 +@@ -626,9 +627,15 @@ void login_system_user()
72 + vchkpw_exit(22);
73 + }
74 +
75 +- if ( strcmp(crypt(ThePass,spw->sp_pwdp),spw->sp_pwdp) != 0 ) {
76 ++ c = crypt(ThePass,spw->sp_pwdp);
77 ++
78 ++ if ( c == NULL ) vchkpw_exit(24);
79 ++ if ( strcmp(c,spw->sp_pwdp) != 0 ) {
80 + #else
81 +- if ( strcmp(crypt(ThePass,pw->pw_passwd),pw->pw_passwd) != 0 ) {
82 ++ c = crypt(ThePass,pw->pw_passwd);
83 ++
84 ++ if ( c == NULL ) vchkpw_exit(24);
85 ++ if ( strcmp(c,pw->pw_passwd) != 0 ) {
86 + #endif
87 + if (ENABLE_LOGGING==1||ENABLE_LOGGING==2) {
88 + snprintf(LogLine, sizeof(LogLine), "%s: system password fail %s:%s",
89 +diff --git a/vldap.c b/vldap.c
90 +index 75329ef..5fcce99 100644
91 +--- a/vldap.c
92 ++++ b/vldap.c
93 +@@ -1495,10 +1495,16 @@ void *safe_malloc (size_t siz) {
94 + /***************************************************************************/
95 +
96 + int vauth_crypt(char *user,char *domain,char *clear_pass,struct vqpasswd *vpw) {
97 ++ const char *c;
98 ++
99 + if ( vpw == NULL )
100 + return(-1);
101 +
102 +- return(strcmp(crypt(clear_pass,vpw->pw_passwd),vpw->pw_passwd));
103 ++ c = crypt(clear_pass,vpw->pw_passwd);
104 ++
105 ++ if ( c == NULL ) return(-1);
106 ++
107 ++ return(strcmp(c,vpw->pw_passwd));
108 + }
109 +
110 + /***************************************************************************/
111 +diff --git a/vmysql.c b/vmysql.c
112 +index 4215a39..c5173d9 100644
113 +--- a/vmysql.c
114 ++++ b/vmysql.c
115 +@@ -1862,7 +1862,13 @@ int vdel_limits(const char *domain)
116 + /************************************************************************/
117 + int vauth_crypt(char *user,char *domain,char *clear_pass,struct vqpasswd *vpw)
118 + {
119 ++ const char *c;
120 ++
121 + if ( vpw == NULL ) return(-1);
122 +
123 +- return(strcmp(crypt(clear_pass,vpw->pw_passwd),vpw->pw_passwd));
124 ++ c = crypt(clear_pass,vpw->pw_passwd);
125 ++
126 ++ if ( c == NULL ) return(-1);
127 ++
128 ++ return(strcmp(c,vpw->pw_passwd));
129 + }
130 +diff --git a/vpgsql.c b/vpgsql.c
131 +index c55b9e2..b5dd40b 100644
132 +--- a/vpgsql.c
133 ++++ b/vpgsql.c
134 +@@ -1667,8 +1667,14 @@ void vcreate_vlog_table()
135 +
136 + int vauth_crypt(char *user,char *domain,char *clear_pass,struct vqpasswd *vpw)
137 + {
138 ++ const char *c;
139 ++
140 + if ( vpw == NULL ) return(-1);
141 +
142 +- return(strcmp(crypt(clear_pass,vpw->pw_passwd),vpw->pw_passwd));
143 ++ c = crypt(clear_pass,vpw->pw_passwd);
144 ++
145 ++ if ( c == NULL ) return(-1);
146 ++
147 ++ return(strcmp(c,vpw->pw_passwd));
148 + }
149 +
150 +diff --git a/vsybase.c b/vsybase.c
151 +index c6d7234..26f7447 100644
152 +--- a/vsybase.c
153 ++++ b/vsybase.c
154 +@@ -640,7 +640,13 @@ int vshow_ip_map( int first, char *ip, char *domain);
155 +
156 + int vauth_crypt(char *user,char *domain,char *clear_pass,struct vqpasswd *vpw)
157 + {
158 ++ const char *c;
159 ++
160 + if ( vpw == NULL ) return(-1);
161 +
162 +- return(strcmp(crypt(clear_pass,vpw->pw_passwd),vpw->pw_passwd));
163 ++ c = crypt(clear_pass,vpw->pw_passwd);
164 ++
165 ++ if ( c == NULL ) return(-1);
166 ++
167 ++ return(strcmp(c,vpw->pw_passwd));
168 + }
169 +--
170 +2.16.4
171 +
172
173 diff --git a/net-mail/vpopmail/files/vpopmail-5.4.33-use-proper-printf-format-strings.patch b/net-mail/vpopmail/files/vpopmail-5.4.33-use-proper-printf-format-strings.patch
174 new file mode 100644
175 index 00000000000..a0967166c1c
176 --- /dev/null
177 +++ b/net-mail/vpopmail/files/vpopmail-5.4.33-use-proper-printf-format-strings.patch
178 @@ -0,0 +1,217 @@
179 +From 8ebcfc44379708521c41193057bb1549a3c1a2eb Mon Sep 17 00:00:00 2001
180 +From: Rolf Eike Beer <eike@×××××××.de>
181 +Date: Sat, 26 Oct 2019 18:25:12 +0200
182 +Subject: [PATCH 2/2] use proper printf format strings
183 +
184 +---
185 + maildirquota.c | 4 ++--
186 + vlimits.c | 8 ++++----
187 + vlistlib.c | 2 +-
188 + vmoddomlimits.c | 8 ++++----
189 + vpopmail.c | 17 +++++++++--------
190 + vpopmaild.c | 20 ++++++++++----------
191 + vusagec.c | 2 +-
192 + 7 files changed, 31 insertions(+), 30 deletions(-)
193 +
194 +diff --git a/maildirquota.c b/maildirquota.c
195 +index 1c3dd44..11a0ce3 100644
196 +--- a/maildirquota.c
197 ++++ b/maildirquota.c
198 +@@ -400,7 +400,7 @@ static int maildirsize_read(const char *filename, /* The filename */
199 + first=0;
200 + continue;
201 + }
202 +- sscanf(q, "%llu %llu", &n, &c);
203 ++ sscanf(q, "%" PRIu64 " %" PRIu64 "", &n, &c);
204 + *sizeptr += n;
205 + *cntptr += c;
206 + ++ *nlines;
207 +@@ -806,7 +806,7 @@ int n;
208 + niov=2;
209 + }
210 +
211 +- sprintf(u.buf, "%llu %llu\n", maildirsize_size, maildirsize_cnt);
212 ++ sprintf(u.buf, "%" PRIu64 " %" PRIu64 "\n", maildirsize_size, maildirsize_cnt);
213 + iov[niov].iov_base=u.buf;
214 + iov[niov].iov_len=strlen(u.buf);
215 +
216 +diff --git a/vlimits.c b/vlimits.c
217 +index af336d2..c4d76ba 100644
218 +--- a/vlimits.c
219 ++++ b/vlimits.c
220 +@@ -480,10 +480,10 @@ int vlimits_write_limits_file(const char *dir, const struct vlimits *limits)
221 + fprintf(fs, "maxforwards: %d\n", limits->maxforwards);
222 + fprintf(fs, "maxautoresponders: %d\n", limits->maxautoresponders);
223 + fprintf(fs, "maxmailinglists: %d\n", limits->maxmailinglists);
224 +- fprintf(fs, "quota: %llu\n", limits->diskquota);
225 +- fprintf(fs, "maxmsgcount: %llu\n", limits->maxmsgcount);
226 +- fprintf(fs, "default_quota: %llu\n", limits->defaultquota);
227 +- fprintf(fs, "default_maxmsgcount: %llu\n", limits->defaultmaxmsgcount);
228 ++ fprintf(fs, "quota: %" PRIu64 "\n", limits->diskquota);
229 ++ fprintf(fs, "maxmsgcount: %" PRIu64 "\n", limits->maxmsgcount);
230 ++ fprintf(fs, "default_quota: %" PRIu64 "\n", limits->defaultquota);
231 ++ fprintf(fs, "default_maxmsgcount: %" PRIu64 "\n", limits->defaultmaxmsgcount);
232 + if (limits->disable_pop) fprintf(fs, "disable_pop\n");
233 + if (limits->disable_imap) fprintf(fs, "disable_imap\n");
234 + if (limits->disable_dialup) fprintf(fs, "disable_dialup\n");
235 +diff --git a/vlistlib.c b/vlistlib.c
236 +index 110a93e..cbb8242 100644
237 +--- a/vlistlib.c
238 ++++ b/vlistlib.c
239 +@@ -488,7 +488,7 @@ void ezmlm_decode( listInfoType *LI ) {
240 + if( (fs=fopen(TmpBuf, "r")) !=NULL ) {
241 + if(fgets(TmpBuf2, sizeof(TmpBuf2), fs)) {
242 + Tmp = strtok( TmpBuf2, ":" );
243 +- printf( " First Token: %s Len: %d\n", Tmp, strlen( Tmp ));
244 ++ printf( " First Token: %s Len: %zu\n", Tmp, strlen( Tmp ));
245 + if( NULL != Tmp ) {
246 + for(i=0; i<strlen(Tmp); i++) LI->SQLHost[i] = Tmp[i];
247 + LI->SQLHost[i] = (char) 0;
248 +diff --git a/vmoddomlimits.c b/vmoddomlimits.c
249 +index cff906a..7a9c8b8 100644
250 +--- a/vmoddomlimits.c
251 ++++ b/vmoddomlimits.c
252 +@@ -207,10 +207,10 @@ int main(int argc, char *argv[])
253 + printf ((limits.perm_defaultquota & VLIMIT_DISABLE_DELETE ? "DENY_DELETE " :"ALLOW_DELETE ") );
254 +
255 + printf("\n");
256 +- printf("Domain Quota: %llu MB\n", limits.diskquota);
257 +- printf("Default User Quota: %llu bytes\n", limits.defaultquota);
258 +- printf("Max Domain Messages: %llu\n", limits.maxmsgcount);
259 +- printf("Default Max Messages per User: %llu\n", limits.defaultmaxmsgcount);
260 ++ printf("Domain Quota: %" PRIu64 " MB\n", limits.diskquota);
261 ++ printf("Default User Quota: %" PRIu64 " bytes\n", limits.defaultquota);
262 ++ printf("Max Domain Messages: %" PRIu64 "\n", limits.maxmsgcount);
263 ++ printf("Default Max Messages per User: %" PRIu64 "\n", limits.defaultmaxmsgcount);
264 + return(vexit(0));
265 + }
266 +
267 +diff --git a/vpopmail.c b/vpopmail.c
268 +index 3b6a3e5..c389c7c 100644
269 +--- a/vpopmail.c
270 ++++ b/vpopmail.c
271 +@@ -31,6 +31,7 @@
272 + #include <fcntl.h>
273 + #include <time.h>
274 + #include <dirent.h>
275 ++#include <inttypes.h>
276 + #include <pwd.h>
277 + #include "config.h"
278 + #ifdef HAVE_ERR_H
279 +@@ -737,13 +738,13 @@ int vadduser( char *username, char *domain, char *password, char *gecos,
280 +
281 + if (limits.defaultquota > 0) {
282 + if (limits.defaultmaxmsgcount > 0)
283 +- snprintf (quota, sizeof(quota), "%lluS,%lluC", limits.defaultquota,
284 ++ snprintf (quota, sizeof(quota), "%" PRIu64 "S,%" PRIu64 "C", limits.defaultquota,
285 + limits.defaultmaxmsgcount);
286 + else
287 +- snprintf (quota, sizeof(quota), "%lluS", limits.defaultquota);
288 ++ snprintf (quota, sizeof(quota), "%" PRIu64 "S", limits.defaultquota);
289 + } else {
290 + if (limits.defaultmaxmsgcount > 0)
291 +- snprintf (quota, sizeof(quota), "%lluC", limits.defaultmaxmsgcount);
292 ++ snprintf (quota, sizeof(quota), "%" PRIu64 "C", limits.defaultmaxmsgcount);
293 + else
294 + strcpy (quota, "NOQUOTA");
295 + }
296 +@@ -3822,11 +3823,11 @@ static char tempquota[128];
297 +
298 + if (quota_count == 0)
299 + if (quota_size == 0) strcpy (tempquota, ""); /* invalid quota */
300 +- else sprintf (tempquota, "%lluS", quota_size);
301 ++ else sprintf (tempquota, "%" PRIu64 "S", quota_size);
302 + else if (quota_size == 0)
303 +- sprintf (tempquota, "%lluC", quota_count);
304 ++ sprintf (tempquota, "%" PRIu64 "C", quota_count);
305 + else
306 +- sprintf (tempquota, "%lluS,%lluC", quota_size, quota_count);
307 ++ sprintf (tempquota, "%" PRIu64 "S,%" PRIu64 "C", quota_size, quota_count);
308 +
309 + return tempquota;
310 + }
311 +@@ -4050,8 +4051,8 @@ int qnprintf (char *buffer, size_t size, const char *format, ...)
312 + snprintf (n, sizeof(n), "%u", va_arg (ap, unsigned int));
313 + break;
314 +
315 +- case 'S':
316 +- snprintf(n, sizeof(n), "%llu", va_arg(ap, storage_t));
317 ++ case 'S':
318 ++ snprintf(n, sizeof(n), "%" PRIu64, va_arg(ap, storage_t));
319 + break;
320 +
321 + case 'l':
322 +diff --git a/vpopmaild.c b/vpopmaild.c
323 +index f257a52..9cf2981 100644
324 +--- a/vpopmaild.c
325 ++++ b/vpopmaild.c
326 +@@ -2280,13 +2280,13 @@ int get_limits()
327 + mylimits.maxautoresponders); wait_write();
328 + snprintf(WriteBuf,sizeof(WriteBuf), "max_mailinglists %d" RET_CRLF,
329 + mylimits.maxmailinglists); wait_write();
330 +- snprintf(WriteBuf,sizeof(WriteBuf), "disk_quota %llu" RET_CRLF,
331 ++ snprintf(WriteBuf,sizeof(WriteBuf), "disk_quota %" PRIu64 RET_CRLF,
332 + mylimits.diskquota); wait_write();
333 +- snprintf(WriteBuf,sizeof(WriteBuf), "max_msgcount %llu" RET_CRLF,
334 ++ snprintf(WriteBuf,sizeof(WriteBuf), "max_msgcount %" PRIu64 RET_CRLF,
335 + mylimits.maxmsgcount); wait_write();
336 +- snprintf(WriteBuf,sizeof(WriteBuf), "default_quota %llu" RET_CRLF,
337 ++ snprintf(WriteBuf,sizeof(WriteBuf), "default_quota %" PRIu64 RET_CRLF,
338 + mylimits.defaultquota); wait_write();
339 +- snprintf(WriteBuf,sizeof(WriteBuf), "default_maxmsgcount %llu" RET_CRLF,
340 ++ snprintf(WriteBuf,sizeof(WriteBuf), "default_maxmsgcount %" PRIu64 RET_CRLF,
341 + mylimits.defaultmaxmsgcount); wait_write();
342 +
343 + if (mylimits.disable_pop)
344 +@@ -2625,9 +2625,9 @@ int get_user_size()
345 +
346 + snprintf(WriteBuf, sizeof(WriteBuf), "%s", RET_OK_MORE);
347 + wait_write();
348 +- snprintf(WriteBuf, sizeof(WriteBuf), "size %llu" RET_CRLF, bytes);
349 ++ snprintf(WriteBuf, sizeof(WriteBuf), "size %" PRIu64 RET_CRLF, bytes);
350 + wait_write();
351 +- snprintf(WriteBuf, sizeof(WriteBuf), "count %llu" RET_CRLF, cnt);
352 ++ snprintf(WriteBuf, sizeof(WriteBuf), "count %" PRIu64 RET_CRLF, cnt);
353 + wait_write();
354 + snprintf(WriteBuf, sizeof(WriteBuf), "%s", "." RET_CRLF);
355 +
356 +@@ -2680,9 +2680,9 @@ int get_domain_size()
357 + } else {
358 + snprintf(WriteBuf, sizeof(WriteBuf), "user %s@%s" RET_CRLF, tmpvpw->pw_name, domain);
359 + wait_write();
360 +- snprintf(WriteBuf, sizeof(WriteBuf), "size %llu" RET_CRLF, bytes);
361 ++ snprintf(WriteBuf, sizeof(WriteBuf), "size %" PRIu64 RET_CRLF, bytes);
362 + wait_write();
363 +- snprintf(WriteBuf, sizeof(WriteBuf), "count %llu" RET_CRLF, cnt);
364 ++ snprintf(WriteBuf, sizeof(WriteBuf), "count %" PRIu64 RET_CRLF, cnt);
365 + wait_write();
366 + totalbytes += (unsigned long)bytes;
367 + totalcnt += (unsigned int)cnt;
368 +@@ -2691,9 +2691,9 @@ int get_domain_size()
369 +
370 + snprintf(WriteBuf, sizeof(WriteBuf), "domain %s" RET_CRLF, domain);
371 + wait_write();
372 +- snprintf(WriteBuf, sizeof(WriteBuf), "size %llu" RET_CRLF, totalbytes);
373 ++ snprintf(WriteBuf, sizeof(WriteBuf), "size %" PRIu64 RET_CRLF, totalbytes);
374 + wait_write();
375 +- snprintf(WriteBuf, sizeof(WriteBuf), "count %llu" RET_CRLF, totalcnt);
376 ++ snprintf(WriteBuf, sizeof(WriteBuf), "count %" PRIu64 RET_CRLF, totalcnt);
377 + wait_write();
378 + snprintf(WriteBuf, sizeof(WriteBuf), "%s", "." RET_CRLF);
379 +
380 +diff --git a/vusagec.c b/vusagec.c
381 +index c32c2fe..5cc6dda 100644
382 +--- a/vusagec.c
383 ++++ b/vusagec.c
384 +@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
385 + if (uusage == -1)
386 + printf("%s: No data available\n", argv[i]);
387 + else
388 +- printf("%s: %llu byte(s) in %llu file(s)\n", *(argv[i]) == '@' ? (argv[i] + 1) : argv[i], uusage, musage);
389 ++ printf("%s: %" PRIu64 " byte(s) in %" PRIu64 " file(s)\n", *(argv[i]) == '@' ? (argv[i] + 1) : argv[i], uusage, musage);
390 + }
391 +
392 + client_close(handle);
393 +--
394 +2.16.4
395 +
396
397 diff --git a/net-mail/vpopmail/vpopmail-5.4.33-r5.ebuild b/net-mail/vpopmail/vpopmail-5.4.33-r5.ebuild
398 new file mode 100644
399 index 00000000000..3b183346bb9
400 --- /dev/null
401 +++ b/net-mail/vpopmail/vpopmail-5.4.33-r5.ebuild
402 @@ -0,0 +1,249 @@
403 +# Copyright 1999-2019 Gentoo Authors
404 +# Distributed under the terms of the GNU General Public License v2
405 +
406 +EAPI=7
407 +
408 +inherit autotools fixheadtails qmail
409 +
410 +HOMEPAGE="http://www.inter7.com/index.php?page=vpopmail"
411 +DESCRIPTION="Collection of programs to manage virtual email on Qmail servers"
412 +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
413 +
414 +LICENSE="GPL-2"
415 +SLOT="0"
416 +KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
417 +IUSE="clearpasswd ipalias maildrop mysql postgres spamassassin"
418 +REQUIRED_USE="mysql? ( !postgres )"
419 +
420 +DEPEND="
421 + acct-group/vpopmail
422 + virtual/qmail
423 + maildrop? ( mail-filter/maildrop )
424 + mysql? ( dev-db/mysql-connector-c:0= )
425 + postgres? ( dev-db/postgresql:=[server] )
426 + spamassassin? ( mail-filter/spamassassin )"
427 +RDEPEND="${DEPEND}"
428 +
429 +PATCHES=(
430 + "${FILESDIR}"/${PN}-5.4.9-access.violation.patch
431 + "${FILESDIR}"/${PN}-lazy.patch
432 + "${FILESDIR}"/${PN}-vpgsql.patch
433 + "${FILESDIR}"/${PN}-double-free.patch
434 + "${FILESDIR}"/${PN}-5.4.33-vdelivermail-add-static.patch
435 + "${FILESDIR}"/${PN}-5.4.33-fix-those-vfork-instances-that-do-more-than-exec.patch
436 + "${FILESDIR}"/${PN}-5.4.33-remove-unneeded-forward-declaration.patch
437 + "${FILESDIR}"/${PN}-5.4.33-clean-up-calling-maildrop.patch
438 + "${FILESDIR}"/${PN}-5.4.33-fix-S-tag-in-case-spamassassin-changed-the-file-size.patch
439 + "${FILESDIR}"/${PN}-5.4.33-strncat.patch
440 + "${FILESDIR}"/${PN}-5.4.33-unistd.patch
441 + "${FILESDIR}"/${PN}-5.4.33-check-crypt-return-value-for-NULL.patch
442 + "${FILESDIR}"/${PN}-5.4.33-use-proper-printf-format-strings.patch
443 +)
444 +DOCS=(
445 + ChangeLog
446 + doc/.
447 +)
448 +HTML_DOCS=(
449 + doc_html/.
450 + man_html/.
451 +)
452 +
453 +VPOP_HOME="/var/vpopmail"
454 +
455 +pkg_setup() {
456 + upgradewarning
457 +}
458 +
459 +src_prepare() {
460 + default
461 +
462 + echo 'install-recursive: install-exec-am' \
463 + >>"${S}"/Makefile.am || die
464 +
465 + # fix maildir paths
466 + sed -i -e 's|Maildir|.maildir|g' \
467 + vchkpw.c vconvert.c vdelivermail.c \
468 + vpopbull.c vpopmail.c vqmaillocal.c \
469 + vuserinfo.c maildirquota.c || die
470 +
471 + # remove vpopmail advertisement
472 + sed -i -e '/printf.*vpopmail/s:vpopmail (:(:' \
473 + vdelivermail.c vpopbull.c vqmaillocal.c || die
474 +
475 + # automake/autoconf
476 + mv "${S}"/configure.{in,ac} || die
477 + sed -i -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' \
478 + configure.ac || die
479 +
480 + # _FORTIFY_SOURCE
481 + sed -i \
482 + -e 's/\(snprintf(\s*\(LI->[a-zA-Z_]\+\),\s*\)[a-zA-Z_]\+,/\1 sizeof(\2),/' \
483 + vlistlib.c || die
484 +
485 + eautoreconf
486 + ht_fix_file cdb/Makefile
487 +}
488 +
489 +src_configure() {
490 + local -a authopts
491 + if use mysql; then
492 + incdir=$(mysql_config --variable=pkgincludedir || die)
493 + libdir=$(mysql_config --variable=pkglibdir || die)
494 + authopts+=( "--enable-auth-module=mysql"
495 + "--enable-incdir=${incdir}"
496 + "--enable-libdir=${libdir}"
497 + "--enable-sql-logging"
498 + "--enable-valias"
499 + "--disable-mysql-replication"
500 + "--enable-mysql-limits"
501 + )
502 + elif use postgres; then
503 + libdir=$(pg_config --libdir || die)
504 + incdir=$(pg_config --pkgincludedir || die)
505 + authopts+=( "--enable-auth-module=pgsql"
506 + "--enable-incdir=${incdir}"
507 + "--enable-libdir=${libdir}"
508 + "--enable-sql-logging"
509 + "--enable-valias"
510 + )
511 + else
512 + authopts+=( "--enable-auth-module=cdb" )
513 + fi
514 +
515 + econf ${authopts[@]} \
516 + --sysconfdir=${VPOP_HOME}/etc \
517 + --enable-non-root-build \
518 + --enable-qmaildir=${QMAIL_HOME} \
519 + --enable-qmail-newu=${QMAIL_HOME}/bin/qmail-newu \
520 + --enable-qmail-inject=${QMAIL_HOME}/bin/qmail-inject \
521 + --enable-qmail-newmrh=${QMAIL_HOME}/bin/qmail-newmrh \
522 + --enable-vpopuser=vpopmail \
523 + --enable-vpopgroup=vpopmail \
524 + --enable-many-domains \
525 + --enable-file-locking \
526 + --enable-file-sync \
527 + --enable-md5-passwords \
528 + --enable-logging \
529 + --enable-auth-logging \
530 + --enable-log-name=vpopmail \
531 + --enable-qmail-ext \
532 + --disable-tcpserver-file \
533 + --disable-roaming-users \
534 + $(use_enable ipalias ip-alias-domains) \
535 + $(use_enable clearpasswd clear-passwd) \
536 + $(use_enable maildrop) \
537 + $(use_enable maildrop maildrop-prog /usr/bin/maildrop) \
538 + $(use_enable spamassassin)
539 +}
540 +
541 +src_install() {
542 + emake DESTDIR="${D}" install
543 + keepdir "${VPOP_HOME}"/domains
544 +
545 + # install helper script for maildir conversion
546 + into "${VPOP_HOME}"
547 + dobin "${FILESDIR}"/vpopmail-Maildir-dotmaildir-fix.sh
548 + into /usr
549 +
550 + mv doc/doc_html/ doc/man_html/ . || die
551 + einstalldocs
552 + rm -r "${D}/${VPOP_HOME}"/doc || die
553 +
554 + # create /etc/vpopmail.conf
555 + if use mysql; then
556 + insinto /etc
557 + newins "${D}${VPOP_HOME}"/etc/vpopmail.mysql vpopmail.conf
558 + dosym ../../etc/vpopmail.conf "${VPOP_HOME}"/etc/vpopmail.mysql
559 +
560 + sed 's/^[^#]/# &/' -i "${D}"/etc/vpopmail.conf || die
561 + echo '# Read-only DB' >> "${D}"/etc/vpopmail.conf || die
562 + echo 'localhost|0|vpopmail|secret|vpopmail' >> "${D}"/etc/vpopmail.conf || die
563 + echo '# Write DB' >> "${D}"/etc/vpopmail.conf || die
564 + echo 'localhost|0|vpopmail|secret|vpopmail' >> "${D}"/etc/vpopmail.conf || die
565 +
566 + # lock down perms
567 + fperms 640 /etc/vpopmail.conf
568 + fowners root:vpopmail /etc/vpopmail.conf
569 + fi
570 +
571 + insinto "${VPOP_HOME}"/etc
572 + doins vusagec.conf
573 + dosym .."${VPOP_HOME}"/etc/vusagec.conf /etc/vusagec.conf
574 + sed -i 's/Disable = False;/Disable = True;/g' "${D}${VPOP_HOME}"/etc/vusagec.conf || die
575 +
576 + einfo "Installing env.d entry"
577 + doenvd "${FILESDIR}"/99vpopmail
578 +
579 + einfo "Locking down vpopmail permissions"
580 + fowners -R root:0 "${VPOP_HOME}"/{bin,etc,include}
581 + fowners root:vpopmail "${VPOP_HOME}"/bin/vchkpw
582 + fperms 4711 "${VPOP_HOME}"/bin/vchkpw
583 +}
584 +
585 +pkg_postinst() {
586 + if use mysql ; then
587 + elog
588 + elog "You have 'mysql' turned on in your USE"
589 + elog "Vpopmail needs a VALID MySQL USER. Let's call it 'vpopmail'"
590 + elog "You MUST add it and then specify its passwd in the /etc/vpopmail.conf file"
591 + elog
592 + elog "First log into mysql as your mysql root user and pass. Then:"
593 + elog "> create database vpopmail;"
594 + elog "> use mysql;"
595 + elog "> grant select, insert, update, delete, create, drop on vpopmail.* to"
596 + elog " vpopmail@localhost identified by 'your password';"
597 + elog "> flush privileges;"
598 + elog
599 + elog "If you have problems with vpopmail not accepting mail properly,"
600 + elog "please ensure that /etc/vpopmail.conf is chmod 640 and"
601 + elog "owned by root:vpopmail"
602 + elog
603 + fi
604 +
605 + # do this for good measure
606 + if [[ -e /etc/vpopmail.conf ]]; then
607 + chmod 640 /etc/vpopmail.conf || die
608 + chown root:vpopmail /etc/vpopmail.conf || die
609 + fi
610 +
611 + upgradewarning
612 +}
613 +
614 +pkg_postrm() {
615 + elog "The vpopmail DATA will NOT be removed automatically."
616 + elog "You can delete them manually by removing the ${VPOP_HOME} directory."
617 +}
618 +
619 +upgradewarning() {
620 + if has_version "<=net-mail/vpopmail-5.2.1-r8"; then
621 + ewarn
622 + ewarn "Massive important warning if you are upgrading to 5.2.1-r8 or older"
623 + ewarn "The internal structure of the mail storage has changed for"
624 + ewarn "consistancy with the rest of Gentoo! Please review and utilize the "
625 + ewarn "script at ${VPOP_HOME}/bin/vpopmail-Maildir-dotmaildir-fix.sh"
626 + ewarn "to upgrade your system! (It can do conversions both ways)."
627 + ewarn "You should be able to run it right away without any changes."
628 + ewarn
629 + fi
630 +
631 + elog
632 + elog "Use of vpopmail's tcp.smtp[.cdb] is also deprecated now, consider"
633 + elog "using net-mail/relay-ctrl instead."
634 + elog
635 +
636 + if use mysql; then
637 + if has_version "<=net-mail/vpopmail-5.4.17"; then
638 + elog
639 + elog "If you are upgrading from 5.4.17 or older, you have to fix your"
640 + elog "MySQL tables, please see the UPGRADE file in the documentation!"
641 + elog
642 + fi
643 + fi
644 +
645 + ewarn
646 + ewarn "Newer versions of vpopmail contain a quota daemon called vusaged."
647 + ewarn "This ebuild DOES NOT INSTALL vusaged and has therefore disabled"
648 + ewarn "its usage in ${VPOP_HOME}/etc/vusagec.conf. DO NOT ENABLE!"
649 + ewarn "Otherwise mail delivery WILL BREAK"
650 + ewarn
651 +}