]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
listcontrol: add test for mailinglist+list@
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 12 Apr 2023 12:11:23 +0000 (14:11 +0200)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 12 Apr 2023 12:15:27 +0000 (14:15 +0200)
src/listcontrol.c
tests/mlmmj-receive.sh

index 3fcdc030215e32b7ddbc0d312e51e8d2372fac14..fa01058a3fabb1f462dee6f9818e33ccd6eb47f9 100644 (file)
@@ -662,7 +662,7 @@ permit:
                                }
                        }
                }
-               if (owner != NULL) {
+               if (owner == NULL) {
                        errno = 0;
                        log_error(LOG_ARGS, "A list request was sent to the"
                                " list from a non-owner address."
index b17b7ed168c97a883d6c101b1622f81cd23395b8..3800038881d146cb81985d3e505e720ce444cb68 100755 (executable)
@@ -10,7 +10,8 @@ tests_init \
        subscribe_nomail \
        subscribe_nomail_confunsub \
        subscribe_digest_confunsub \
-       subscribe_both
+       subscribe_both \
+       ctrl_list
 
 mlmmjreceive=$(command -v mlmmj-receive)
 
@@ -1371,3 +1372,84 @@ QUIT
 EOF
        atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-5.txt
 }
+
+ctrl_list_body() {
+       atf_check $srcdir/fakesmtpd
+       trap kill_fakesmtp EXIT TERM
+       init_ml list
+       rmdir list/text
+       ln -s ${srcdir}/../listtexts/en list/text
+       echo test@mlmmjtest > list/control/listaddress
+       echo "25678" > list/control/smtpport
+       echo "heloname" > list/control/smtphelo
+
+       cat > ctrllist << EOF
+From: bob@test
+To: test+list@mlmmjtest
+Return-Path: jane@test
+EOF
+
+       atf_check $mlmmjreceive -L list -F <ctrllist
+       atf_check -s exit:1 test -f mail-1.txt
+
+       echo "bob@test" > list/control/owner
+       atf_check $mlmmjreceive -L list -F <ctrllist
+
+cat > expected-1.txt << EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Subscribers_to_test=40mlmmjtest?=\r
+From: test+owner@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Here is the list of subscribers (to all versions of the list):\r
+\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+       atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-1.txt
+
+       printf "bob@test" > list/control/owner
+       printf "jane@doe.org\njo@bob.org\n" > list/subscribers.d/j
+       printf "jane@doe.org\n" > list/digesters.d/j
+       printf "bob@doe.org" > list/nomailsubs.d/b
+cat > expected-2.txt << EOF
+EHLO heloname\r
+MAIL FROM:<test+bounces-help@mlmmjtest>\r
+RCPT TO:<bob@test>\r
+DATA\r
+Subject: =?utf-8?q?Subscribers_to_test=40mlmmjtest?=\r
+From: test+owner@mlmmjtest\r
+To: bob@test\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: 8bit\r
+\r
+Hi, this is the Mlmmj program managing the <test@mlmmjtest> mailing list.\r
+\r
+Here is the list of subscribers (to all versions of the list):\r
+\r
+- jane@doe.org\r
+- jo@bob.org\r
+- jane@doe.org\r
+- bob@doe.org\r
+\r
+\r
+.\r
+QUIT\r
+EOF
+       atf_check $mlmmjreceive -L list -F <ctrllist
+       atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d" mail-2.txt
+       touch list/control/nolistsubsemail
+       atf_check $mlmmjreceive -L list -F <ctrllist
+       atf_check -s exit:1 test -f mail-3.txt
+}