From 84b65bad347129f751e3ed208516697bc3fe1820 Mon Sep 17 00:00:00 2001 From: David Levine Date: Mon, 9 Jul 2012 19:15:13 -0500 Subject: [PATCH] Renamed "sendmail" mts method to "sendmail/smtp", allowing "sendmail" as an alias. Renamed "pipe" to "sendmail/pipe". --- Makefile.am | 2 +- configure.ac | 7 +-- docs/contrib/build_nmh | 2 +- docs/pending-release-notes | 15 ++++--- etc/mts.conf.in | 16 +++---- h/mts.h | 8 ++-- man/mh-mail.man | 2 +- man/mh-tailor.man | 8 ++-- man/send.man | 2 +- mts/smtp/smtp.c | 2 +- sbr/mts.c | 12 +++--- test/fakesendmail | 2 +- test/post/{test-pipe => test-sendmail-pipe} | 18 ++++---- uip/post.c | 61 ++++++++++++++------------- 14 files changed, 81 insertions(+), 76 deletions(-) rename test/post/{test-pipe => test-sendmail-pipe} (79%) diff --git a/Makefile.am b/Makefile.am index 841c9ec..71cff27 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,7 +65,7 @@ TESTS = test/ali/test-ali \ test/post/test-post-basic test/post/test-post-multiple \ test/post/test-post-dcc test/post/test-post-fcc \ test/post/test-post-multifrom test/post/test-post-envelope \ - test/post/test-post-group test/post/test-pipe \ + test/post/test-post-group test/post/test-sendmail-pipe \ test/prompter/test-prompter \ test/rcv/test-rcvdist test/rcv/test-rcvpack test/rcv/test-rcvstore \ test/refile/test-refile \ diff --git a/configure.ac b/configure.ac index eaa60b3..77f4165 100644 --- a/configure.ac +++ b/configure.ac @@ -111,12 +111,13 @@ AC_ARG_ENABLE([lockdir], dnl What method of posting should post use? AC_ARG_WITH([mts], - AS_HELP_STRING([--with-mts=@<:@smtp|sendmail|pipe@:>@], + AS_HELP_STRING([--with-mts=@<:@smtp|sendmail/smtp|sendmail/pipe@:>@], [specify the default mail transport agent/service])) AS_IF([test x"$with_mts" = x"smtp"], [MTS="smtp"], - [test x"$with_mts" = x"sendmail"], [MTS="sendmail"], - [test x"$with_mts" = x"pipe"], [MTS="pipe"], + [test x"$with_mts" = x"sendmail"], [MTS="sendmail/smtp"], + [test x"$with_mts" = x"sendmail/smtp"], [MTS="sendmail/smtp"], + [test x"$with_mts" = x"sendmail/pipe"], [MTS="sendmail/pipe"], [MTS="smtp"]) AC_SUBST([MTS])dnl diff --git a/docs/contrib/build_nmh b/docs/contrib/build_nmh index e1905f9..7d46fe7 100755 --- a/docs/contrib/build_nmh +++ b/docs/contrib/build_nmh @@ -174,7 +174,7 @@ if [ $yes -eq 0 ]; then read locking [ "$locking" ] && config_locking="$locking" - printf 'MTS (smtp|sendmail|pipe) [%s]: ' $config_mts + printf 'MTS (smtp|sendmail/smtp|sendmail/pipe) [%s]: ' $config_mts read mts [ "$mts" ] && config_mts="$mts" diff --git a/docs/pending-release-notes b/docs/pending-release-notes index f7462a7..dd8c395 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -39,13 +39,14 @@ OBSOLETE/DEPRECATED FEATURES http://smtpfilter.sourceforge.net/esmtp.html - conflict(8) is deprecated and will be removed from the next release. - mhtest(8) is deprecated and will be removed from the next release. -- spost(8) has been merged into post(8). Its functionality is enabled - by selecting the pipe mail transport method in etc/mts.conf, which - in turn can be configured using --with-mts=pipe. The spost - -noalias, -backup/-nobackup, -push/-nopush, and -remove/-noremove - switches are not supported by post. Note that spost did not support - -whom or Dcc, and neither does post when using mts: pipe. spost is - deprecated and will be removed from the next release. +- spost(8) has been merged into post(8). Its functionality is + enabled by selecting the sendmail/pipe mail transport method in + etc/mts.conf, which in turn can be configured using + --with-mts=sendmail/pipe. The spost -noalias, -backup/-nobackup, + -push/-nopush, and -remove/-noremove switches are not supported by + post. Note that spost did not support -whom or Dcc, and neither + does post when using mts: pipe. spost is deprecated and will be + removed from the next release. --------- BUG FIXES diff --git a/etc/mts.conf.in b/etc/mts.conf.in index 7cb0a4d..4e3deda 100644 --- a/etc/mts.conf.in +++ b/etc/mts.conf.in @@ -5,14 +5,14 @@ # # The delivery method to use, which must be one of the following: -# smtp: nmh opens a socket connection to the appropriate port -# on the servers listed below and speaks SMTP to the -# first one that responds. This is the default. -# sendmail: nmh pipes messages directly to the sendmail program, -# speaking SMTP. -# pipe: nmh pipes messages directly to the sendmail program, -# using the -t option so that addresses are retrieved -# from the message. +# smtp: nmh opens a socket connection to the appropriate port +# on the servers listed below and speaks SMTP to the +# first one that responds. This is the default. +# sendmail/smtp: nmh pipes messages directly to the sendmail program, +# speaking SMTP. Can be abbreviated to "sendmail". +# sendmail/pipe: nmh pipes messages directly to the sendmail program, +# using the -t option so that addresses are retrieved +# from the message. mts: %mts% # Name that nmh considers `local'. If not set, nmh will diff --git a/h/mts.h b/h/mts.h index 8496c28..ab78973 100644 --- a/h/mts.h +++ b/h/mts.h @@ -42,10 +42,10 @@ void mts_init (char *); * MTS specific variables */ -/* whether to speak SMTP to localhost:25 or to /usr/sbin/sendmail */ -#define MTS_SMTP 0 -#define MTS_SENDMAIL 1 -#define MTS_PIPE 2 +/* whether to speak SMTP, and over the network or directly to sendmail */ +#define MTS_SMTP 0 +#define MTS_SENDMAIL_SMTP 1 +#define MTS_SENDMAIL_PIPE 2 extern int sm_mts; extern char *sendmail; diff --git a/man/mh-mail.man b/man/mh-mail.man index 30506e9..21d9e22 100644 --- a/man/mh-mail.man +++ b/man/mh-mail.man @@ -182,7 +182,7 @@ line receive the same messsage as recipients on the \*(lqTo:\*(rq and for more details. .B Dcc is not supported with the -.B pipe +.B sendmail/pipe mail transport method. .RE .PP diff --git a/man/mh-tailor.man b/man/mh-tailor.man index 9e29a05..a509ea6 100644 --- a/man/mh-tailor.man +++ b/man/mh-tailor.man @@ -32,9 +32,9 @@ default values and a description of their meanings are listed below: The mail transport method to use. The three acceptable options are .B smtp (which is the default), -.BR sendmail , +.BR sendmail/smtp , and -.BR pipe . +.BR sendmail/pipe . .PP If you use .BR smtp , @@ -50,7 +50,7 @@ to the mail port on the machine specified in the entry. .PP If you use -.BR sendmail , +.BR sendmail/smtp , then .B post will send messages by forking a @@ -60,7 +60,7 @@ It will still speak SMTP with this local copy of .BR sendmail . .PP The third alternative, -.BR pipe , +.BR sendmail/pipe , also forks a local copy of .B sendmail but feeds the message directly to it, using diff --git a/man/send.man b/man/send.man index b823517..bb86079 100644 --- a/man/send.man +++ b/man/send.man @@ -255,7 +255,7 @@ new message with a minimal set of headers. Included in the body of the message will be a copy of the message sent to the sighted recipients. .PP If a \*(lqDcc:\*(rq field is encountered and the -.B pipe +.B sendmail/pipe mail transport method is not in use, its addresses will be used for delivery, and the \*(lqDcc:\*(rq field will be removed from the message. The blind recipients will receive the same message sent to the sighted diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index c18b89b..00df119 100644 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -768,7 +768,7 @@ sm_end (int type) int status; struct smtp sm_note; - if (sm_mts == MTS_SENDMAIL) { + if (sm_mts == MTS_SENDMAIL_SMTP) { switch (sm_child) { case NOTOK: case OK: diff --git a/sbr/mts.c b/sbr/mts.c index 661975b..d28f285 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -63,7 +63,7 @@ static char localmbox[BUFSIZ]; * MTS specific variables */ static char *sm_method = "smtp"; -int sm_mts = MTS_SMTP; +int sm_mts = MTS_SENDMAIL_SMTP; char *sendmail = SENDMAILPATH; /* @@ -148,13 +148,13 @@ mts_init (char *name) if (strcmp(sm_method, "smtp") == 0) sm_mts = MTS_SMTP; - else if (strcmp(sm_method, "sendmail") == 0) - sm_mts = MTS_SENDMAIL; - else if (strcmp(sm_method, "pipe") == 0) - sm_mts = MTS_PIPE; + else if (strcmp(sm_method, "sendmail/smtp") == 0) + sm_mts = MTS_SENDMAIL_SMTP; + else if (strcmp(sm_method, "sendmail/pipe") == 0) + sm_mts = MTS_SENDMAIL_PIPE; else { advise(NULL, "unsupported \"mts\" value in mts.conf: %s", sm_method); - sm_mts = MTS_SMTP; + sm_mts = MTS_SENDMAIL_SMTP; } } diff --git a/test/fakesendmail b/test/fakesendmail index c3bc4e1..fb959e2 100755 --- a/test/fakesendmail +++ b/test/fakesendmail @@ -1,7 +1,7 @@ #! /bin/sh ## # fakesendmail - A fake sendmail program used by the nmh test suite -# to test the pipe mts. +# to test the sendmail/pipe mts. # # This code is Copyright (c) 2012, by the authors of nmh. See the # COPYRIGHT file in the root directory of the nmh distribution for diff --git a/test/post/test-pipe b/test/post/test-sendmail-pipe similarity index 79% rename from test/post/test-pipe rename to test/post/test-sendmail-pipe index c9048ed..22f9e7d 100755 --- a/test/post/test-pipe +++ b/test/post/test-sendmail-pipe @@ -1,6 +1,7 @@ #!/bin/sh # -# Test the basic behavior of post when configured with pipe delivery method. +# Test the basic behavior of post when configured with sendmail/pipe +# delivery method. # set -e @@ -15,13 +16,13 @@ fi setup_test testname="${MH_TEST_DIR}/$$" -#### Force test of pipe regardless of configuration. +#### Force test of sendmail/pipe regardless of configuration. mts_pipe="${MHMTSCONF}-pipe" -sed -e 's/mts: *.*/mts: pipe/' "${MHMTSCONF}" >"$mts_pipe" +sed -e 's/mts: *.*/mts: sendmail\/pipe/' "${MHMTSCONF}" >"$mts_pipe" printf "%s\n" "sendmail: ${srcdir}/test/fakesendmail" >>"$mts_pipe" MHMTSCONF="$mts_pipe" -test_pipe () +test_sendmail_pipe () { send -draft @@ -49,8 +50,9 @@ test_pipe () } # -# Basic test - Simple message, single user, single recipient. -# Dots are not stuffed because pipe invokes sendmail with -i. +# Basic test - Simple message, single user, single recipient. Dots +# are not stuffed because sendmail/pipe causes sendmail to be invoked +# with -i. # cat > "${MH_TEST_DIR}/Mail/draft" < @@ -71,7 +73,7 @@ This is a test . EOF -test_pipe "${testname}.expected" +test_sendmail_pipe "${testname}.expected" # check Bcc @@ -112,7 +114,7 @@ This is a test ------- End of Blind-Carbon-Copy EOF -test_pipe "${testname}.expected1" "${testname}.expected2" +test_sendmail_pipe "${testname}.expected1" "${testname}.expected2" rm -f ${MHMTSCONF} diff --git a/uip/post.c b/uip/post.c index f63a286..08c62eb 100644 --- a/uip/post.c +++ b/uip/post.c @@ -144,32 +144,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[] = { @@ -634,7 +634,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 +642,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 +1065,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 +1110,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) { @@ -1486,7 +1487,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++) -- 1.7.10.4