Ask and ye shall receive

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@659 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2006-09-14 19:48:37 +00:00
parent 6ef0bf27c7
commit 3837fabc9f
6 changed files with 48 additions and 5 deletions

View File

@ -1,4 +1,5 @@
0.33
relay_only plugin for smart relay host. (John Peacock)
Experimental IPv6 support (forkserver only). (Mike Williams)

View File

@ -30,7 +30,7 @@ sub read_input {
$_ =~ s/\r?\n$//s; # advanced chomp
$self->log(LOGDEBUG, "dispatching $_");
$self->connection->notes('original_string', $_);
defined $self->dispatch(split / +/, $_)
defined $self->dispatch(split / +/, $_, 2)
or $self->respond(502, "command unrecognized: '$_'");
alarm $timeout;
}

View File

@ -65,7 +65,7 @@ sub authsql {
my $connect = "dbi:mysql:dbname=vpopmail";
my $dbuser = "vpopmailuser";
my $dbpasswd = "**********";
my $dbpasswd = "vpoppasswd";
my $dbh = DBI->connect( $connect, $dbuser, $dbpasswd );
$dbh->{ShowErrorStatement} = 1;

View File

@ -25,8 +25,13 @@ sub register {
$self->{_unrec_cmd_max} = 4;
}
$qp->connection->notes('unrec_cmd_count', 0);
}
sub hook_connect {
my ($self, $transaction) = @_;
$self->qp->connection->notes('unrec_cmd_count', 0);
return DECLINED;
}
sub hook_unrecognized_command {

35
plugins/relay_only Normal file
View File

@ -0,0 +1,35 @@
#!/usr/bin/perl -w
=head1 NAME
relay_only - this plugin only permits relaying
=head1 SYNOPSIS
# in config/plugins
check_relay
relay_only
# other rcpt hooks go here
=head1 DESCRIPTION
This plugin can be used for the case where a server is used as the smart
relay host for internal users and external/authenticated users, but should
not be considered a normal inbound MX server
It should be configured to be run _AFTER_ check_relay and before other
RCPT hooks! Only clients that have authenticated or are listed in the
relayclient file will be allowed to send mail.
=cut
sub hook_rcpt {
if ( shift->qp->connection->relay_client ) {
return (OK);
}
else {
return (DENY);
}
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -Tw
# High performance pre-forking qpsmtpd daemon, Copyright (C) 2006 SoftScan
# http://www.softscan.co.uk
#
@ -96,6 +96,8 @@ GetOptions(
'help' => \&usage,
) || &usage;
$user = $1 if ($user =~ /(\w+)/);
# set max from ip to max number of children if option is set to disabled
$maxconnip = $max_children if ($maxconnip == 0);
@ -336,7 +338,7 @@ sub new_child {
# continue to accept connections until "old age" is reached
for (my $i = 0 ; $i < $child_lifetime ; $i++) {
# accept a connection
$0 = 'qpsmtpd child'; # set pretty child name in process listing
#$0 = 'qpsmtpd child'; # set pretty child name in process listing
my ($client, $iinfo) = $d->accept()
or die
"failed to create new object - $!"; # wait here until client connects