From 29b5824a2871fd539f46e84eecca8e55080895c8 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 10 Mar 2016 01:34:13 +0100 Subject: pullimap: check all print statements to the SMTP socket. --- pullimap | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pullimap') diff --git a/pullimap b/pullimap index 02aedf6..c8d4018 100755 --- a/pullimap +++ b/pullimap @@ -159,7 +159,7 @@ sub sendmail($$) { if ($$rfc822 eq '') { # RFC 5321 section 4.1.1.4: if there was no mail data, the first # "\r\n" ends the DATA command itself - $SMTP->printflush("\r\n.\r\n"); + $SMTP->printflush("\r\n.\r\n") or die; } else { my $offset = 0; my $length = length($$rfc822); @@ -167,7 +167,7 @@ sub sendmail($$) { my $line = substr($$rfc822, $offset, $end-$offset); # RFC 5321 section 4.5.2: the character sequence "\r\n.\r\n" # ends the mail text and cannot be sent by the user - $SMTP->print($line eq ".\r\n" ? "..\r\n" : $line); + $SMTP->print($line eq ".\r\n" ? "..\r\n" : $line) or die; $offset = $end; } if ($offset < $length) { @@ -175,9 +175,9 @@ sub sendmail($$) { # have the receiving SMTP server recognize the "end of data" # condition. See RFC 5321 section 4.1.1.4 my $line = substr($$rfc822, $offset); - $SMTP->print(($line eq "." ? ".." : $line), "\r\n"); + $SMTP->print(($line eq "." ? ".." : $line), "\r\n") or die; } - $SMTP->printflush(".\r\n"); + $SMTP->printflush(".\r\n") or die; } smtp_resp('250'); } @@ -200,14 +200,14 @@ sub smtp_send(@) { push @code, shift // die; } if ($SMTP_PIPELINING) { # SMTP pipelining (RFC 2920) - print STDERR join('', map {"C: $_\n"} @cmd) if $CONFIG{debug}; - $SMTP->printflush(join('', map {"$_\r\n"} @cmd)); + print STDERR (map {"C: $_\n"} @cmd) if $CONFIG{debug}; + $SMTP->printflush(map {"$_\r\n"} @cmd) or die; @r = smtp_resp($_) foreach @code; } else { foreach (@cmd) { print STDERR "C: $_\n" if $CONFIG{debug}; - $SMTP->printflush("$_\r\n"); + $SMTP->printflush("$_\r\n") or die; @r = smtp_resp(shift(@code)); } } -- cgit v1.2.3