From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Jul 14 01:20:01 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC72A1065677 for ; Tue, 14 Jul 2009 01:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B68F88FC14 for ; Tue, 14 Jul 2009 01:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n6E1K1P1013799 for ; Tue, 14 Jul 2009 01:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n6E1K1fB013798; Tue, 14 Jul 2009 01:20:01 GMT (envelope-from gnats) Resent-Date: Tue, 14 Jul 2009 01:20:01 GMT Resent-Message-Id: <200907140120.n6E1K1fB013798@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sahil Tandon Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD77D1065679 for ; Tue, 14 Jul 2009 01:11:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id B13D68FC15 for ; Tue, 14 Jul 2009 01:11:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n6E1BG8X052056 for ; Tue, 14 Jul 2009 01:11:16 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n6E1BG1g052055; Tue, 14 Jul 2009 01:11:16 GMT (envelope-from nobody) Message-Id: <200907140111.n6E1BG1g052055@www.freebsd.org> Date: Tue, 14 Jul 2009 01:11:16 GMT From: Sahil Tandon To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/136730: [MAINTAINER UPDATE] mail/postfix-postfwd: update to 1.14 + my mrcpt() patch X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jul 2009 01:20:02 -0000 >Number: 136730 >Category: ports >Synopsis: [MAINTAINER UPDATE] mail/postfix-postfwd: update to 1.14 + my mrcpt() patch >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue Jul 14 01:20:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Sahil Tandon >Release: 7.1-RELEASE >Organization: >Environment: FreeBSD internal.hamla.org 7.1-RELEASE FreeBSD 7.1-RELEASE >Description: >From upstream changelog: - feature: new compare operators - feature: added --nodaemon option - code: non dns items first: if a rule contains dns and non dns items, the lookups will only be done if all non dns items matched - bugfix: empty pcre with empty sender_(ns|mx)_names was parsed incorrectly. - bugfix: negated pcre items with '~=' operator were parsed incorrectly. My patch: I created a quick patch to add a new rate-limiting feature: mrcpt(), maximum recipients per time window. It is disabled by default. I've submitted this to the developer who is currently on holidays and has agreed to look at adding this feature upstream. >How-To-Repeat: >Fix: Patch attached with submission follows: Index: Makefile =================================================================== RCS file: /home/ncvs/ports/mail/postfix-postfwd/Makefile,v retrieving revision 1.3 diff -u -r1.3 Makefile --- Makefile 6 Jul 2009 20:18:05 -0000 1.3 +++ Makefile 14 Jul 2009 00:50:58 -0000 @@ -6,7 +6,7 @@ # PORTNAME= postfwd -PORTVERSION= 1.13 +PORTVERSION= 1.14 CATEGORIES= mail MASTER_SITES= http://www.${PORTNAME}.org/old/ PKGNAMEPREFIX= postfix- @@ -23,14 +23,21 @@ SUB_FILES= pkg-message -USE_RC_SUBR= ${PORTNAME} +USE_RC_SUBR= ${PORTNAME} USE_PERL5_RUN= yes NO_BUILD= yes MAN8= ${PORTNAME}.8 +OPTIONS= MRCPT "Sahil's patch for max recipients per time window" off + .include +.if defined(WITHOUT_MRCPT) +do-patch: + @${DO_NADA} +.endif + do-install: @${INSTALL_SCRIPT} ${WRKSRC}/sbin/${PORTNAME} ${PREFIX}/bin/ @${INSTALL_DATA} ${WRKSRC}/etc/${PORTNAME}.cf.sample ${PREFIX}/etc/${PORTNAME}.conf.sample @@ -46,5 +53,18 @@ @${INSTALL_DATA} ${WRKSRC}/tools/${PORTEXAMPLES} ${EXAMPLESDIR} .endif @${CAT} ${PKGMESSAGE} +.if !defined(WITHOUT_MRCPT) + @${ECHO_MSG} + @${ECHO_MSG} The mrcpt\(\) command works like the rate\(\) command, + @${ECHO_MSG} except that the rate counter is incremented by the + @${ECHO_MSG} request\'s recipient_count. To do this reliably, + @${ECHO_MSG} call postfwd from smtpd_data_restrictions. + @${ECHO_MSG} + @${ECHO_MSG} Example: + @${ECHO_MSG} " id=MAX_RECIPIENTS; protocol_state=DATA; \\ " + @${ECHO_MSG} " client_address==192.168.1.1; \\ " + @${ECHO_MSG} " action==mrcpt(\$$\$$client_address/5/3600/450 4.7.1 max 5 recip/hour) " + @${ECHO_MSG} +.endif .include Index: distinfo =================================================================== RCS file: /home/ncvs/ports/mail/postfix-postfwd/distinfo,v retrieving revision 1.3 diff -u -r1.3 distinfo --- distinfo 6 Jul 2009 20:18:05 -0000 1.3 +++ distinfo 14 Jul 2009 00:50:58 -0000 @@ -1,3 +1,3 @@ -MD5 (postfwd-1.13.tar.gz) = 4790bdc66509f504dac38a0ef67033e1 -SHA256 (postfwd-1.13.tar.gz) = 5d8571ce6e3e5d2802e94a5c784a873822fd5b010d6e98b32c66e3dfd583defa -SIZE (postfwd-1.13.tar.gz) = 94497 +MD5 (postfwd-1.14.tar.gz) = 24feb8cd2c0fea566603a6ba1a38caea +SHA256 (postfwd-1.14.tar.gz) = 9810609239633021ea87fab48431adc23d61445e5c9fc997cad0cba10a0428c4 +SIZE (postfwd-1.14.tar.gz) = 95061 Index: files/patch-sbin-postfwd =================================================================== RCS file: files/patch-sbin-postfwd diff -N files/patch-sbin-postfwd --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-sbin-postfwd 14 Jul 2009 00:50:58 -0000 @@ -0,0 +1,42 @@ +--- sbin/postfwd.orig 2009-06-29 05:36:15.000000000 -0400 ++++ sbin/postfwd 2009-07-09 22:56:26.000000000 -0400 +@@ -1229,7 +1229,7 @@ + type => $mycmd, + maxcount => $ratecount, + ttl => $ratetime, +- count => ( ($mycmd eq 'size') ? $request{size} : 1 ), ++ count => (($mycmd eq 'size') ? $request{size} : (($mycmd eq 'mrcpt') ? $request{recipient_count} : 1)), + time => $now, + rule => $Rules[$index]{$COMP_ID}, + action => $ratecmd, +@@ -1246,6 +1246,8 @@ + }, + # size() command + "size" => sub { return &{$postfwd_actions{rate}}(@_); }, ++ # mrcpt() command ++ "mrcpt" => sub { return &{$postfwd_actions{rate}}(@_); }, + # wait() command + "wait" => sub { + my($index,$now,$mycmd,$myarg,$myline,%request) = @_; +@@ -1724,7 +1726,9 @@ + next RATES unless ( $request{$checkreq} and (defined $Rates{$request{$checkreq}}) ); + if ( ($now - $Rates{$request{$checkreq}}{"time"}) > $Rates{$request{$checkreq}}{ttl} ) { + # renew rate +- $Rates{$request{$checkreq}}{count} = ( ($Rates{$request{$checkreq}}{type} eq 'size') ? $request{size} : 1 ); ++ $Rates{$request{$checkreq}}{count} = ( ($Rates{$request{$checkreq}}{type} eq 'size') ++ ? $request{size} : (($Rates{$request{$checkreq}}{type} eq 'mrcpt') ++ ? $request{recipient_count} : 1) ); + $Rates{$request{$checkreq}}{"time"} = $now; + mylogs $syslog_priority, "[RATE] renewing rate object ".$request{$checkreq} + ." [type: ".$Rates{$request{$checkreq}}{type} +@@ -1733,7 +1737,9 @@ + if ($opt_verbose > 1); + } else { + # increase rate +- $Rates{$request{$checkreq}}{count} += ( ($Rates{$request{$checkreq}}{type} eq 'size') ? $request{size} : 1 ); ++ $Rates{$request{$checkreq}}{count} += (($Rates{$request{$checkreq}}{type} eq 'size') ++ ? $request{size} : (($Rates{$request{$checkreq}}{type} eq 'mrcpt') ++ ? $request{recipient_count} : 1)); + mylogs $syslog_priority, "[RATE] increasing rate object ".$request{$checkreq} + ." to ".$Rates{$request{$checkreq}}{count} + ." [type: ".$Rates{$request{$checkreq}}{type} Index: files/pkg-message.in =================================================================== RCS file: /home/ncvs/ports/mail/postfix-postfwd/files/pkg-message.in,v retrieving revision 1.2 diff -u -r1.2 pkg-message.in --- files/pkg-message.in 6 Jul 2009 20:18:05 -0000 1.2 +++ files/pkg-message.in 14 Jul 2009 00:50:58 -0000 @@ -3,7 +3,7 @@ # %%PREFIX%%/etc/rc.d/postfwd start -* Integrate thusly in: %%PREFIX%%/etc/postfix/main.cf +* Integrate thusly in: %%LOCALBASE%%/etc/postfix/main.cf 127.0.0.1:10040_time_limit = 3600 >Release-Note: >Audit-Trail: >Unformatted: