aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-07 21:02:35 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-07 21:02:35 +0000
commit6fa1ba3972ddba2216c216236dbc878b9fa8752a (patch)
tree3217321efa202b860229408b60c57d47bc0cdb8f /networking
parent90c31b3d4b58512ec2e1ed00670668dd52236415 (diff)
downloadbusybox-w32-6fa1ba3972ddba2216c216236dbc878b9fa8752a.tar.gz
busybox-w32-6fa1ba3972ddba2216c216236dbc878b9fa8752a.tar.bz2
busybox-w32-6fa1ba3972ddba2216c216236dbc878b9fa8752a.zip
crond: add handling of "MAILTO=user" lines
sendmail: handle a case when the whole mail comes from stdin (and no separate sender/subj is provided) both by dronnikov AT gmail.com function old new delta sendgetmail_main 1509 1674 +165 SynchronizeFile 671 767 +96 packed_usage 24054 24088 +34 crond_main 1404 1420 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 311/0) Total: 311 bytes
Diffstat (limited to 'networking')
-rw-r--r--networking/sendmail.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/networking/sendmail.c b/networking/sendmail.c
index 973d712b9..242bb0eaf 100644
--- a/networking/sendmail.c
+++ b/networking/sendmail.c
@@ -273,6 +273,7 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
273 273
274 OPTS_c = 1 << 6, // sendmail: assumed charset 274 OPTS_c = 1 << 6, // sendmail: assumed charset
275 OPTS_t = 1 << 7, // sendmail: recipient(s) 275 OPTS_t = 1 << 7, // sendmail: recipient(s)
276 OPTS_i = 1 << 8, // sendmail: ignore lone dots in message body (implied)
276 }; 277 };
277 278
278 const char *options; 279 const char *options;
@@ -288,8 +289,8 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
288 // SENDMAIL 289 // SENDMAIL
289 // save initial stdin (body or attachements can be piped!) 290 // save initial stdin (body or attachements can be piped!)
290 xdup2(STDIN_FILENO, INITIAL_STDIN_FILENO); 291 xdup2(STDIN_FILENO, INITIAL_STDIN_FILENO);
291 opt_complementary = "-2:w+:t:t::"; // count(-t) > 0 292 opt_complementary = "-2:w+:t::";
292 options = "w:U:P:X" "ns:c:t:"; 293 options = "w:U:P:X" "ns:c:t:i";
293 } else { 294 } else {
294 // FETCHMAIL 295 // FETCHMAIL
295 opt_after_connect = NULL; 296 opt_after_connect = NULL;
@@ -346,6 +347,29 @@ int sendgetmail_main(int argc ATTRIBUTE_UNUSED, char **argv)
346 // get the sender 347 // get the sender
347 opt_from = sane(*argv++); 348 opt_from = sane(*argv++);
348 349
350 // if no recipients _and_ no body files specified -> enter all-included mode
351 // i.e. scan stdin for To: and Subject: lines ...
352 // ... and then use the rest of stdin as message body
353 if (!opt_recipients && !*argv) {
354 // fetch recipients and (optionally) subject
355 char *s;
356 while ((s = xmalloc_reads(INITIAL_STDIN_FILENO, NULL, NULL)) != NULL) {
357 if (0 == strncmp("To: ", s, 4)) {
358 llist_add_to_end(&opt_recipients, s+4);
359 } else if (0 == strncmp("Subject: ", s, 9)) {
360 opt_subject = s+9;
361 opts |= OPTS_s;
362 } else {
363 char first = s[0];
364 free(s);
365 if (!first)
366 break; // empty line
367 }
368 }
369 // order to read body from stdin
370 *--argv = (char *)"-";
371 }
372
349 // introduce to server 373 // introduce to server
350 // we should start with modern EHLO 374 // we should start with modern EHLO
351 if (250 != smtp_checkp("EHLO %s", opt_from, -1)) { 375 if (250 != smtp_checkp("EHLO %s", opt_from, -1)) {