[git commit] sendmail: stop doing -t unconditionally; makemime: generate 76 char base64 lines

Denys Vlasenko vda.linux at googlemail.com
Fri Nov 18 21:25:35 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=41fea01066539ed8e958c21591a5fe7155565ceb
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 mailutils/mail.c     |    2 +-
 mailutils/sendmail.c |   22 ++++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/mailutils/mail.c b/mailutils/mail.c
index f5260d9..199f644 100644
--- a/mailutils/mail.c
+++ b/mailutils/mail.c
@@ -119,7 +119,7 @@ static char* FAST_FUNC parse_url(char *url, char **user, char **pass)
 void FAST_FUNC encode_base64(char *fname, const char *text, const char *eol)
 {
 	enum {
-		SRC_BUF_SIZE = 45,  /* This *MUST* be a multiple of 3 */
+		SRC_BUF_SIZE = 57,  /* This *MUST* be a multiple of 3 */
 		DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3),
 	};
 #define src_buf text
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index dbd4910..f96ca32 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -281,17 +281,19 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
 
 		// analyze headers
 		// To: or Cc: headers add recipients
-		if (0 == strncasecmp("To:", s, 3) || 0 == strncasecmp("Bcc:" + 1, s, 3)) {
-			rcptto(sane_address(s+3));
-			goto addheader;
+		if (opts & OPT_t) {
+			if (0 == strncasecmp("To:", s, 3) || 0 == strncasecmp("Bcc:" + 1, s, 3)) {
+				rcptto(sane_address(s+3));
+				goto addheader;
+			}
+			// Bcc: header adds blind copy (hidden) recipient
+			if (0 == strncasecmp("Bcc:", s, 4)) {
+				rcptto(sane_address(s+4));
+				free(s);
+				continue; // N.B. Bcc: vanishes from headers!
+			}
 		}
-		// Bcc: header adds blind copy (hidden) recipient
-		if (0 == strncasecmp("Bcc:", s, 4)) {
-			rcptto(sane_address(s+4));
-			free(s);
-			// N.B. Bcc: vanishes from headers!
-		} else
-		if (strchr(s, ':') || (list && skip_whitespace(s) != s)) {
+		if (strchr(s, ':') || (list && isspace(s))) {
 			// other headers go verbatim
 			// N.B. RFC2822 2.2.3 "Long Header Fields" allows for headers to occupy several lines.
 			// Continuation is denoted by prefixing additional lines with whitespace(s).


More information about the busybox-cvs mailing list