From: Rocco Rutte Date: Fri, 12 Jun 2009 13:21:55 +0000 (+0200) Subject: SMTP: don't block but print CRLF for last line if it's not terminated X-Git-Tag: neomutt-20160307~585 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=501c46b89ca6ecbbb42e13ba06bef46b172f48c0;p=neomutt SMTP: don't block but print CRLF for last line if it's not terminated --- diff --git a/ChangeLog b/ChangeLog index 4453038d6..cc9cbfc02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-06-11 18:34 +0200 Rocco Rutte (f60eb41ef63c) + + * UPDATING: Mention maildir mtime use in browser + +2009-06-11 18:31 +0200 Rocco Rutte (fc60d44a5b22) + + * ChangeLog, send.c: Don't allow setting Return-Path: header via + my_hdr + + Mutt has use_envelope_from/envelope_from_address for that purpose. + Closes #1840. + 2009-06-11 18:17 +0200 Rocco Rutte (8efc1cd0b8c0) * browser.c: Use only latest mtime of new/cur for browser, not whole diff --git a/smtp.c b/smtp.c index 3c9df528d..9d096a392 100644 --- a/smtp.c +++ b/smtp.c @@ -171,7 +171,7 @@ smtp_data (CONNECTION * conn, const char *msgfile) FILE *fp = 0; progress_t progress; struct stat st; - int r; + int r, term = 0; size_t buflen; fp = fopen (msgfile, "r"); @@ -200,6 +200,7 @@ smtp_data (CONNECTION * conn, const char *msgfile) while (fgets (buf, sizeof (buf) - 1, fp)) { buflen = mutt_strlen (buf); + term = buf[buflen-1] == '\n'; if (buflen && buf[buflen-1] == '\n' && (buflen == 1 || buf[buflen - 2] != '\r')) snprintf (buf + buflen - 1, sizeof (buf) - buflen + 1, "\r\n"); @@ -216,9 +217,14 @@ smtp_data (CONNECTION * conn, const char *msgfile) safe_fclose (&fp); return smtp_err_write; } - mutt_progress_update (&progress, ftell (fp), -1); } + if (!term && buflen && + mutt_socket_write_d (conn, "\r\n", -1, M_SOCK_LOG_FULL) == -1) + { + safe_fclose (&fp); + return smtp_err_write; + } safe_fclose (&fp); /* terminate the message body */