qpsmtpd/qpsmtpd
Jared Johnson d3ec361ab8 Turn warnings into $qpsmtpd->log() calls
This can be convenient, especially when one wants to emit a warning that will
show up when running the test suite but still be properly logged in production
2014-12-15 20:07:45 -06:00

38 lines
1.0 KiB
Perl
Executable File

#!/usr/bin/perl -Tw
# Copyright (c) 2001-2010 Ask Bjoern Hansen. See the LICENSE file for details.
# The "command dispatch" system was taken from colobus - http://trainedmonkey.com/colobus/
#
# this is designed to be run under tcpserver (http://cr.yp.to/ucspi-tcp.html)
# or inetd if you're into that sort of thing
#
# For more information see http://smtpd.github.io/qpsmtpd/
#
use lib 'lib';
use Qpsmtpd::TcpServer;
use strict;
$| = 1;
delete $ENV{ENV};
$ENV{PATH} = '/bin:/usr/bin:/var/qmail/bin';
my $qpsmtpd = Qpsmtpd::TcpServer->new();
$SIG{__WARN__} = sub { $qpsmtpd->warn_handler(@_) };
$qpsmtpd->load_plugins();
$qpsmtpd->start_connection();
$qpsmtpd->run(\*STDIN); # pass the "socket" like -prefork/-forkserver
$qpsmtpd->run_hooks("post-connection");
$qpsmtpd->connection->reset;
# needed for Qpsmtpd::TcpServer::check_socket():
# emulate IO::Socket::connected on STDIN. STDIN was used instead of STDOUT
# because the other code also calls getpeername(STDIN).
sub IO::Handle::connected { return getpeername(shift) }
__END__
1;