rev 1429 - trunk/siesta/lib/Siesta/Send

[prev] [thread] [next] [lurker] [Date index for 2003/10/16]

From: richardc
Subject: rev 1429 - trunk/siesta/lib/Siesta/Send
Date: 17:39 on 16 Oct 2003
Author: richardc
Date: 2003-10-16 17:39:28 +0100 (Thu, 16 Oct 2003)
New Revision: 1429

Modified:
   trunk/siesta/lib/Siesta/Send/Sendmail.pm
Log:
security, we've heard of it


Modified: trunk/siesta/lib/Siesta/Send/Sendmail.pm
===================================================================
--- trunk/siesta/lib/Siesta/Send/Sendmail.pm	2003-10-16 10:05:27 UTC (rev 1428)
+++ trunk/siesta/lib/Siesta/Send/Sendmail.pm	2003-10-16 16:39:28 UTC (rev 1429)
@@ -46,11 +46,14 @@
     my $sendmail_limit = 80;
 
     while (my @local = splice @to, 0, $sendmail_limit) {
-        local *SENDMAIL;
-        open SENDMAIL, "|/usr/sbin/sendmail -oi -f $from " . join( ' ', @local )
-          or die "couldn't fork sendmail $!";
-        print SENDMAIL $message->as_string;
-        close SENDMAIL
+        my $pid = open my $sendmail, '|-';
+        die "couldn't fork $!" unless defined $pid;
+        unless ($pid) {
+            exec '/usr/sbin/sendmail', '-oi', '-f', $from, @local;
+            die "exec failed $!";
+        }
+        print $sendmail $message->as_string;
+        close $sendmail
           or die "problem closing sendmail $! $?";
     }
 

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52