Switch to a simpler and known good seeding algorithm

git-svn-id: https://svn.perl.org/qpsmtpd/trunk@274 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
Robert Spier 2004-07-18 01:29:00 +00:00
parent 26de7de964
commit 606df3773c

View File

@ -18,7 +18,7 @@ $| = 1;
# Configuration # Configuration
my $MAXCONN = 15; # max simultaneous connections my $MAXCONN = 15; # max simultaneous connections
my $PORT = 25; # port number my $PORT = 2525; # port number
my $LOCALADDR = '0.0.0.0'; # ip address to bind to my $LOCALADDR = '0.0.0.0'; # ip address to bind to
my $USER = 'smtpd'; # user to suid to my $USER = 'smtpd'; # user to suid to
my $MAXCONNIP = 5; # max simultaneous connections from one IP my $MAXCONNIP = 5; # max simultaneous connections from one IP
@ -142,10 +142,8 @@ while (1) {
die "fork: $!" unless defined $pid; # failure die "fork: $!" unless defined $pid; # failure
# otherwise child # otherwise child
## call srand(), else we will have (e.g.) the same tempfile in # all children should have different seeds, to prevent conflicts
## _all_ children srand( time ^ ($$ + ($$ << 15)) );
## i.e. after 'use File::Temp; ($fh,$name)=tempfile();' in a plugin
srand( ($$ ^ $port) ^ (time ^ unpack("C*", $iaddr)) );
close($server); close($server);