add remove session reason, header skip, etc

This commit is contained in:
mischa 2022-08-20 10:26:20 +00:00
parent 568ab16185
commit 77bac3cdad

View File

@ -71,7 +71,7 @@ while (my $line = <>) {
dolog($fh, "$sid created session", $opt_l); dolog($fh, "$sid created session", $opt_l);
if ($from =~ m/^(postmaster|hostmaster|noreply.*|no-reply.*|bounce.*)@/i) { if ($from =~ m/^(postmaster|hostmaster|noreply.*|no-reply.*|bounce.*)@/i) {
$ooo{$sid} = 0; $ooo{$sid} = 0;
dolog($fh, "$sid from found $from", $opt_l); dolog($fh, "$sid from skip $from", $opt_l);
} }
} elsif ($event eq "tx-mail" && $code ne "ok") { } elsif ($event eq "tx-mail" && $code ne "ok") {
$ooo{$sid} = 0; $ooo{$sid} = 0;
@ -80,7 +80,7 @@ while (my $line = <>) {
$email = $address; $email = $address;
} elsif ($event eq "tx-rcpt" && $code ne "ok") { } elsif ($event eq "tx-rcpt" && $code ne "ok") {
delete $ooo{$sid}; delete $ooo{$sid};
dolog($fh, "$sid removed session", $opt_l); dolog($fh, "$sid removed session - rcpt doesn't exist", $opt_l);
} }
} }
if ($line =~ m/^filter/) { if ($line =~ m/^filter/) {
@ -90,15 +90,15 @@ while (my $line = <>) {
if (!$data) { $data = ""; } if (!$data) { $data = ""; }
if ($data =~ m/^precedence:\s+(bulk|list|junk)/i) { if ($data =~ m/^precedence:\s+(bulk|list|junk)/i) {
$ooo{$sid} = 0; $ooo{$sid} = 0;
dolog($fh, "$sid header found $data", $opt_l); dolog($fh, "$sid header skip $data", $opt_l);
} }
if ($data =~ m/^list-(help|id|owner|post|subscribe|unsubscribe):.*/i) { if ($data =~ m/^list-(help|id|owner|post|subscribe|unsubscribe):.*/i) {
$ooo{$sid} = 0; $ooo{$sid} = 0;
dolog($fh, "$sid header found $data", $opt_l); dolog($fh, "$sid header skip $data", $opt_l);
} }
if ($data =~ m/^x-loop:\s+opensmtpd\ admin\ virtual\ vacation/i) { if ($data =~ m/^x-loop:\s+opensmtpd\ admin\ virtual\ vacation/i) {
$ooo{$sid} = 0; $ooo{$sid} = 0;
dolog($fh, "$sid header found $data", $opt_l); dolog($fh, "$sid header skip $data", $opt_l);
} }
print STDOUT "filter-dataline|$sid|$token|$data\n"; print STDOUT "filter-dataline|$sid|$token|$data\n";
} }
@ -127,15 +127,15 @@ while (my $line = <>) {
close $fh_email; close $fh_email;
} }
delete $ooo{$sid}; delete $ooo{$sid};
dolog($fh, "$sid removed session", $opt_l); dolog($fh, "$sid removed session - OOO done", $opt_l);
} else { } else {
delete $ooo{$sid}; delete $ooo{$sid};
dolog($fh, "$sid removed session", $opt_l); dolog($fh, "$sid removed session - OOO cache hit", $opt_l);
} }
} elsif ($line =~ m/data-line/ && $data eq '.' && $ooo{$sid} == 0) { } elsif ($line =~ m/data-line/ && $data eq '.' && $ooo{$sid} == 0) {
delete $ooo{$sid}; delete $ooo{$sid};
dolog($fh, "$sid removed session", $opt_l); dolog($fh, "$sid removed session - OOO skip", $opt_l);
} }
} }
} }