X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fpost.c;h=3c4716100120e4a0d9c8d40a96e33c81c2b482d9;hb=374ece2e88368afd6e0a29c4ee4b75ffa9e28b39;hp=f63a2868064ea923c43a4f7aaa5bfb013d3a83a2;hpb=2b72292fe9a76e3e70b63a7cd639499214097bf8;p=mmh diff --git a/uip/post.c b/uip/post.c index f63a286..3c47161 100644 --- a/uip/post.c +++ b/uip/post.c @@ -131,6 +131,8 @@ static struct swit switches[] = { { "fileproc", -4 }, #define MHLPROCSW 39 { "mhlproc", -3 }, +#define MTSSW 40 + { "mts smtp|sendmail/smtp|sendmail/pipe", 2 }, { NULL, 0 } }; @@ -144,32 +146,32 @@ struct headers { /* * flags for headers->flags */ -#define HNOP 0x0000 /* just used to keep .set around */ -#define HBAD 0x0001 /* bad header - don't let it through */ -#define HADR 0x0002 /* header has an address field */ -#define HSUB 0x0004 /* Subject: header */ -#define HTRY 0x0008 /* try to send to addrs on header */ -#define HBCC 0x0010 /* don't output this header, unless MTS_PIPE */ -#define HMNG 0x0020 /* munge this header */ -#define HNGR 0x0040 /* no groups allowed in this header */ -#define HFCC 0x0080 /* FCC: type header */ -#define HNIL 0x0100 /* okay for this header not to have addrs */ -#define HIGN 0x0200 /* ignore this header */ -#define HDCC 0x0400 /* another undocumented feature */ -#define HONE 0x0800 /* Only (zero or) one address allowed */ -#define HEFM 0x1000 /* Envelope-From: header */ +#define HNOP 0x0000 /* just used to keep .set around */ +#define HBAD 0x0001 /* bad header - don't let it through */ +#define HADR 0x0002 /* header has an address field */ +#define HSUB 0x0004 /* Subject: header */ +#define HTRY 0x0008 /* try to send to addrs on header */ +#define HBCC 0x0010 /* don't output this header, unless MTS_SENDMAIL_PIPE */ +#define HMNG 0x0020 /* munge this header */ +#define HNGR 0x0040 /* no groups allowed in this header */ +#define HFCC 0x0080 /* FCC: type header */ +#define HNIL 0x0100 /* okay for this header not to have addrs */ +#define HIGN 0x0200 /* ignore this header */ +#define HDCC 0x0400 /* another undocumented feature */ +#define HONE 0x0800 /* Only (zero or) one address allowed */ +#define HEFM 0x1000 /* Envelope-From: header */ /* * flags for headers->set */ -#define MFRM 0x0001 /* we've seen a From: */ -#define MDAT 0x0002 /* we've seen a Date: */ -#define MRFM 0x0004 /* we've seen a Resent-From: */ -#define MVIS 0x0008 /* we've seen sighted addrs */ -#define MINV 0x0010 /* we've seen blind addrs */ -#define MSND 0x0020 /* we've seen a Sender: */ -#define MRSN 0x0040 /* We've seen a Resent-Sendr:*/ -#define MEFM 0x0080 /* We've seen Envelope-From: */ +#define MFRM 0x0001 /* we've seen a From: */ +#define MDAT 0x0002 /* we've seen a Date: */ +#define MRFM 0x0004 /* we've seen a Resent-From: */ +#define MVIS 0x0008 /* we've seen sighted addrs */ +#define MINV 0x0010 /* we've seen blind addrs */ +#define MSND 0x0020 /* we've seen a Sender: */ +#define MRSN 0x0040 /* We've seen a Resent-Sendr:*/ +#define MEFM 0x0080 /* We've seen Envelope-From: */ static struct headers NHeaders[] = { @@ -518,6 +520,12 @@ main (int argc, char **argv) adios (NULL, "missing argument to %s", argp[-2]); mhlproc = cp; continue; + + case MTSSW: + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + save_mts_method (cp); + continue; } } if (msg) @@ -634,7 +642,7 @@ main (int argc, char **argv) /* If we are doing a "whom" check */ if (whomsw) { - /* This won't work with MTS_PIPE. */ + /* This won't work with MTS_SENDMAIL_PIPE. */ verify_all_addresses (1, envelope); done (0); } @@ -642,11 +650,11 @@ main (int argc, char **argv) if (msgflags & MINV) { make_bcc_file (dashstuff); if (msgflags & MVIS) { - if (sm_mts != MTS_PIPE) { + if (sm_mts != MTS_SENDMAIL_PIPE) { /* It would be nice to have support to call - verify_all_addresses with MTS_PIPE, but that might - require running sendmail as root. Note that spost - didn't verify addresses. */ + verify_all_addresses with MTS_SENDMAIL_PIPE, but + that might require running sendmail as root. Note + that spost didn't verify addresses. */ verify_all_addresses (verbose, envelope); } post (tmpfil, 0, verbose, envelope); @@ -1065,7 +1073,8 @@ putadr (char *name, char *aka, struct mailname *mp, FILE *out, unsigned int flag if (mp->m_mbox == NULL || ((flags & HTRY) && !insert (mp))) return 0; - if (sm_mts != MTS_PIPE && ((flags & (HBCC | HDCC | HEFM)) || mp->m_ingrp)) + if (sm_mts != MTS_SENDMAIL_PIPE && + ((flags & (HBCC | HDCC | HEFM)) || mp->m_ingrp)) return 1; if (!nameoutput) { @@ -1109,7 +1118,7 @@ putgrp (char *name, char *group, FILE *out, unsigned int flags) int len; char *cp; - if (sm_mts != MTS_PIPE && (flags & HBCC)) + if (sm_mts != MTS_SENDMAIL_PIPE && (flags & HBCC)) return; if (!nameoutput) { @@ -1471,11 +1480,10 @@ do_addresses (int bccque, int talk) static void post (char *file, int bccque, int talk, char *envelope) { - int fd, onex; + int fd; int retval, i; pid_t child_id; - onex = !(msgflags & MINV) || bccque; if (verbose) { if (msgflags & MINV) printf (" -- Posting for %s Recipients --\n", @@ -1486,7 +1494,7 @@ post (char *file, int bccque, int talk, char *envelope) sigon (); - if (sm_mts == MTS_PIPE) { + if (sm_mts == MTS_SENDMAIL_PIPE) { char *sargv[16], **argp; for (i = 0; (child_id = fork()) == NOTOK && i < 5; i++) @@ -1502,7 +1510,6 @@ post (char *file, int bccque, int talk, char *envelope) argp = sargv; *argp++ = "sendmail"; - *argp++ = "-m"; /* send to me too */ *argp++ = "-t"; /* read msg for recipients */ *argp++ = "-i"; /* don't stop on "." */ if (whomsw) @@ -1520,7 +1527,7 @@ post (char *file, int bccque, int talk, char *envelope) } } else { if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch, - verbose, snoop, onex, queued, sasl, + verbose, snoop, queued, sasl, saslssf, saslmech, user, tls)) || rp_isbad (retval = sm_winit (envelope))) die (NULL, "problem initializing server; %s", rp_string (retval)); @@ -1532,7 +1539,7 @@ post (char *file, int bccque, int talk, char *envelope) close (fd); fflush (stdout); - sm_end (onex ? OK : DONE); + sm_end (!(msgflags & MINV) || bccque ? OK : DONE); sigoff (); if (verbose) { @@ -1560,7 +1567,7 @@ verify_all_addresses (int talk, char *envelope) if (!whomsw || checksw) if (rp_isbad (retval = sm_init (clientsw, serversw, port, watch, - verbose, snoop, 0, queued, sasl, + verbose, snoop, queued, sasl, saslssf, saslmech, user, tls)) || rp_isbad (retval = sm_winit (envelope))) die (NULL, "problem initializing server; %s", rp_string (retval));