git-svn-id: https://svn.perl.org/qpsmtpd/trunk@592 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Matt Sergeant 2005-12-30 19:42:57 +00:00
parent 9b841dd928
commit abcdd3212c

View File

@ -7,7 +7,6 @@
# #
use lib 'lib'; use lib 'lib';
use Qpsmtpd::TcpServer;
use Qpsmtpd::Constants; use Qpsmtpd::Constants;
use IO::Socket; use IO::Socket;
use IO::Select; use IO::Select;
@ -39,6 +38,8 @@ usage: qpsmtpd-forkserver [ options ]
-u, --user U : run as a particular user (default 'smtpd') -u, --user U : run as a particular user (default 'smtpd')
-m, --max-from-ip M : limit connections from a single IP; default 5 -m, --max-from-ip M : limit connections from a single IP; default 5
--pid-file P : print main servers PID to file P --pid-file P : print main servers PID to file P
-h, --help : this page
--use-poll : force use of poll() instead of epoll()/kqueue()
-d, --detach : detach from controlling terminal (daemonize) -d, --detach : detach from controlling terminal (daemonize)
EOT EOT
exit 0; exit 0;
@ -52,9 +53,16 @@ GetOptions('h|help' => \&usage,
'u|user=s' => \$USER, 'u|user=s' => \$USER,
'pid-file=s' => \$PID_FILE, 'pid-file=s' => \$PID_FILE,
'debug+' => \$DEBUG, 'debug+' => \$DEBUG,
'use-poll' => \&force_poll,
'h|help' => \&usage,
'd|detach' => \$DETACH, 'd|detach' => \$DETACH,
) || &usage; ) || &usage;
sub force_poll {
$Danga::Socket::HaveEpoll = 0;
$Danga::Socket::HaveKQueue = 0;
}
# detaint the commandline # detaint the commandline
if ($PORT =~ /^(\d+)$/) { $PORT = $1 } else { &usage } if ($PORT =~ /^(\d+)$/) { $PORT = $1 } else { &usage }
@LOCALADDR = ( '0.0.0.0' ) if !@LOCALADDR; @LOCALADDR = ( '0.0.0.0' ) if !@LOCALADDR;
@ -131,7 +139,7 @@ if ($PID_FILE) {
} }
# Load plugins here # Load plugins here
my $qpsmtpd = Qpsmtpd::TcpServer->new(); my $qpsmtpd = Qpsmtpd::PollServer->new();
# Drop privileges # Drop privileges
my (undef, undef, $quid, $qgid) = getpwnam $USER or my (undef, undef, $quid, $qgid) = getpwnam $USER or