head 1.12; access; symbols OPENPKG_E1_MP:1.5 OPENPKG_E1_MP_HEAD:1.5; locks; strict; comment @# @; 1.12 date 2008.04.12.16.56.22; author rse; state Exp; branches; next 1.11; commitid YmPiK364GZxWdQYs; 1.11 date 2007.05.08.07.36.04; author rse; state Exp; branches; next 1.10; commitid yb0Hcqqn8xHj36hs; 1.10 date 2007.05.05.07.37.53; author rse; state Exp; branches; next 1.9; commitid tX03E5Lwpt3V9Igs; 1.9 date 2007.04.03.14.51.13; author cs; state Exp; branches; next 1.8; commitid 7kNMg0mTzlNkADcs; 1.8 date 2007.03.02.09.31.40; author rse; state Exp; branches; next 1.7; commitid sCYWZbnLQVuuQu8s; 1.7 date 2007.02.14.20.12.34; author rse; state Exp; branches; next 1.6; commitid QSQYdy6FniNfUu6s; 1.6 date 2007.01.22.08.32.53; author rse; state Exp; branches; next 1.5; commitid EGPVLzSC4Ch2Mt3s; 1.5 date 2006.12.31.12.59.01; author rse; state Exp; branches; next 1.4; commitid rQGbP1Z3b6NbXF0s; 1.4 date 2006.12.31.11.56.55; author rse; state Exp; branches; next 1.3; commitid BR3SFfbJg31TBF0s; 1.3 date 2006.12.31.09.17.22; author rse; state Exp; branches; next 1.2; commitid pFCaWXcx2ih9JE0s; 1.2 date 2006.12.31.09.01.17; author rse; state Exp; branches; next 1.1; commitid MfrLr0cF5iACDE0s; 1.1 date 2006.12.30.12.07.44; author rse; state Exp; branches; next ; commitid PuC7zHm85ESAHx0s; desc @@ 1.12 log @upgrading package: milter-greylist 4.0rc2 -> 4.1.1 @ text @Index: acl.c --- acl.c.orig 2007-11-11 12:57:19 +0100 +++ acl.c 2008-04-12 18:50:04 +0200 @@@@ -58,7 +58,7 @@@@ #include #include #include -#include +#include "pcreposix.h" #include "spf.h" #include "acl.h" Index: acl.h --- acl.h.orig 2007-11-11 12:57:19 +0100 +++ acl.h 2008-04-12 18:50:04 +0200 @@@@ -46,7 +46,7 @@@@ #include #include #include -#include +#include "pcreposix.h" typedef enum { A_GREYLIST, A_WHITELIST, A_BLACKLIST, } acl_type_t; typedef enum { AS_NONE, AS_RCPT, AS_DATA, AS_ANY, } acl_stage_t; Index: list.c --- list.c.orig 2007-11-06 12:39:33 +0100 +++ list.c 2008-04-12 18:50:04 +0200 @@@@ -45,7 +45,7 @@@@ #include #include #include -#include +#include "pcreposix.h" #ifdef HAVE_OLD_QUEUE_H #include "queue.h" Index: macro.c --- macro.c.orig 2007-11-06 12:39:33 +0100 +++ macro.c 2008-04-12 18:50:04 +0200 @@@@ -45,7 +45,7 @@@@ #include #include #include -#include +#include "pcreposix.h" #ifdef HAVE_OLD_QUEUE_H #include "queue.h" Index: milter-greylist.c --- milter-greylist.c.orig 2007-12-29 20:06:49 +0100 +++ milter-greylist.c 2008-04-12 18:53:46 +0200 @@@@ -77,7 +77,7 @@@@ static int check_drac(char *dotted_ip); #endif -#include +#include "milter/mfapi.h" #include "dump.h" #include "spf.h" @@@@ -666,6 +666,10 @@@@ len = strlen(name) + strlen(sep) + strlen(value) + strlen(crlf); priv->priv_msgcount += len; + if (priv->priv_queueid == NULL || strcmp(priv->priv_queueid, "(unknown id)") == 0) + if ((priv->priv_queueid = smfi_getsymval(ctx, "{i}")) == NULL) + priv->priv_queueid = "(unknown id)"; + if (priv->priv_msgcount > conf.c_maxpeek) { if (conf.c_debug) mg_log(LOG_DEBUG, @@@@ -1489,6 +1493,9 @@@@ * Here we go! */ conf_release(); + umask(S_IWOTH); + smfi_opensocket(1); + umask(S_IWGRP|S_IWOTH); exitval = smfi_main(); mg_log(LOG_ERR, "smfi_main() returned %d", exitval); @@@@ -2897,6 +2904,8 @@@@ * Macro {if_addr} does not exist in Postfix */ ip = smfi_getsymval(priv->priv_ctx, "{if_addr}"); + if (ip == NULL) + ip = smfi_getsymval(priv->priv_ctx, "{client_addr}"); #ifdef AF_INET6 /* * XXX: sendmail doesn't return {if_addr} when connection is Index: milter-greylist.h --- milter-greylist.h.orig 2007-11-11 12:57:19 +0100 +++ milter-greylist.h 2008-04-12 18:50:04 +0200 @@@@ -37,7 +37,7 @@@@ #include #include -#include +#include "milter/mfapi.h" #include "config.h" #include "dump.h" Index: stat.c --- stat.c.orig 2007-10-06 01:12:47 +0200 +++ stat.c 2008-04-12 18:50:04 +0200 @@@@ -52,7 +52,7 @@@@ #include #endif -#include +#include "milter/mfapi.h" #include "milter-greylist.h" #include "conf.h" @ 1.11 log @upgrading package: milter-greylist 4.0a3 -> 4.0a4 @ text @d2 2 a3 2 --- acl.c.orig 2007-04-16 04:39:10 +0200 +++ acl.c 2007-05-08 09:28:07 +0200 d11 1 a12 1 #include "conf.h" d14 2 a15 2 --- acl.h.orig 2007-03-22 06:39:16 +0100 +++ acl.h 2007-05-08 09:28:07 +0200 d26 2 a27 2 --- list.c.orig 2006-12-29 19:32:44 +0100 +++ list.c 2007-05-08 09:28:07 +0200 d38 2 a39 2 --- macro.c.orig 2007-03-26 21:29:04 +0200 +++ macro.c 2007-05-08 09:28:07 +0200 d50 2 a51 2 --- milter-greylist.c.orig 2007-05-06 06:49:29 +0200 +++ milter-greylist.c 2007-05-08 09:28:07 +0200 d60 2 a61 12 #include "acl.h" @@@@ -112,9 +112,7 @@@@ static void cleanup_pidfile(char *); static void cleanup_sock(char *); static int mg_setreply(SMFICTX *, struct mlfi_priv *, char *); -#ifndef USE_POSTFIX static char *local_ipstr(struct mlfi_priv *); -#endif static sfsistat real_connect(SMFICTX *, char *, _SOCK_ADDR *); static sfsistat real_helo(SMFICTX *, char *); static sfsistat real_envfrom(SMFICTX *, char **); @@@@ -620,6 +618,10 @@@@ d72 1 a72 1 @@@@ -1427,6 +1429,9 @@@@ d82 1 a82 25 @@@@ -2450,15 +2455,9 @@@@ } snprintf(output, HDRLEN, -#ifndef USE_POSTFIX "milter-greylist-%s (%s [%s]); %s %s (%s)", -#else - "milter-greylist-%s (%s); %s %s (%s)", -#endif PACKAGE_VERSION, fqdn, -#ifndef USE_POSTFIX local_ipstr(priv), -#endif timestr, tzstr, tznamestr); mystrncat(&outstr, output, &outmaxlen); break; @@@@ -2805,7 +2804,6 @@@@ return fstring; } -#ifndef USE_POSTFIX static char * local_ipstr(priv) struct mlfi_priv *priv; @@@@ -2816,6 +2814,8 @@@@ a90 8 @@@@ -2837,7 +2837,6 @@@@ return ip; } -#endif /* !USE_POSTFIX */ static void set_sr_defaults(priv, code, ecode, msg) d92 2 a93 2 --- milter-greylist.h.orig 2007-05-02 05:36:50 +0200 +++ milter-greylist.h 2007-05-08 09:28:07 +0200 d104 2 a105 2 --- stat.c.orig 2007-02-21 22:46:36 +0100 +++ stat.c 2007-05-08 09:28:07 +0200 @ 1.10 log @upgrading package: milter-greylist 4.0a2 -> 4.0a3 @ text @d3 1 a3 1 +++ acl.c 2007-05-05 09:35:39 +0200 d15 1 a15 1 +++ acl.h 2007-05-05 09:35:39 +0200 a24 12 Index: configure --- configure.orig 2007-05-05 03:36:08 +0200 +++ configure 2007-05-05 09:35:58 +0200 @@@@ -2545,7 +2545,7 @@@@ echo "$as_me: error: flex not found" >&2;} { (exit 1); exit 1; }; } fi -if test -z "`echo %%|$LEX -t --noyywrap|grep yypop_buffer_state`"; then +if false; then { { echo "$as_me:$LINENO: error: flex missing yypop_buffer_state - upgrade to version 2.5.33 or later" >&5 echo "$as_me: error: flex missing yypop_buffer_state - upgrade to version 2.5.33 or later" >&2;} { (exit 1); exit 1; }; } d27 1 a27 1 +++ list.c 2007-05-05 09:35:39 +0200 d39 1 a39 1 +++ macro.c 2007-05-05 09:35:39 +0200 d50 2 a51 2 --- milter-greylist.c.orig 2007-05-04 22:29:50 +0200 +++ milter-greylist.c 2007-05-05 09:35:39 +0200 d82 1 a82 1 @@@@ -1415,6 +1417,9 @@@@ d92 1 a92 1 @@@@ -2438,15 +2443,9 @@@@ d108 1 a108 1 @@@@ -2793,7 +2792,6 @@@@ d116 1 a116 1 @@@@ -2804,6 +2802,8 @@@@ d125 1 a125 1 @@@@ -2825,7 +2825,6 @@@@ d135 1 a135 1 +++ milter-greylist.h 2007-05-05 09:35:39 +0200 d147 1 a147 1 +++ stat.c 2007-05-05 09:35:39 +0200 @ 1.9 log @upgrading package: milter-greylist 3.1.8 -> 4.0a1 @ text @d2 2 a3 2 --- acl.c.orig 2007-02-14 06:39:16 +0100 +++ acl.c 2007-03-02 10:28:02 +0100 d14 2 a15 2 --- acl.h.orig 2007-02-05 07:05:34 +0100 +++ acl.h 2007-03-02 10:28:02 +0100 d25 12 d39 1 a39 1 +++ list.c 2007-03-02 10:28:02 +0100 d50 2 a51 2 --- macro.c.orig 2006-12-29 19:32:44 +0100 +++ macro.c 2007-03-02 10:28:02 +0100 d62 2 a63 2 --- milter-greylist.c.orig 2007-02-14 06:12:40 +0100 +++ milter-greylist.c 2007-03-02 10:28:21 +0100 d73 3 a75 3 @@@@ -107,9 +107,7 @@@@ static void set_sr_defaults(struct mlfi_priv *, char *, char *, char *); static sfsistat stat_from_code(char *); d83 1 a83 1 @@@@ -649,6 +647,10 @@@@ d92 3 a94 3 mg_log(LOG_DEBUG, "ignoring message beyond maxpeek = %d", conf.c_maxpeek); @@@@ -1452,6 +1454,9 @@@@ d104 1 a104 1 @@@@ -2443,15 +2448,9 @@@@ d120 1 a120 1 @@@@ -2791,7 +2790,6 @@@@ d128 1 a128 1 @@@@ -2802,6 +2800,8 @@@@ d137 1 a137 1 @@@@ -2823,7 +2823,6 @@@@ d146 2 a147 2 --- milter-greylist.h.orig 2007-02-05 07:05:34 +0100 +++ milter-greylist.h 2007-03-02 10:28:33 +0100 d158 2 a159 2 --- stat.c.orig 2007-01-01 18:29:29 +0100 +++ stat.c 2007-03-02 10:28:46 +0100 @ 1.8 log @unbreak under runtime (version mismatch) by including the OpenPKG (and not the system) MILTER API @ text @a61 1 static void add_recipient(struct mlfi_priv *, char *); d64 1 @ 1.7 log @upgrading package: milter-greylist 3.1.4 -> 3.1.6 @ text @d3 1 a3 1 +++ acl.c 2007-02-14 20:57:40 +0100 d15 1 a15 1 +++ acl.h 2007-02-14 20:57:40 +0100 d27 1 a27 1 +++ list.c 2007-02-14 20:57:40 +0100 d39 1 a39 1 +++ macro.c 2007-02-14 20:57:40 +0100 d51 10 a60 1 +++ milter-greylist.c 2007-02-14 21:10:13 +0100 d133 24 @ 1.6 log @upgrading package: milter-greylist 3.1.3 -> 3.1.4 @ text @d2 2 a3 2 --- acl.c.orig 2007-01-16 06:10:37 +0100 +++ acl.c 2007-01-22 09:26:17 +0100 d14 2 a15 2 --- acl.h.orig 2007-01-10 11:54:26 +0100 +++ acl.h 2007-01-22 09:26:17 +0100 d27 1 a27 1 +++ list.c 2007-01-22 09:26:17 +0100 d39 1 a39 1 +++ macro.c 2007-01-22 09:26:17 +0100 d50 13 a62 3 --- milter-greylist.c.orig 2007-01-18 16:04:28 +0100 +++ milter-greylist.c 2007-01-22 09:30:51 +0100 @@@@ -635,6 +635,10 @@@@ d73 1 a73 10 @@@@ -849,6 +853,8 @@@@ * Macro {if_addr} does not exist in Postfix */ ip = smfi_getsymval(ctx, "{if_addr}"); +#else + ip = smfi_getsymval(ctx, "{client_addr}"); #endif #ifdef AF_INET6 /* @@@@ -1445,6 +1451,9 @@@@ d83 41 @ 1.5 log @Berkeley-DB is required for DRAC only (which we don't use); use PCRE for regex matching; configure timeouts @ text @d2 2 a3 2 --- acl.c.orig 2006-12-31 00:34:35 +0100 +++ acl.c 2006-12-31 13:34:57 +0100 d14 2 a15 2 --- acl.h.orig 2006-12-29 19:32:44 +0100 +++ acl.h 2006-12-31 13:34:57 +0100 d27 1 a27 1 +++ list.c 2006-12-31 13:34:57 +0100 d39 1 a39 1 +++ macro.c 2006-12-31 13:35:12 +0100 a48 35 Index: milter-greylist.8 --- milter-greylist.8.orig 2006-08-30 22:50:42 +0200 +++ milter-greylist.8 2006-12-31 13:34:57 +0100 @@@@ -46,7 +46,7 @@@@ [\fB-r\fR] [\fB-S\fR] [\fB-T\fR] -[\fB-u \fIusername\fR] +[\fB-u \fIusername\fR[:\fIgroupname\fR]] [\fB-v\fR] [\fB-w \fIgreylist_delay\fR] [\fB-L \fIcidrmask\fR] @@@@ -235,10 +235,12 @@@@ .I rcpt lines have been deprecated in favor of ACL, so do not use it. .TP -.B -u \fIusername\fR +.B -u \fIusername\fR[:\fIgroupname\fR] Drop root privileges and switch to .I username -credentials. Make sure this user has write access to +(and optionally +.IR groupname ) +credentials. Make sure this user (and group) has write access to .I greylist.db\fR. Equivalent to the .I user @@@@ -308,6 +310,7 @@@@ Alexandre Cherif, Eugene Crosser, Elrond, +Ralf S. Engelschall, Cyril Guibourg, Klas Heggemann, Matthieu Herrb, d50 5 a54 15 --- milter-greylist.c.orig 2006-12-29 19:32:44 +0100 +++ milter-greylist.c 2006-12-31 13:34:57 +0100 @@@@ -334,7 +334,9 @@@@ priv = (struct mlfi_priv *) smfi_getpriv(ctx); if ((priv->priv_queueid = smfi_getsymval(ctx, "{i}")) == NULL) { +#if 0 mg_log(LOG_DEBUG, "smfi_getsymval failed for {i}"); +#endif priv->priv_queueid = "(unknown id)"; } @@@@ -618,6 +620,10 @@@@ priv = (struct mlfi_priv *) smfi_getpriv(ctx); d63 6 a68 3 @@@@ -820,6 +826,8 @@@@ ip = "IPv6:::1"; } d70 3 a72 34 + if (ip == NULL) + ip = smfi_getsymval(ctx, "{client_addr}"); if (ip == NULL) { mg_log(LOG_DEBUG, "smfi_getsymval failed for {if_addr}"); ip = "0.0.0.0"; @@@@ -1313,6 +1321,11 @@@@ */ if (conf.c_user != NULL) { struct passwd *pw = NULL; + struct group *gr = NULL; + char *c_group = NULL; + + if ((c_group = strchr(conf.c_user, ':')) != NULL) + *c_group++ = '\0'; if ((pw = getpwnam(conf.c_user)) == NULL) { mg_log(LOG_ERR, "%s: cannot get user %s data: %s", @@@@ -1320,6 +1333,15 @@@@ exit(EX_OSERR); } + if (c_group != NULL) { + if ((gr = getgrnam(c_group)) == NULL) { + mg_log(LOG_ERR, "%s: cannot get group %s data: %s", + argv[0], c_group, strerror(errno)); + exit(EX_OSERR); + } + pw->pw_gid = gr->gr_gid; + } + #ifdef HAVE_INITGROUPS if (initgroups(conf.c_user, pw->pw_gid) != 0) { mg_log(LOG_ERR, "%s: cannot change " @@@@ -1370,6 +1392,9 @@@@ a81 9 @@@@ -1396,7 +1421,7 @@@@ mg_log(LOG_ERR, " [-f configfile] [-h] [-l] [-q] [-r] [-S] [-T]"); mg_log(LOG_ERR, - " [-u username] [-v] [-w greylist_delay] [-L cidrmask]"); + " [-u username[:groupname]] [-v] [-w greylist_delay] [-L cidrmask]"); mg_log(LOG_ERR, " [-M prefixlen] [-P pidfile] -p socket"); exit(EX_USAGE); @ 1.4 log @do not complain if macro {i} cannot be resolved early (as this fails in Postfix) and instead retry later (when it works also in Postfix); enable Greylisting by default and allow one to ignore particular users only (as this is more useful in practice) @ text @d1 48 d51 1 a51 1 +++ milter-greylist.8 2006-12-31 12:39:02 +0100 d86 1 a86 1 +++ milter-greylist.c 2006-12-31 12:41:45 +0100 @ 1.3 log @upstream author already has taken over my segfault fix @ text @d3 1 a3 1 +++ milter-greylist.8 2006-12-31 09:57:22 +0100 d38 32 a69 2 +++ milter-greylist.c 2006-12-31 09:58:12 +0100 @@@@ -1313,6 +1313,11 @@@@ d81 1 a81 1 @@@@ -1320,6 +1325,15 @@@@ d97 1 a97 1 @@@@ -1370,6 +1384,9 @@@@ d107 1 a107 1 @@@@ -1396,7 +1413,7 @@@@ @ 1.2 log @also extend the documentation on upstream authors request @ text @a0 12 Index: acl.c --- acl.c.orig 2006-12-29 21:38:17 +0100 +++ acl.c 2006-12-31 09:53:58 +0100 @@@@ -627,7 +627,7 @@@@ exit(EX_OSERR); } - memset(acl, 0, sizeof (acl)); + memset(acl, 0, sizeof(*acl)); acl->a_delay = -1; acl->a_autowhite = -1; LIST_INIT(&acl->a_clause); @ 1.1 log @new package: milter-greylist 3.1.2 (Mail Filter for Greylisting) @ text @d3 1 a3 1 +++ acl.c 2006-12-30 12:52:01 +0100 d13 35 d50 1 a50 1 +++ milter-greylist.c 2006-12-30 12:59:15 +0100 d89 9 @