This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The nmh Mail Handling System".

The branch, master has been updated
       via  b2fb9dfa039340fb4776e36cb381d02fffacd608 (commit)
       via  6a0b804e4d6562952662dd618e9feca755c10fff (commit)
      from  d6b1aed6b65b10cd5db73a5b2080c4bdefefff39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=b2fb9dfa039340fb4776e36cb381d02fffacd608


commit b2fb9dfa039340fb4776e36cb381d02fffacd608
Author: Ken Hornstein <[email protected]>
Date:   Wed Mar 14 21:15:54 2012 -0400

    New test suite for "post"; uses fakesmtp to trap the SMTP protocol.

diff --git a/Makefile.am b/Makefile.am
index e402ca1..8abe7ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,6 +57,9 @@ TESTS = test/bad-input/test-header \
        test/mhshow/test-subpart test/mhstore/test-mhstore \
        test/new/test-basic \
        test/pick/test-pick test/pick/test-stderr \
+       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/refile/test-refile \
        test/repl/test-if-str test/scan/test-scan \
        test/sequences/test-flist test/sequences/test-mark \
@@ -207,7 +210,8 @@ EXTRA_DIST = config/version.sh sbr/sigmsg.awk 
etc/mts.conf.in etc/sendfiles.in \
             man/sendfiles.man man/show.man man/slocal.man man/sortm.man \
             man/unseen.man man/whatnow.man man/whom.man test/README $(TESTS) \
             test/inc/deb359167.mbox test/inc/fromline.txt \
-            test/inc/msgheader.txt test/inc/filler.txt test/inc/md5sums
+            test/inc/msgheader.txt test/inc/filler.txt test/inc/md5sums \
+            test/post/test-post-common.sh
 
 ##
 ## These are all of the definitions for each of the programs listed above.
diff --git a/test/common.sh.in b/test/common.sh.in
index e596fb1..1162566 100644
--- a/test/common.sh.in
+++ b/test/common.sh.in
@@ -137,6 +137,7 @@ Path: ${MH_TEST_DIR}/Mail
 mhlproc: ${MH_LIB_DIR}/mhl
 showproc: ${MH_LIB_DIR}/mhl
 postproc: ${MH_LIB_DIR}/post
+fileproc: ${MH_INST_DIR}${bindir}/refile
 EOF
 
   for f in MailAliases components digestcomps distcomps forwcomps mhl.body \
diff --git a/test/post/test-post-basic b/test/post/test-post-basic
new file mode 100755
index 0000000..a2e4fac
--- /dev/null
+++ b/test/post/test-post-basic
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# Test the basic behavior of post
+#
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "${srcdir}/test/post/test-post-common.sh"
+
+#
+# Basic test - Simple message, single user, single recipient.  Note that
+# we test dot-stuffing here as well.
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Test
+
+This is a test
+.
+EOF
+
+cat > "${testname}.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Test
+Date:
+
+This is a test
+..
+.
+QUIT
+EOF
+
+test_post "${testname}.actual" "${testname}.expected"
+
+#
+# Make sure a draft without a From: is rejected
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+To: Somebody Else <[email protected]>
+Subject: Blank Test
+
+This is a blank test
+EOF
+
+run_test "send -draft -server 127.0.0.1 -port $localport" \
+       "post: message has no From: header
+post: See default components files for examples
+post: re-format message and try again
+send: message not delivered to anyone"
+
+exit ${failed:-0}
diff --git a/test/post/test-post-common.sh b/test/post/test-post-common.sh
new file mode 100755
index 0000000..7698b81
--- /dev/null
+++ b/test/post/test-post-common.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Common routines for the post tests
+#
+
+set -e
+
+. "${MH_OBJ_DIR}/test/common.sh"
+
+setup_test
+
+localport=65412
+testname="${MH_TEST_DIR}/$$"
+
+#
+# Set this for the EHLO command
+#
+
+echo "clientname: nosuchhost.example.com" >> ${MHMTSCONF}
+
+#
+# One "post" test run.  Ok, yeah, we're using "send", but that's just
+# because it's easier.
+#
+
+test_post ()
+{ "${MH_OBJ_DIR}/test/fakesmtp" "$1" $localport &
+    pid="$!"
+
+    send -draft -server 127.0.0.1 -port $localport || exit 1
+
+    wait $!
+
+    #
+    # It's hard to calculate the exact Date: header post is going to
+    # use, so we'll just use sed to remove the actual date so we can easily
+    # compare it against our "correct" output.
+    #
+
+    sed -i "" -e 's/^Date:.*/Date:/' "$1"
+
+    check "$1" "$2"
+}
diff --git a/test/post/test-post-dcc b/test/post/test-post-dcc
new file mode 100755
index 0000000..f2bbda6
--- /dev/null
+++ b/test/post/test-post-dcc
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# Test the behavior of post with multiple recipients (& dcc)
+#
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "${srcdir}/test/post/test-post-common.sh"
+
+#
+# Dcc test
+#
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody <[email protected]>
+To: Somebody One <[email protected]>,
+    Somebody Two <[email protected]>
+Subject: Test Dcc
+Dcc: Somebody Three <[email protected]>
+
+This is test of Dcc recipients.
+EOF
+
+cat > "${testname}.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+RCPT TO:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody <[email protected]>
+To: Somebody One <[email protected]>,
+    Somebody Two <[email protected]>
+Subject: Test Dcc
+Date:
+
+This is test of Dcc recipients.
+.
+QUIT
+EOF
+
+test_post "${testname}.actual" "${testname}.expected"
+
+exit ${failed:-0}
diff --git a/test/post/test-post-envelope b/test/post/test-post-envelope
new file mode 100755
index 0000000..7d3288b
--- /dev/null
+++ b/test/post/test-post-envelope
@@ -0,0 +1,179 @@
+#!/bin/sh
+#
+# Test the setting of the envelope-from address for SMTP
+#
+# Note here we use multiple From: addresses for some tests so we pick up
+# some cases skipped in other tests.
+#
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "${srcdir}/test/post/test-post-common.sh"
+
+#
+# Sender
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody One <[email protected]>,
+      Mr Nobody Two <[email protected]>
+Sender: Mr Nobody Three <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Sender test
+
+This is a test of the Sender header.
+EOF
+
+cat > "${testname}.0.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody One <[email protected]>,
+      Mr Nobody Two <[email protected]>
+Sender: Mr Nobody Three <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Sender test
+Date:
+
+This is a test of the Sender header.
+.
+QUIT
+EOF
+
+test_post "${testname}.0.actual" "${testname}.0.expected"
+
+#
+# Check to see if Envelope-From overrides Sender
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody One <[email protected]>,
+      Mr Nobody Two <[email protected]>
+Sender: Mr Nobody Three <[email protected]>
+Envelope-From: Mr Nobody Four <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Envelope-From test
+
+This is a test of the Envelope-From header.
+EOF
+
+cat > "${testname}.1.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody One <[email protected]>,
+      Mr Nobody Two <[email protected]>
+Sender: Mr Nobody Three <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Envelope-From test
+Date:
+
+This is a test of the Envelope-From header.
+.
+QUIT
+EOF
+
+test_post "${testname}.1.actual" "${testname}.1.expected"
+
+#
+# See if Envelope-From will generate a Sender: header with multiple From:
+# addresses
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody One <[email protected]>,
+      Mr Nobody Two <[email protected]>
+Envelope-From: Mr Nobody Four <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Envelope-From and Sender test
+
+This is a test of the Envelope-From and Sender headers.
+EOF
+
+cat > "${testname}.2.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody One <[email protected]>,
+      Mr Nobody Two <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Envelope-From and Sender test
+Date:
+Sender: [email protected]
+
+This is a test of the Envelope-From and Sender headers.
+.
+QUIT
+EOF
+
+test_post "${testname}.2.actual" "${testname}.2.expected"
+
+#
+# And make sure we do NOT get a Sender with only one From:
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody One <[email protected]>
+Envelope-From: Mr Nobody Five <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Solo Envelope-From test
+
+This is a solo test of the Envelope-From header.
+EOF
+
+cat > "${testname}.3.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody One <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Solo Envelope-From test
+Date:
+
+This is a solo test of the Envelope-From header.
+.
+QUIT
+EOF
+
+test_post "${testname}.3.actual" "${testname}.3.expected"
+
+#
+# Make sure blank Envelope-From does what we expect it to
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody One <[email protected]>
+Envelope-From:
+To: Somebody Else <[email protected]>
+Subject: Blank Envelope-From test
+
+This is a blank test of the Envelope-From header.
+EOF
+
+cat > "${testname}.4.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody One <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Blank Envelope-From test
+Date:
+
+This is a blank test of the Envelope-From header.
+.
+QUIT
+EOF
+
+test_post "${testname}.4.actual" "${testname}.4.expected"
+
+exit ${failed:-0}
diff --git a/test/post/test-post-fcc b/test/post/test-post-fcc
new file mode 100755
index 0000000..b8a9419
--- /dev/null
+++ b/test/post/test-post-fcc
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Test the Fcc: feature of post
+#
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "${srcdir}/test/post/test-post-common.sh"
+
+#
+# Basic test - Simple message, single user, single recipient.  Note that
+# we test dot-stuffing here as well.
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Fcc test
+Fcc: +inbox
+
+This is a fcc test
+EOF
+
+cat > "${testname}.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Fcc test
+Date:
+
+This is a fcc test
+.
+QUIT
+EOF
+
+test_post "${testname}.actual" "${testname}.expected"
+
+cat > "${testname}.msg.expected" <<EOF
+From: Mr Nobody <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Fcc test
+Date:
+
+This is a fcc test
+EOF
+
+msgname=$(mhpath +inbox 11)
+
+sed -i "" -e 's/^Date:.*/Date:/' ${msgname}
+
+check "${testname}.msg.expected" ${msgname}
+
+exit ${failed:-0}
diff --git a/test/post/test-post-multifrom b/test/post/test-post-multifrom
new file mode 100755
index 0000000..9810141
--- /dev/null
+++ b/test/post/test-post-multifrom
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Test the behavior of post with multiple from addresses
+#
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "${srcdir}/test/post/test-post-common.sh"
+
+#
+# This SHOULD error
+#
+
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody One <[email protected]>, Mr Nobody Two <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Test multi-from
+
+This is a test of multi-from.
+EOF
+
+#
+# Since this should fail, don't run fakesmtp
+#
+
+run_test "send -draft -server 127.0.0.1 -port $localport" \
+       "post: A Sender: or Envelope-From: header is required with multiple
+From: addresses
+post: re-format message and try again
+send: message not delivered to anyone"
+
+#
+# This should also error
+#
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody One <[email protected]>, Mr Nobody Two <[email protected]>
+To: Somebody Else <[email protected]>
+Subject: Test multi-from
+Envelope-From:
+
+This is a test of multi-from with blank Envelope-From.
+EOF
+
+run_test "send -draft -server 127.0.0.1 -port $localport" \
+       "post: Envelope-From cannot be blank when there is multiple From: 
addresses
+and no Sender: header
+post: re-format message and try again
+send: message not delivered to anyone"
+
+exit ${failed:-0}
diff --git a/test/post/test-post-multiple b/test/post/test-post-multiple
new file mode 100755
index 0000000..4fe3e85
--- /dev/null
+++ b/test/post/test-post-multiple
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Test the behavior of post with multiple recipients
+#
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "${srcdir}/test/post/test-post-common.sh"
+
+#
+# Multiple recipients test
+#
+cat > "${MH_TEST_DIR}/Mail/draft" <<EOF
+From: Mr Nobody <[email protected]>
+To: Somebody One <[email protected]>,
+    Somebody Two <[email protected]>
+Subject: Test multiple
+
+This is test of multiple recipients.
+EOF
+
+cat > "${testname}.expected" <<EOF
+EHLO nosuchhost.example.com
+MAIL FROM:<[email protected]>
+RCPT TO:<[email protected]>
+RCPT TO:<[email protected]>
+DATA
+From: Mr Nobody <[email protected]>
+To: Somebody One <[email protected]>,
+    Somebody Two <[email protected]>
+Subject: Test multiple
+Date:
+
+This is test of multiple recipients.
+.
+QUIT
+EOF
+
+test_post "${testname}.actual" "${testname}.expected"
+
+exit ${failed:-0}

http://git.savannah.gnu.org/cgit/nmh.git/commit/?id=6a0b804e4d6562952662dd618e9feca755c10fff


commit 6a0b804e4d6562952662dd618e9feca755c10fff
Author: Ken Hornstein <[email protected]>
Date:   Wed Mar 14 21:15:17 2012 -0400

    Make sure we don't send Envelope-From if we're using spost.

diff --git a/uip/spost.c b/uip/spost.c
index 187f9a0..7454c89 100644
--- a/uip/spost.c
+++ b/uip/spost.c
@@ -112,6 +112,7 @@ static struct headers NHeaders[] = {
     { "Bcc",         HADR|HTRY|HBCC|HNIL, MINV },
     { "Message-Id",  HBAD,                0 },
     { "Fcc",         HFCC,                0 },
+    { "Envelope-From",HIGN,               0 },
     { NULL,          0,                   0 }
 };
 
@@ -128,6 +129,7 @@ static struct headers RHeaders[] = {
     { "Resent-Fcc",        HFCC,           0 },
     { "Reply-To",          HADR,           0 },
     { "Fcc",               HIGN,           0 },
+    { "Envelope-From",     HIGN,           0 },
     { NULL,                0,              0 }
 };
 

-----------------------------------------------------------------------

Summary of changes:
 Makefile.am                   |    6 +-
 test/common.sh.in             |    1 +
 test/post/test-post-basic     |   64 +++++++++++++++
 test/post/test-post-common.sh |   43 ++++++++++
 test/post/test-post-dcc       |   48 +++++++++++
 test/post/test-post-envelope  |  179 +++++++++++++++++++++++++++++++++++++++++
 test/post/test-post-fcc       |   61 ++++++++++++++
 test/post/test-post-multifrom |   55 +++++++++++++
 test/post/test-post-multiple  |   46 +++++++++++
 uip/spost.c                   |    2 +
 10 files changed, 504 insertions(+), 1 deletions(-)
 create mode 100755 test/post/test-post-basic
 create mode 100755 test/post/test-post-common.sh
 create mode 100755 test/post/test-post-dcc
 create mode 100755 test/post/test-post-envelope
 create mode 100755 test/post/test-post-fcc
 create mode 100755 test/post/test-post-multifrom
 create mode 100755 test/post/test-post-multiple


hooks/post-receive
-- 
The nmh Mail Handling System

_______________________________________________
Nmh-commits mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/nmh-commits

Reply via email to