Hi,

this adds a call to srand() in the forkserver after the fork(). If it's
not called _all_ children of the main daemon will get the same temporary
file name when using 'use File::Temp; ($fh, $fname) = tempfile();' in a
plugin (like clamav and my kavscanner do).

Hanno
--- qpsmtpd-forkserver.orig     Mon Jul  5 21:20:15 2004
+++ qpsmtpd-forkserver  Fri Jul 16 10:24:19 2004
@@ -141,6 +141,11 @@
     }
     die "fork: $!" unless defined $pid;     # failure
     # otherwise child
+    
+    ## call srand(), else we will have (e.g.) the same tempfile in
+    ## _all_ children 
+    ## i.e. after 'use File::Temp; ($fh,$name)=tempfile();' in a plugin
+    srand( ($$ ^ $port) ^ (time ^ unpack("C*", $iaddr)) );
 
     close($server);
 

Reply via email to