fix databytes
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@8 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
97bfabe81d
commit
9155e06d22
8
Changes
8
Changes
@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
2002/01/21 ask
|
2002/01/21 ask
|
||||||
assorted fixes; getting dnsbl's to actually work
|
assorted fixes; getting dnsbl's to actually work
|
||||||
|
|
||||||
|
fixing the maximum message size (databytes) stuff (thanks for the
|
||||||
|
spot to Andrew Pam <xanni@glasswings.com.au>)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
relays.ordb.org
|
relays.ordb.org
|
||||||
bl.spamcop.net
|
|
||||||
spamsources.fabel.dk
|
spamsources.fabel.dk
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
abuse.rfc-ignorant.org does not have abuse contact - http://www.rfc-ignorant.org/
|
|
||||||
postmaster.rfc-ignorant.org does not have a working postmaster address - http://www.rfc-ignorant.org
|
|
||||||
dsn.rfc-ignorant.org does not accept bounces. This violates RFC 821/2505/2821 http://www.rfc-ignorant.org/
|
dsn.rfc-ignorant.org does not accept bounces. This violates RFC 821/2505/2821 http://www.rfc-ignorant.org/
|
||||||
|
|
||||||
|
|
||||||
|
24
qpsmtpd
24
qpsmtpd
@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
package QPsmtpd;
|
package QPsmtpd;
|
||||||
$QPsmtpd::VERSION = "0.05";
|
$QPsmtpd::VERSION = "0.06";
|
||||||
use strict;
|
use strict;
|
||||||
$| = 1;
|
$| = 1;
|
||||||
use Mail::Address ();
|
use Mail::Address ();
|
||||||
@ -25,7 +25,7 @@ BEGIN{$^W=1;}
|
|||||||
|
|
||||||
use vars qw($TRACE);
|
use vars qw($TRACE);
|
||||||
|
|
||||||
$TRACE = 1;
|
$TRACE = 0;
|
||||||
|
|
||||||
my %config;
|
my %config;
|
||||||
$config{me} = get_config('me') || hostname;
|
$config{me} = get_config('me') || hostname;
|
||||||
@ -107,7 +107,7 @@ sub ehlo {
|
|||||||
"$config{me} Hi $state{remote_info} [$state{remote_ip}].",
|
"$config{me} Hi $state{remote_info} [$state{remote_ip}].",
|
||||||
"PIPELINING",
|
"PIPELINING",
|
||||||
"8BITMIME",
|
"8BITMIME",
|
||||||
(get_config('databytes') ? "SIZE ".get_config('databytes') : ()),
|
(get_config('databytes') ? "SIZE ". (get_config('databytes'))[0] : ()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,10 +176,13 @@ sub data {
|
|||||||
my $buffer;
|
my $buffer;
|
||||||
my $size = 0;
|
my $size = 0;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
my $max_size = get_config('databytes') || 0;
|
my $max_size = (get_config('databytes'))[0] || 0;
|
||||||
my $blocked = "";
|
my $blocked = "";
|
||||||
my %matches;
|
my %matches;
|
||||||
my $header = 1;
|
my $header = 1;
|
||||||
|
|
||||||
|
warn "$$ max_size: $max_size / size: $size" if $TRACE > 5;
|
||||||
|
|
||||||
while (<STDIN>) {
|
while (<STDIN>) {
|
||||||
last if $_ eq ".\r\n";
|
last if $_ eq ".\r\n";
|
||||||
$i++;
|
$i++;
|
||||||
@ -213,6 +216,8 @@ sub data {
|
|||||||
alarm $config{timeout};
|
alarm $config{timeout};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warn "$$ max_size: $max_size / size: $size" if $TRACE > 5;
|
||||||
|
|
||||||
respond(550, $blocked),return 1 if $blocked;
|
respond(550, $blocked),return 1 if $blocked;
|
||||||
respond(552, "Message too big!"),return 1 if $max_size and $size > $max_size;
|
respond(552, "Message too big!"),return 1 if $max_size and $size > $max_size;
|
||||||
|
|
||||||
@ -314,7 +319,7 @@ sub check_dnsbl {
|
|||||||
foreach my $rr ($query->answer) {
|
foreach my $rr ($query->answer) {
|
||||||
$a_record = 1 if $rr->type eq "A";
|
$a_record = 1 if $rr->type eq "A";
|
||||||
next unless $rr->type eq "TXT";
|
next unless $rr->type eq "TXT";
|
||||||
warn "got txt record";
|
warn "got txt record" if $TRACE > 9
|
||||||
return $rr->txtdata;
|
return $rr->txtdata;
|
||||||
}
|
}
|
||||||
return "Blocked by $dnsbl" if $a_record;
|
return "Blocked by $dnsbl" if $a_record;
|
||||||
@ -334,7 +339,6 @@ sub check_dns {
|
|||||||
my $query = $res->search($host);
|
my $query = $res->search($host);
|
||||||
if ($query) {
|
if ($query) {
|
||||||
foreach my $rr ($query->answer) {
|
foreach my $rr ($query->answer) {
|
||||||
warn "rr->type ". $rr->type;
|
|
||||||
return 1 if $rr->type eq "A" or $rr->type eq "MX";
|
return 1 if $rr->type eq "A" or $rr->type eq "MX";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,15 +364,17 @@ sub check_relay {
|
|||||||
my %config_cache;
|
my %config_cache;
|
||||||
sub get_config {
|
sub get_config {
|
||||||
my $config = shift;
|
my $config = shift;
|
||||||
#warn "$$ trying to get config for $config" if $TRACE;
|
warn "$$ trying to get config for $config" if $TRACE;
|
||||||
return @{$config_cache{$config}} if $config_cache{$config};
|
return @{$config_cache{$config}} if $config_cache{$config};
|
||||||
my $configdir = '/var/qmail/control';
|
my $configdir = '/var/qmail/control';
|
||||||
$configdir = "/home/smtpd/qpsmtpd/config" if (-e "/home/smtpd/qpsmtpd/config/$config");
|
my ($name) = ($0 =~ m!(.*?)/([^/]+)$!);
|
||||||
|
$configdir = "$name/config" if (-e "$name/config/$config");
|
||||||
open CF, "<$configdir/$config" or warn "$$ could not open configfile $config: $!", return;
|
open CF, "<$configdir/$config" or warn "$$ could not open configfile $config: $!", return;
|
||||||
my @config = <CF>;
|
my @config = <CF>;
|
||||||
chomp @config;
|
chomp @config;
|
||||||
|
@config = grep { $_ } @config;
|
||||||
close CF;
|
close CF;
|
||||||
#warn "$$ returning ",Data::Dumper->Dump([\@config], [qw(config)]);
|
warn "$$ returning get_config for $config ",Data::Dumper->Dump([\@config], [qw(config)]) if $TRACE > 4;
|
||||||
$config_cache{$config} = \@config;
|
$config_cache{$config} = \@config;
|
||||||
return wantarray ? @config : $config[0];
|
return wantarray ? @config : $config[0];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user