aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-03-10 01:34:13 +0100
committerGuilhem Moulin <guilhem@fripost.org>2016-03-10 01:36:21 +0100
commit29b5824a2871fd539f46e84eecca8e55080895c8 (patch)
tree158b42d20225856da79124c09c1d509b56eea66a
parentebacf74fdb3a507c6b0d865f4e9a8a6e59dbb10c (diff)
pullimap: check all print statements to the SMTP socket.
-rwxr-xr-xpullimap14
1 files changed, 7 insertions, 7 deletions
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));
}
}