From: David Levine Date: Fri, 8 Jul 2016 14:48:59 +0000 (-0400) Subject: Merge remote-tracking branch 'origin' into xoauth X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/2e04b8ea0e57e411665aa6a8814ff65db0d4cd2b?hp=ae54f991fd1a47a1e8bb3334f163c80388be82da Merge remote-tracking branch 'origin' into xoauth --- diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 5e705130..d56ae28d 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -43,6 +43,8 @@ NEW FEATURES numbers as, for example, "10K", or "2.3Mi" - Support for the -sendmail flag to send/post to change the sendmail binary when using the sendmail/pipe MTS. +- Added support to send(1) to specify switches to post(1) based on address or + domain name in From: header line in message draft. ----------------- OBSOLETE FEATURES diff --git a/test/common.sh.in b/test/common.sh.in index 802679a1..1bf64c59 100644 --- a/test/common.sh.in +++ b/test/common.sh.in @@ -6,6 +6,7 @@ #### that they are set here so that individual tests can be run #### outside of make. Requires that MH_OBJ_DIR be set on entry. test -z "$MH_TEST_DIR" && MH_TEST_DIR="$MH_OBJ_DIR/test/testdir" +export MH_TEST_DIR test -z "$MH_INST_DIR" && MH_INST_DIR="${MH_TEST_DIR}/inst" test -z "$MH_VERSION" && MH_VERSION="@VERSION@" test -z "$prefix" && prefix=@prefix@ diff --git a/test/dist/test-dist b/test/dist/test-dist index 2f1e4f3e..5c10b17e 100755 --- a/test/dist/test-dist +++ b/test/dist/test-dist @@ -397,14 +397,14 @@ To: Some User Date: Fri, 29 Sep 2006 00:00:00 Message-Id: 1@test.nmh Subject: Testing message 1 -Resent-From: =?UTF-8?Q?Mr_F=C3=B8o_Bar?= -Resent-To: =?UTF-8?Q?Mr_Nobod=C3=BF?= +Resent-From: =?UTF-8?Q?Mr_F=C3=B8o_Bar?= +Resent-To: =?UTF-8?Q?Mr_Nobod=C3=BF?= Resent-Date: This is message number 1 EOF -test_dist +inbox 1 -noedit -from 'Mr Føo Bar ' \ - -to 'Mr Nobodÿ ' -fcc +outbox +test_dist +inbox 1 -noedit -from 'Mr Føo Bar ' \ + -to 'Mr Nobodÿ ' -fcc +outbox exit ${failed:-0} diff --git a/uip/sendsbr.c b/uip/sendsbr.c index a3270e09..89894af5 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -834,18 +834,34 @@ get_from_header_info(const char *filename, const char **addr, const char **host, return NOTOK; } - if ((in = fopen(filename, "r")) != NULL) { - char *addrformat = "%(addr{from})", *hostformat = "%(host{from})"; - - if ((*addr = get_message_header_info(in, addrformat)) == NULL) { - *message = "unable to find From: address in"; - return NOTOK; + if ((in = fopen (filename, "r")) != NULL) { + /* There must be a non-blank Envelope-From or {Resent-}Sender or + {Resent-}From header. */ + char *addrformat = "%(addr{Envelope-From})"; + char *hostformat = "%(host{Envelope-From})"; + + if ((*addr = get_message_header_info (in, addrformat)) == NULL || + strlen (*addr) == 0) { + addrformat = distfile == NULL ? "%(addr{Sender})" : "%(addr{Resent-Sender})"; + hostformat = distfile == NULL ? "%(host{Sender})" : "%(host{Resent-Sender})"; + + if ((*addr = get_message_header_info (in, addrformat)) == NULL) { + addrformat = distfile == NULL ? "%(addr{From})" : "%(addr{Resent-From})"; + hostformat = distfile == NULL ? "%(host{From})" : "%(host{Resent-From})"; + + if ((*addr = get_message_header_info (in, addrformat)) == NULL) { + *message = "unable to find sender address in"; + fclose(in); + return NOTOK; + } + } } - rewind(in); + /* Use the hostformat that corresponds to the successful addrformat. */ if ((*host = get_message_header_info(in, hostformat)) == NULL) { fclose(in); - *message = "unable to find From: host in"; + *message = "unable to find sender host in"; + fclose(in); return NOTOK; } fclose(in); @@ -883,6 +899,7 @@ get_message_header_info(FILE *in, char *format) { /* * Read in the message and process the header. */ + rewind (in); parsing_header = 1; do { char name[NAMESZ], rbuf[NMH_BUFSIZ]; @@ -920,8 +937,12 @@ get_message_header_info(FILE *in, char *format) { /* Trim trailing newline, if any. */ retval = rtrim(charstring_buffer_copy((buffer))); charstring_free(buffer); - - return retval; + if (strlen (retval) > 0) { + return retval; + } else { + free (retval); + return NULL; + } }