2006-05-31 22:54:03 +02:00
|
|
|
package Qpsmtpd::SMTP::Prefork;
|
|
|
|
use Qpsmtpd::SMTP;
|
2006-11-22 17:30:37 +01:00
|
|
|
use Qpsmtpd::Constants;
|
2006-05-31 22:54:03 +02:00
|
|
|
@ISA = qw(Qpsmtpd::SMTP);
|
|
|
|
|
|
|
|
sub dispatch {
|
|
|
|
my $self = shift;
|
|
|
|
my ($cmd) = lc shift;
|
|
|
|
|
|
|
|
$self->{_counter}++;
|
|
|
|
|
|
|
|
if ($cmd !~ /^(\w{1,12})$/ or !exists $self->{_commands}->{$1}) {
|
2007-08-19 08:49:42 +02:00
|
|
|
$self->run_hooks("unrecognized_command", $cmd, @_);
|
|
|
|
return 1;
|
2006-05-31 22:54:03 +02:00
|
|
|
}
|
|
|
|
$cmd = $1;
|
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|