]> diplodocus.org Git - nmh/commitdiff
Merge remote-tracking branch 'origin' into xoauth
authorDavid Levine <david.levine@gonift.com>
Fri, 8 Jul 2016 14:48:59 +0000 (10:48 -0400)
committerDavid Levine <david.levine@gonift.com>
Fri, 8 Jul 2016 14:48:59 +0000 (10:48 -0400)
docs/pending-release-notes
test/common.sh.in
test/dist/test-dist
uip/sendsbr.c

index 5e70513090769d65f23628e1d562dd574b0bf94d..d56ae28d8913207b6700637cb94348b128910088 100644 (file)
@@ -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
index 802679a1eee14353cb9afae6e55617e01943a74d..1bf64c593812ce87030e443b401f5d9487a5739d 100644 (file)
@@ -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@
index 2f1e4f3e0d39d38f5bff3398f24dca82f2a00449..5c10b17e2564139517ca7c9511642db6f9e3c8a3 100755 (executable)
@@ -397,14 +397,14 @@ To: Some User <user@example.com>
 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?= <foo@bar.com>
-Resent-To: =?UTF-8?Q?Mr_Nobod=C3=BF?= <nobody@nowhere.com>
+Resent-From: =?UTF-8?Q?Mr_F=C3=B8o_Bar?= <resent-from@example.com>
+Resent-To: =?UTF-8?Q?Mr_Nobod=C3=BF?= <resent-to@example.com>
 Resent-Date:
 
 This is message number 1
 EOF
 
-test_dist +inbox 1 -noedit -from 'Mr Føo Bar <foo@bar.com>' \
-         -to 'Mr Nobodÿ <nobody@nowhere.com>' -fcc +outbox
+test_dist +inbox 1 -noedit -from 'Mr Føo Bar <resent-from@example.com>' \
+         -to 'Mr Nobodÿ <resent-to@example.com>' -fcc +outbox
 
 exit ${failed:-0}
index a3270e097eb3d80d9744aca880849c0455a0ad72..89894af58a1978cad7343fa29717fd6c9bdfc3df 100644 (file)
@@ -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;
+    }
 }