On Mon, Feb 27, 2006 at 06:38:27PM -0800, Ask Bj?rn Hansen wrote: > >(Aside: it would be nice to have qpsmtpd run on multiple ports > >without having to run another > >copy.) > > I think with the 0.40/trunk branch that'll be a lot easier to do. > (Personally I like using the firewall software to do it -- like you > are doing it now).
It's a pretty short adjustment to forkserver; we already can listen on multiple addresses, allowing a port number to be included is easy enough. Index: qpsmtpd-forkserver =================================================================== --- qpsmtpd-forkserver (revision 623) +++ qpsmtpd-forkserver (working copy) @@ -56,8 +56,8 @@ if ($PORT =~ /^(\d+)$/) { $PORT = $1 } else { &usage } @LOCALADDR = ( '0.0.0.0' ) if [EMAIL PROTECTED]; for (0..$#LOCALADDR) { - if ($LOCALADDR[$_] =~ /^([\d\w\-.]+)$/) { - $LOCALADDR[$_] = $1; + if ($LOCALADDR[$_] =~ /^([\d\w\-.]+)(?::(\d+))?$/) { + $LOCALADDR[$_] = { 'addr' => $1, 'port' => $2 || $PORT }; } else { &usage; } @@ -94,13 +94,13 @@ # establish SERVER socket(s), bind and listen. for my $listen_addr (@LOCALADDR) { - my $server = IO::Socket::INET->new(LocalPort => $PORT, - LocalAddr => $listen_addr, + my $server = IO::Socket::INET->new(LocalPort => $listen_addr->{'port'}, + LocalAddr => $listen_addr->{'addr'}, Proto => 'tcp', Reuse => 1, Blocking => 0, Listen => SOMAXCONN ) - or die "Creating TCP socket $listen_addr:$PORT: $!\n"; + or die "Creating TCP socket $listen_addr->{'addr'}:$listen_addr->{'port'}: $!\n"; IO::Handle::blocking($server, 0); $select->add($server); } -- Devin \ aqua(at)devin.com, IRC:Requiem; http://www.devin.com Carraway \ 1024D/E9ABFCD2: 13E7 199E DD1E 65F0 8905 2E43 5395 CA0D E9AB FCD2