Skip to content

Commit

Permalink
Merge pull request #37 from postfwd/testing
Browse files Browse the repository at this point in the history
Testing -> master
  • Loading branch information
jpkessler committed Jul 30, 2020
2 parents 2d54d6d + c45a2d0 commit 8221c90
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
5 changes: 5 additions & 0 deletions doc/postfwd3.CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
postfwd3 2.03
=============
- bugfix: Corrected bug with --delrate command in v1 mode
(Patch by Andreas Jobs, thanks)

postfwd3 2.02
=============
- bugfix: Corrected bug in sendmail() function
Expand Down
2 changes: 1 addition & 1 deletion doc/postfwd3.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>postfwd manual</title>
<link rel="stylesheet" href="/css/postfwd.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
<link rev="made" href="mailto:Alpine@build-3-11-x86_64.nonet" />
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion etc/postfwd.settings.sample.full
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# postfwd settings file
#
# Version: postfwd3 2.02 (Perl 5.022001, Data::Dumper 2.158)
# Version: postfwd3 2.03 (Perl 5.030003, Data::Dumper 2.174)
# Command: postfwd3 --user=postfw --group=postfw --stdout --nodaemon --savesettings=postfwd.settings.sample.full.temp
#
{
Expand Down
28 changes: 14 additions & 14 deletions man/man8/postfwd3.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29)
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
Expand Down Expand Up @@ -46,7 +46,7 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
Expand All @@ -56,12 +56,12 @@
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
Expand Down Expand Up @@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "POSTFWD3 1"
.TH POSTFWD3 1 "2019-04-13" "perl v5.22.1" "User Contributed Perl Documentation"
.TH POSTFWD3 1 "2020-07-30" "perl v5.30.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
Expand Down Expand Up @@ -365,7 +365,7 @@ To identify single rules in your log files, you may add an unique identifier for
\& id=R_001 ; action=REJECT ; client_address=192.168.1.1 ; sender==no@bad.local
.Ve
.PP
You may use these identifiers as target for the `\fIjump()\fR` command (see \s-1ACTIONS\s0 section below). Leading
You may use these identifiers as target for the `\fBjump()\fR` command (see \s-1ACTIONS\s0 section below). Leading
or trailing whitespace characters will be ignored. Use '#' to comment your configuration. Others will
appreciate.
.PP
Expand Down Expand Up @@ -941,7 +941,7 @@ Group-names have to be preceeded by double '%'\-characters, like %%GROUPNAME:
\& id=BLACKLISTED; client_address=%%BLACKLISTED; action=REJECT
.Ve
.PP
The \fIgroupadd()\fR function receives the following arguments. The <ttl> value is optional. If not specified, postfwd3
The \fBgroupadd()\fR function receives the following arguments. The <ttl> value is optional. If not specified, postfwd3
will use the default \-\-default_group_ttl [300s]:
.PP
.Vb 1
Expand All @@ -954,7 +954,7 @@ postfwd will save this data in the following structure:
\& %Group_Cache \-> %<Groupname> \-> $<item> = <ttl>
.Ve
.PP
The \fIgroupdel()\fR function removes an item from a group:
The \fBgroupdel()\fR function removes an item from a group:
.PP
.Vb 1
\& groupdel ( <Groupname> / <item> )
Expand Down Expand Up @@ -1825,8 +1825,8 @@ If a rule matches, there are two options:
* Rule returns postfix action (dunno, reject, ...)
The parser stops rule processing and returns the action to postfix. Other rules will not be evaluated.
.PP
* Rule returns postfwd3 action (\fIjump()\fR, \fInote()\fR, ...)
The parser evaluates the given action and continues with the next rule (except for the \fIjump()\fR or \fIquit()\fR actions \- please see the \*(L"\s-1ACTIONS\*(R"\s0 section
* Rule returns postfwd3 action (\fBjump()\fR, \fBnote()\fR, ...)
The parser evaluates the given action and continues with the next rule (except for the \fBjump()\fR or \fBquit()\fR actions \- please see the \*(L"\s-1ACTIONS\*(R"\s0 section
for more information). Nothing will be sent to postfix.
.PP
If no rule has matched and the end of the ruleset is reached postfwd3 will return dunno without logging anything unless in verbose mode. You may
Expand All @@ -1841,7 +1841,7 @@ will log any request that passes the ruleset without having hit a prior rule.
.SS "\s-1SETTINGS\s0"
.IX Subsection "SETTINGS"
Since version postfwd3 2.00\-pre6 the program settings can be retrieved from a file. The information must be
parseable by perl \fIeval()\fR function. Comments are allowed:
parseable by perl \fBeval()\fR function. Comments are allowed:
.PP
.Vb 4
\& # example settings for postfwd3
Expand Down Expand Up @@ -2044,10 +2044,10 @@ are permitted provided that the following conditions are met:
\&\s-1THIS SOFTWARE IS PROVIDED BY ME\s0 ``\s-1AS IS\s0'' \s-1AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \s0(\s-1INCLUDING, BUT
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\s0 (\s-1INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES\s0; \s-1LOSS OF USE, DATA, OR
PROFITS\s0; \s-1OR BUSINESS INTERRUPTION\s0) \s-1HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \s0(\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0)
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\s0 (\s-1INCLUDING NEGLIGENCE OR OTHERWISE\s0)
\&\s-1ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.\s0
.SH "AUTHOR"
Expand Down
17 changes: 15 additions & 2 deletions sbin/postfwd3
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ BEGIN {

# basics
our $NAME = "postfwd3";
our $VERSION = "2.02";
our $VERSION = "2.03";
our $DEFAULT = 'DUNNO';

# change this, to match your POD requirements
Expand Down Expand Up @@ -3287,6 +3287,18 @@ sub mux_input() {
$client->print((join $postfwd_settings{sepreq}.$postfwd_settings{seplst}, list_stats())."\n");
} elsif ($request =~ m/$postfwd_patterns{dumpcache}/) {
$client->print((join $postfwd_settings{sepreq}.$postfwd_settings{seplst}, dump_cache())."\n");
} elsif ($request =~ m/$postfwd_patterns{delrate}/) {
my $del = $1; $del =~ s/^[%]?//;
my $action;
if (defined $Rate_Cache{$del}) {
delete $Rate_Cache{$del};
log_info ("[DELRATEITEM] rate cache item '$del' removed");
$action = "rate cache item '$del' removed";
} else {
log_info ("[DELRATEITEM] rate cache removal of '$del' failed: item not found");
$action = "rate cache removal of '$del' failed: item not found";
};
$client->print((join $postfwd_settings{sepreq}.$postfwd_settings{seplst}, $action)."\n");
# process input
} else {
process_input (undef, $client, $request, \%attr);
Expand Down Expand Up @@ -3660,9 +3672,10 @@ if (defined $options{'dumpcache'}) {

# remove cache item
if (defined $options{'delcache'} or defined $options{'delrate'}) {
my $dctarget = (defined $postfwd_settings{daemons}{cache}) ? 'cache' : 'server';
print "\n".( join "\n",
split $postfwd_settings{sepreq}.$postfwd_settings{seplst},
(&{$postfwd_settings{cache}{check}} ('cache', (($options{'delcache'}) ? 'CMD=RC '.$options{'delcache'} : 'CMD=RR '.$options{'delrate'})) || '<undef>')
(&{$postfwd_settings{$dctarget}{check}} ($dctarget, (($options{'delcache'}) ? 'CMD=RC '.$options{'delcache'} : 'CMD=RR '.$options{'delrate'})) || '<undef>')
)."\n\n";
exit;
};
Expand Down

0 comments on commit 8221c90

Please sign in to comment.