2012-06-22 11:38:01 +02:00
|
|
|
package Qpsmtpd::SMTP::Prefork;
|
|
|
|
use Qpsmtpd::SMTP;
|
|
|
|
use Qpsmtpd::Constants;
|
|
|
|
@ISA = qw(Qpsmtpd::SMTP);
|
|
|
|
|
|
|
|
sub dispatch {
|
2013-04-21 06:08:43 +02:00
|
|
|
my $self = shift;
|
|
|
|
my ($cmd) = lc shift;
|
2012-06-22 11:38:01 +02:00
|
|
|
|
2013-04-21 06:08:43 +02:00
|
|
|
$self->{_counter}++;
|
2012-06-22 11:38:01 +02:00
|
|
|
|
2013-04-21 06:08:43 +02:00
|
|
|
if ($cmd !~ /^(\w{1,12})$/ or !exists $self->{_commands}->{$1}) {
|
|
|
|
$self->run_hooks("unrecognized_command", $cmd, @_);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
$cmd = $1;
|
2012-06-22 11:38:01 +02:00
|
|
|
|
2013-04-21 06:08:43 +02:00
|
|
|
if (1 or $self->{_commands}->{$cmd} and $self->can($cmd)) {
|
|
|
|
my ($result) = eval { $self->$cmd(@_) };
|
|
|
|
if ($@ =~ /^disconnect_tcpserver/) {
|
|
|
|
die "disconnect_tcpserver";
|
|
|
|
}
|
|
|
|
elsif ($@) {
|
|
|
|
$self->log(LOGERROR, "XX: $@") if $@;
|
|
|
|
}
|
|
|
|
return $result if defined $result;
|
|
|
|
return $self->fault("command '$cmd' failed unexpectedly");
|
2012-06-22 11:38:01 +02:00
|
|
|
}
|
|
|
|
|
2013-04-21 06:08:43 +02:00
|
|
|
return;
|
2012-06-22 11:38:01 +02:00
|
|
|
}
|