From MAILER-DAEMON Sun Oct 25 17:28:01 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZqSpd-00048M-T6
	for mharc-commit-mailutils@gnu.org; Sun, 25 Oct 2015 17:28:01 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46369)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqSpa-00047h-C3
	for commit-mailutils@gnu.org; Sun, 25 Oct 2015 17:28:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqSpX-0000xt-7w
	for commit-mailutils@gnu.org; Sun, 25 Oct 2015 17:27:58 -0400
Received: from vcs.savannah.gnu.org ([208.118.235.72]:60780)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqSpX-0000xp-4A
	for commit-mailutils@gnu.org; Sun, 25 Oct 2015 17:27:55 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqSpW-0002YQ-B3
	for commit-mailutils@gnu.org; Sun, 25 Oct 2015 21:27:54 +0000
Date: Sun, 25 Oct 2015 21:27:54 +0000
Message-Id: <E1ZqSpW-0002YQ-B3@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-735-g9a908ba
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: dcbf8f353e76d506ecf7ae6c48081783166a82ab
X-Git-Newrev: 9a908ba5a87216d24112e36f7f9c7ffbc6dd53a3
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 25 Oct 2015 21:28:01 -0000

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 "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=9a908ba5a87216d24112e36f7f9c7ffbc6dd53a3

The branch, master has been updated
       via  9a908ba5a87216d24112e36f7f9c7ffbc6dd53a3 (commit)
      from  dcbf8f353e76d506ecf7ae6c48081783166a82ab (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 -----------------------------------------------------------------
commit 9a908ba5a87216d24112e36f7f9c7ffbc6dd53a3
Author: Sergey Poznyakoff <gray@gnu.org>
Date:   Sun Oct 25 23:18:36 2015 +0200

    Fixes in sieve vacation extension
    
    * libmu_sieve/extensions/vacation.c (build_mime): Fix memory leak.
    This also flushes the message body stream, so its content becomes
    visible for the mailer.
    (noreply_address_p): Rename "addresses" tag to "noreply".
    (check_db): The "database" tag provides vacation database name.
    (vacation_reply): Always set message headers.
    (vacation_tags): Rename "addresses" tag to "noreply".
    New tag: "database"
    
    * sieve/tests/vacation.at: New file.
    * sieve/tests/Makefile.am (TESTSUITE_AT): Add vacation.at.
    * sieve/tests/testsuite.at: Include vacation.at.
    
    * doc/texinfo/programs.texi: Minor change.

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

Summary of changes:
 doc/texinfo/programs.texi         |    2 +-
 libmu_sieve/extensions/vacation.c |   31 +++--
 sieve/tests/Makefile.am           |    1 +
 sieve/tests/testsuite.at          |    2 +-
 sieve/tests/vacation.at           |  251 +++++++++++++++++++++++++++++++++++++
 5 files changed, 274 insertions(+), 13 deletions(-)
 create mode 100644 sieve/tests/vacation.at

diff --git a/doc/texinfo/programs.texi b/doc/texinfo/programs.texi
index 54abfd9..95b9a60 100644
--- a/doc/texinfo/programs.texi
+++ b/doc/texinfo/programs.texi
@@ -1502,7 +1502,6 @@ requests during @var{time} seconds, the child process terminates.
 
 @node Server Statement
 @subsubsection Server Statement
-@UNREVISED
 @cindex server statement
 @kwindex server
 @* Syntax:
@@ -1614,6 +1613,7 @@ and is denied if any one of them denies it.
 auth @{
   # @r{Set a list of modules for authentication.}
   authentication @var{module-list};
+  
   # @r{Set a list of modules for authorization.}
   authorization @var{module-list};
 @}
diff --git a/libmu_sieve/extensions/vacation.c b/libmu_sieve/extensions/vacation.c
index fee2074..067e772 100644
--- a/libmu_sieve/extensions/vacation.c
+++ b/libmu_sieve/extensions/vacation.c
@@ -19,10 +19,14 @@
 /* Syntax: vacation [:days <ndays: number>]
                     [:subject <subject: string>]
 		    [:aliases <address-list: list>]
-		    [:addresses <noreply-address-list: list>]
+		    [:noreply <noreply-address-list: list>]
 		    [:reply_regex <expr: string>]
 		    [:reply_prefix <prefix: string>]
-		    <reply text: string>
+		    [:sender <email: string>]
+		    [:database <path: string>]
+		    [:file]
+		    [:mime]
+		    <reply: string>
 */
 
 #ifdef HAVE_CONFIG_H
@@ -98,6 +102,9 @@ build_mime (mu_sieve_machine_t mach, mu_list_t tags, mu_mime_t *pmime,
     }
 
   rc = mu_stream_copy (stream, input, 0, NULL);
+  mu_stream_destroy (&input);
+  mu_stream_destroy (&stream);
+  
   if (rc)
     {
       mu_sieve_error (mach,
@@ -105,13 +112,9 @@ build_mime (mu_sieve_machine_t mach, mu_list_t tags, mu_mime_t *pmime,
 		      mu_strerror (rc));
       mu_mime_destroy (&mime);
       mu_message_destroy (&newmsg, NULL);
-      mu_stream_destroy (&input);
-      mu_stream_destroy (&stream);
       return 1;
     }
 
-  mu_stream_destroy (&input);
-  
   mu_header_create (&hdr, header, strlen (header));
   mu_message_set_header (newmsg, hdr, NULL);
 
@@ -157,7 +160,7 @@ _compare (void *item, void *data)
 
 /* Check whether an alias from ADDRESSES is part of To: or Cc: headers
    of the originating mail. Return non-zero if so and store a pointer
-   to the matching address to *MY_ADDRESS. */
+   to the matching address in *MY_ADDRESS. */
 static int
 match_addresses (mu_header_t hdr, mu_sieve_value_t *addresses,
 		 char **my_address)
@@ -241,7 +244,7 @@ noreply_address_p (mu_sieve_machine_t mach, mu_list_t tags, char *email)
   for (i = 0; rc == 0 && noreply_sender[i]; i++)
     rc = regex_comparator (noreply_sender[i], &rd);
 
-  if (!rc && mu_sieve_tag_lookup (tags, "addresses", &arg))
+  if (!rc && mu_sieve_tag_lookup (tags, "noreply", &arg))
     rc = mu_sieve_vlist_do (arg, regex_comparator, &rd);
   
   return rc;
@@ -338,6 +341,7 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from)
   int rc;
   mu_stream_t str;
   mu_locker_t locker;
+  const char *dbfile = "~/.vacation";
   
   if (mu_sieve_tag_lookup (tags, "days", &arg))
     {
@@ -348,7 +352,10 @@ check_db (mu_sieve_machine_t mach, mu_list_t tags, char *from)
   else
     days = DAYS_DEFAULT;
 
-  file = mu_tilde_expansion ("~/.vacation", MU_HIERARCHY_DELIMITER, NULL);
+  if (mu_sieve_tag_lookup (tags, "database", &arg))
+    dbfile = arg->v.string;
+  
+  file = mu_tilde_expansion (dbfile, MU_HIERARCHY_DELIMITER, NULL);
   if (!file)
     {
       mu_sieve_error (mach, _("%lu: cannot build db file name"),
@@ -563,9 +570,10 @@ vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
 	return -1;
       mu_mime_get_message (mime, &newmsg);
       mu_message_unref (newmsg);
-      mu_message_get_header (newmsg, &newhdr);
     }
   
+  mu_message_get_header (newmsg, &newhdr);
+  
   rc = mu_address_create (&to_addr, to);
   if (rc)
     {
@@ -685,10 +693,11 @@ static mu_sieve_tag_def_t vacation_tags[] = {
   {"days", SVT_NUMBER},
   {"subject", SVT_STRING},
   {"aliases", SVT_STRING_LIST},
-  {"addresses", SVT_STRING_LIST},
+  {"noreply", SVT_STRING_LIST},
   {"reply_regex", SVT_STRING},
   {"reply_prefix", SVT_STRING},
   {"sender", SVT_STRING},
+  {"database", SVT_STRING},
   {"mime", SVT_VOID},
   {"file", SVT_VOID},
   {NULL}
diff --git a/sieve/tests/Makefile.am b/sieve/tests/Makefile.am
index e16acee..abcad97 100644
--- a/sieve/tests/Makefile.am
+++ b/sieve/tests/Makefile.am
@@ -67,6 +67,7 @@ TESTSUITE_AT = \
   size.at\
   true.at\
   testsuite.at\
+  vacation.at\
   version.at
 
 TESTSUITE = $(srcdir)/testsuite
diff --git a/sieve/tests/testsuite.at b/sieve/tests/testsuite.at
index c7c7c2c..7bfd5fc 100644
--- a/sieve/tests/testsuite.at
+++ b/sieve/tests/testsuite.at
@@ -146,5 +146,5 @@ m4_include([pipetest.at])
 m4_include([list.at])
 m4_include([addheader.at])
 m4_include([delheader.at])
-
+m4_include([vacation.at])
 
diff --git a/sieve/tests/vacation.at b/sieve/tests/vacation.at
new file mode 100644
index 0000000..525bd1b
--- /dev/null
+++ b/sieve/tests/vacation.at
@@ -0,0 +1,251 @@
+# This file is part of GNU Mailutils. -*- Autotest -*-
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# GNU Mailutils is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3, or (at
+# your option) any later version.
+#
+# GNU Mailutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
+
+AT_BANNER([vacation])
+m4_pushdef([MUT_SIEVE_EXT_NAME],[vacation])
+
+MUT_SIEVE_EXT_TEST([default],[vac00],
+[require "vacation";
+
+vacation :database "vacation.db" "I'm on vacation";
+],
+[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <coyote@desert.example.org>
+   0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
+   1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
+   2: To: coyote@desert.example.org
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <b1ff@de.res.example.com>
+   0: In-Reply-To: Your message of TBD
+   1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
+   2: To: b1ff@de.res.example.com
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <bar@dontmailme.org>
+   0: References: <200112232808.fERKR9N16790@dontmailme.org>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2: 	<200112232808.fERKR9N16790@dontmailme.org>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: bar@dontmailme.org
+   5: Content-Transfer-Encoding: 8bit
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: I'm on vacation
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+MUT_SIEVE_EXT_TEST([database matching],[vac01],
+[require "vacation";
+
+vacation :database "vacation.db" "I'm on vacation";
+],
+[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <coyote@desert.example.org>
+   0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
+   1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
+   2: To: coyote@desert.example.org
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <b1ff@de.res.example.com>
+   0: In-Reply-To: Your message of TBD
+   1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
+   2: To: b1ff@de.res.example.com
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <bar@dontmailme.org>
+   0: References: <200112232808.fERKR9N16790@dontmailme.org>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2: 	<200112232808.fERKR9N16790@dontmailme.org>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: bar@dontmailme.org
+   5: Content-Transfer-Encoding: 8bit
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: I'm on vacation
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+MUT_SIEVE_EXT_TEST([mime],[vac02],
+[require "vacation";
+
+vacation :database "vacation.db" :mime "I'm on vacation.";
+],
+[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <coyote@desert.example.org>
+   0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
+   1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
+   2: To: coyote@desert.example.org
+   3: Content-Transfer-Encoding: base64
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: SSdtIG9uIHZhY2F0aW9uLg==
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <b1ff@de.res.example.com>
+   0: In-Reply-To: Your message of TBD
+   1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
+   2: To: b1ff@de.res.example.com
+   3: Content-Transfer-Encoding: base64
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: SSdtIG9uIHZhY2F0aW9uLg==
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <bar@dontmailme.org>
+   0: References: <200112232808.fERKR9N16790@dontmailme.org>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2: 	<200112232808.fERKR9N16790@dontmailme.org>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: bar@dontmailme.org
+   5: Content-Transfer-Encoding: base64
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: SSdtIG9uIHZhY2F0aW9uLg==
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+MUT_SIEVE_EXT_TEST([reply from file],[vac03],
+[require "vacation";
+
+vacation :database "vacation.db" :file "reply";
+],
+[AT_DATA([reply],[X-Mail-Processor: sieve
+
+I'm on vacation right now.
+I will attend to your message as soon as I'm back.
+
+Best regards,
+Ty Coon
+])
+MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <coyote@desert.example.org>
+   0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
+   1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
+   2: To: coyote@desert.example.org
+   3: X-Mail-Processor: sieve
+   4:
+   5: I'm on vacation right now.
+   6: I will attend to your message as soon as I'm back.
+   7:
+   8: Best regards,
+   9: Ty Coon
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <b1ff@de.res.example.com>
+   0: In-Reply-To: Your message of TBD
+   1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
+   2: To: b1ff@de.res.example.com
+   3: X-Mail-Processor: sieve
+   4:
+   5: I'm on vacation right now.
+   6: I will attend to your message as soon as I'm back.
+   7:
+   8: Best regards,
+   9: Ty Coon
+END OF MESSAGE
+ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE TO: <bar@dontmailme.org>
+   0: References: <200112232808.fERKR9N16790@dontmailme.org>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2: 	<200112232808.fERKR9N16790@dontmailme.org>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: bar@dontmailme.org
+   5: X-Mail-Processor: sieve
+   6:
+   7: I'm on vacation right now.
+   8: I will attend to your message as soon as I'm back.
+   9:
+  10: Best regards,
+  11: Ty Coon
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+m4_popdef([MUT_SIEVE_EXT_NAME])
+


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Mon Oct 26 02:41:25 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZqbTB-0002NL-6A
	for mharc-commit-mailutils@gnu.org; Mon, 26 Oct 2015 02:41:25 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40093)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqbT7-0002IU-MC
	for commit-mailutils@gnu.org; Mon, 26 Oct 2015 02:41:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqbT5-0000Zg-HK
	for commit-mailutils@gnu.org; Mon, 26 Oct 2015 02:41:21 -0400
Received: from vcs.savannah.gnu.org ([208.118.235.72]:38349)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqbT5-0000Zc-E8
	for commit-mailutils@gnu.org; Mon, 26 Oct 2015 02:41:19 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZqbT1-0004y0-D3
	for commit-mailutils@gnu.org; Mon, 26 Oct 2015 06:41:18 +0000
Date: Mon, 26 Oct 2015 06:41:16 +0000
Message-Id: <E1ZqbT1-0004y0-D3@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-736-g05abf25
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 9a908ba5a87216d24112e36f7f9c7ffbc6dd53a3
X-Git-Newrev: 05abf2570ef2d796a3178fab9298bf2b8868a972
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 26 Oct 2015 06:41:23 -0000

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 "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=05abf2570ef2d796a3178fab9298bf2b8868a972

The branch, master has been updated
       via  05abf2570ef2d796a3178fab9298bf2b8868a972 (commit)
      from  9a908ba5a87216d24112e36f7f9c7ffbc6dd53a3 (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 -----------------------------------------------------------------
commit 05abf2570ef2d796a3178fab9298bf2b8868a972
Author: Sergey Poznyakoff <gray@gnu.org>
Date:   Mon Oct 26 08:32:16 2015 +0200

    Vacation: improve compatibility with the Sendmail utility.
    
    * libmu_sieve/extensions/vacation.c (match_addresses): Change arguments:
    take primary email address as well as a list of aliases.
    (vacation_reply): Reply if the primary email or one of alias emails are
    listed in recipient list of the original message.  New tag "always_reply"
    reverts to the old behavior: reply regardless of whether the message is
    destined for us.
    Use the current user email as the sender address of the vacation message.
    New tag "return_address" sets the sender address explicitly.
    * sieve/tests/vacation.at: Add new tests.

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

Summary of changes:
 libmu_sieve/extensions/vacation.c |   46 ++++++++++++----
 sieve/tests/vacation.at           |  109 +++++++++++++++++++++++++++++++------
 2 files changed, 127 insertions(+), 28 deletions(-)

diff --git a/libmu_sieve/extensions/vacation.c b/libmu_sieve/extensions/vacation.c
index 067e772..2e112a8 100644
--- a/libmu_sieve/extensions/vacation.c
+++ b/libmu_sieve/extensions/vacation.c
@@ -26,6 +26,8 @@
 		    [:database <path: string>]
 		    [:file]
 		    [:mime]
+		    [:always_reply]
+		    [:return_address <email: string>]
 		    <reply: string>
 */
 
@@ -162,8 +164,8 @@ _compare (void *item, void *data)
    of the originating mail. Return non-zero if so and store a pointer
    to the matching address in *MY_ADDRESS. */
 static int
-match_addresses (mu_header_t hdr, mu_sieve_value_t *addresses,
-		 char **my_address)
+match_addresses (mu_header_t hdr, char *email, mu_sieve_value_t *addresses,
+		 char const **my_address)
 {
   int match = 0;
   const char *str;
@@ -174,7 +176,10 @@ match_addresses (mu_header_t hdr, mu_sieve_value_t *addresses,
     {
       if (!mu_address_create (&ad.addr, str))
 	{
-	  match += mu_sieve_vlist_do (addresses, _compare, &ad);
+	  if (_compare (email, &ad))
+	    match = 1;
+	  else if (addresses)
+	    match += mu_sieve_vlist_do (addresses, _compare, &ad);
 	  mu_address_destroy (&ad.addr);
 	}
     }
@@ -183,7 +188,10 @@ match_addresses (mu_header_t hdr, mu_sieve_value_t *addresses,
     {
       if (!mu_address_create (&ad.addr, str))
 	{
-	  match += mu_sieve_vlist_do (addresses, _compare, &ad);
+	  if (_compare (email, &ad))
+	    match = 1;
+	  else if (addresses)
+	    match += mu_sieve_vlist_do (addresses, _compare, &ad);
 	  mu_address_destroy (&ad.addr);
 	}
     }
@@ -528,7 +536,7 @@ vacation_subject (mu_sieve_machine_t mach, mu_list_t tags,
 /* Generate and send the reply message */
 static int
 vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
-		char *text, char *to, char *from)
+		char const *text, char const *to, char const *from)
 {
   mu_mime_t mime = NULL;
   mu_message_t newmsg;
@@ -629,10 +637,11 @@ sieve_action_vacation (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
 {
   int rc;
   char *text, *from;
+  char const *return_address;
   mu_sieve_value_t *val;
   mu_message_t msg;
   mu_header_t hdr;
-  char *my_address = mu_sieve_get_daemon_email (mach);
+  char *my_address;
   
   if (diag (mach))
     return 0;
@@ -669,20 +678,35 @@ sieve_action_vacation (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
       mu_sieve_abort (mach);
     }
 
-  if (mu_sieve_tag_lookup (tags, "aliases", &val)
-      && match_addresses (hdr, val, &my_address) == 0)
-    return 0;
+  my_address = mu_get_user_email (NULL);
+  if (mu_sieve_tag_lookup (tags, "always_reply", NULL))
+    return_address = my_address;
+  else
+    {
+      val = NULL;
+      mu_sieve_tag_lookup (tags, "aliases", &val);
+      if (match_addresses (hdr, my_address, val, &return_address) == 0)
+	{
+	  free (my_address);
+	  return 0;
+	}
+    }
 
   if (noreply_address_p (mach, tags, from)
       || bulk_precedence_p (hdr)
       || check_db (mach, tags, from))
     {
       free (from);
+      free (my_address);
       return 0;
     }
 
-  rc = vacation_reply (mach, tags, msg, text, from, my_address);
+  if (mu_sieve_tag_lookup (tags, "return_address", &val))
+    return_address = val->v.string;
+
+  rc = vacation_reply (mach, tags, msg, text, from, return_address);
   free (from);
+  free (my_address);
   if (rc == -1)
     mu_sieve_abort (mach);
   return rc;
@@ -700,6 +724,8 @@ static mu_sieve_tag_def_t vacation_tags[] = {
   {"database", SVT_STRING},
   {"mime", SVT_VOID},
   {"file", SVT_VOID},
+  {"always_reply", SVT_VOID},
+  {"return_address", SVT_STRING},
   {NULL}
 };
 
diff --git a/sieve/tests/vacation.at b/sieve/tests/vacation.at
index 525bd1b..e3f259c 100644
--- a/sieve/tests/vacation.at
+++ b/sieve/tests/vacation.at
@@ -29,7 +29,38 @@ export MTA_DIAG MTA_APPEND
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+[ENVELOPE FROM: foobar@nonexistent.net
+ENVELOPE TO: <bar@dontmailme.org>
+   0: References: <200112232808.fERKR9N16790@dontmailme.org>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2: 	<200112232808.fERKR9N16790@dontmailme.org>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: bar@dontmailme.org
+   5: Content-Transfer-Encoding: 8bit
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: I'm on vacation
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+MUT_SIEVE_EXT_TEST([aliases],[vac01],
+[require "vacation";
+
+vacation :database "vacation.db" :aliases [[ "roadrunner@acme.example.com" ]] "I'm on vacation";
+],
+[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: roadrunner@acme.example.com
 ENVELOPE TO: <coyote@desert.example.org>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -40,7 +71,49 @@ ENVELOPE TO: <coyote@desert.example.org>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
+ENVELOPE TO: <bar@dontmailme.org>
+   0: References: <200112232808.fERKR9N16790@dontmailme.org>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2: 	<200112232808.fERKR9N16790@dontmailme.org>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: bar@dontmailme.org
+   5: Content-Transfer-Encoding: 8bit
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: I'm on vacation
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
+MUT_SIEVE_EXT_TEST([always_reply],[vac02],
+[require "vacation";
+
+vacation :database "vacation.db" :always_reply "I'm on vacation";
+],
+[MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: foobar@nonexistent.net
+ENVELOPE TO: <coyote@desert.example.org>
+   0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
+   1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
+   2: To: coyote@desert.example.org
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation
+END OF MESSAGE
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <b1ff@de.res.example.com>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -51,7 +124,7 @@ ENVELOPE TO: <b1ff@de.res.example.com>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <bar@dontmailme.org>
    0: References: <200112232808.fERKR9N16790@dontmailme.org>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
@@ -70,10 +143,10 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
-MUT_SIEVE_EXT_TEST([database matching],[vac01],
+MUT_SIEVE_EXT_TEST([database matching],[vac03],
 [require "vacation";
 
-vacation :database "vacation.db" "I'm on vacation";
+vacation :database "vacation.db" :always_reply "I'm on vacation";
 ],
 [MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
 MTA_DIAG=`pwd`/mta.diag
@@ -83,7 +156,7 @@ sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+[ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <coyote@desert.example.org>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -94,7 +167,7 @@ ENVELOPE TO: <coyote@desert.example.org>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <b1ff@de.res.example.com>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -105,7 +178,7 @@ ENVELOPE TO: <b1ff@de.res.example.com>
    6:
    7: I'm on vacation
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <bar@dontmailme.org>
    0: References: <200112232808.fERKR9N16790@dontmailme.org>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
@@ -127,10 +200,10 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
-MUT_SIEVE_EXT_TEST([mime],[vac02],
+MUT_SIEVE_EXT_TEST([mime],[vac04],
 [require "vacation";
 
-vacation :database "vacation.db" :mime "I'm on vacation.";
+vacation :database "vacation.db" :always_reply :mime "I'm on vacation.";
 ],
 [MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
 MTA_DIAG=`pwd`/mta.diag
@@ -139,7 +212,7 @@ export MTA_DIAG MTA_APPEND
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+[ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <coyote@desert.example.org>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -150,7 +223,7 @@ ENVELOPE TO: <coyote@desert.example.org>
    6:
    7: SSdtIG9uIHZhY2F0aW9uLg==
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <b1ff@de.res.example.com>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -161,7 +234,7 @@ ENVELOPE TO: <b1ff@de.res.example.com>
    6:
    7: SSdtIG9uIHZhY2F0aW9uLg==
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <bar@dontmailme.org>
    0: References: <200112232808.fERKR9N16790@dontmailme.org>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
@@ -180,10 +253,10 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
-MUT_SIEVE_EXT_TEST([reply from file],[vac03],
+MUT_SIEVE_EXT_TEST([reply from file],[vac05],
 [require "vacation";
 
-vacation :database "vacation.db" :file "reply";
+vacation :database "vacation.db" :always_reply :file "reply";
 ],
 [AT_DATA([reply],[X-Mail-Processor: sieve
 
@@ -200,7 +273,7 @@ export MTA_DIAG MTA_APPEND
 sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
 cat ./mta.diag
 ],
-[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+[ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <coyote@desert.example.org>
    0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
    1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
@@ -213,7 +286,7 @@ ENVELOPE TO: <coyote@desert.example.org>
    8: Best regards,
    9: Ty Coon
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <b1ff@de.res.example.com>
    0: In-Reply-To: Your message of TBD
    1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
@@ -226,7 +299,7 @@ ENVELOPE TO: <b1ff@de.res.example.com>
    8: Best regards,
    9: Ty Coon
 END OF MESSAGE
-ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
+ENVELOPE FROM: foobar@nonexistent.net
 ENVELOPE TO: <bar@dontmailme.org>
    0: References: <200112232808.fERKR9N16790@dontmailme.org>
    1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Tue Oct 27 11:34:54 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Zr6H0-00007L-G8
	for mharc-commit-mailutils@gnu.org; Tue, 27 Oct 2015 11:34:54 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51626)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Zr6Gw-00006D-09
	for commit-mailutils@gnu.org; Tue, 27 Oct 2015 11:34:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Zr6Gs-0001G8-QE
	for commit-mailutils@gnu.org; Tue, 27 Oct 2015 11:34:49 -0400
Received: from vcs.savannah.gnu.org ([208.118.235.72]:33680)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Zr6Gs-0001G4-M7
	for commit-mailutils@gnu.org; Tue, 27 Oct 2015 11:34:46 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Zr6Gl-0007M7-4v
	for commit-mailutils@gnu.org; Tue, 27 Oct 2015 15:34:45 +0000
Date: Tue, 27 Oct 2015 15:34:39 +0000
Message-Id: <E1Zr6Gl-0007M7-4v@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-743-gcdb95d0
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 05abf2570ef2d796a3178fab9298bf2b8868a972
X-Git-Newrev: cdb95d01e4ead871b5d10543a32dd28ea5740a0d
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 27 Oct 2015 15:34:53 -0000

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 "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=cdb95d01e4ead871b5d10543a32dd28ea5740a0d

The branch, master has been updated
       via  cdb95d01e4ead871b5d10543a32dd28ea5740a0d (commit)
       via  42ca2c2ef8ed0987f302cc360359c5b2ce4427c8 (commit)
       via  6880edb2c6d4e2bc357eb084d363ff10bb3b15cf (commit)
       via  291db85eaf2426cd8fbb240171b4d9921be78cd9 (commit)
       via  9ae85910bc0e2d022e560dd08bcc71b956553c5d (commit)
       via  0bd9e1759058e0d7b1e3e4be205a65e1e1bedab2 (commit)
       via  0283eeaa5beea740eb9d9a3fe241000949ea2da4 (commit)
      from  05abf2570ef2d796a3178fab9298bf2b8868a972 (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 -----------------------------------------------------------------
commit cdb95d01e4ead871b5d10543a32dd28ea5740a0d
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Oct 27 17:29:36 2015 +0200

    vacation: read message body from the file
    
    * doc/texinfo/sieve.texi: Document recent changes to vacation.
    * libmu_sieve/extensions/vacation.c (vacation_reply): Handle
    the "rfc2822" tag: if set together with :file, treat the file
    as the RFC2822 message.  Otherwise, read message body from it.
    * sieve/tests/vacation.at: Add test for :rfc2822

commit 42ca2c2ef8ed0987f302cc360359c5b2ce4427c8
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Oct 27 16:13:58 2015 +0200

    User-defined headers in vacation extension
    
    New tag :header allows to set headers in the reply message
    generated by the vacation extension.

commit 6880edb2c6d4e2bc357eb084d363ff10bb3b15cf
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Oct 27 16:11:21 2015 +0200

    Minor fixes.
    
    * libproto/mailer/sendmail.c: Fix typo in debugging message.
    * po/.gitignore: Update.

commit 291db85eaf2426cd8fbb240171b4d9921be78cd9
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Oct 27 15:54:01 2015 +0200

    Maidag: avoid using auth_by_uid when delivering message.
    
    When delivering message, the library may need to know the email
    address of the user on behalf of whom maidag is called. In particular,
    that happens when using the vacation extension.  In that case the
    library would construct the email by concatenating user name, obtained
    as a result of mu_get_auth_by_uid, and current domain name.  Avoid
    this by remembering email address the message is being delivered to.
    
    * libmailutils/base/usremail.c (mu_set_user_email): NULL
    argument clears email.
    (mu_get_user_email): Use EUID instead of UID.
    * maidag/deliver.c (do_delivery): Set user email prior to
    delivery.
    * maidag/maidag.c (default_domain): New variable.
    (maidag_cfg_param): New setting "domain".
    * maidag/maidag.h (default_domain): New extern.

commit 9ae85910bc0e2d022e560dd08bcc71b956553c5d
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Oct 27 15:50:36 2015 +0200

    Improve debugging
    
    * libmailutils/diag/debug.c (mu_debug_log): Account for
    eventual newlines in the generated message string.
    * imap4d/io.c (imap4d_init_tls_server): Use mu_stream_strerror.

commit 0bd9e1759058e0d7b1e3e4be205a65e1e1bedab2
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Oct 27 15:43:59 2015 +0200

    Bugfix
    
    * libproto/mailer/prog.c (url_to_argv): Free ws only if
    it was initialized.

commit 0283eeaa5beea740eb9d9a3fe241000949ea2da4
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Tue Oct 27 14:52:07 2015 +0200

    Minor fixes in Makefiles.
    
    * include/mailutils/Makefile.am (errno.h): Use explicit file names
    instead of implicit variables.
    * include/mailutils/sys/Makefile.am (debcat.h): Likewise.
    * libmailutils/diag/Makefile.am (muerrno.c): Likewise.
    * libmu_argp/Makefile.am (libmu_argp_la_LIBADD): Use relative path
    to .la,

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

Summary of changes:
 doc/texinfo/sieve.texi            |   38 +++++++--
 imap4d/io.c                       |    2 +-
 include/mailutils/Makefile.am     |    2 +-
 include/mailutils/stream.h        |    2 +-
 include/mailutils/sys/Makefile.am |    2 +-
 libmailutils/base/usremail.c      |   30 ++++---
 libmailutils/diag/Makefile.am     |    2 +-
 libmailutils/diag/debug.c         |   24 +++++-
 libmu_argp/Makefile.am            |    4 +-
 libmu_sieve/extensions/vacation.c |  175 +++++++++++++++++++++++++++++++++---
 libproto/mailer/prog.c            |    3 +-
 libproto/mailer/sendmail.c        |    2 +-
 maidag/deliver.c                  |    8 ++
 maidag/maidag.c                   |    4 +-
 maidag/maidag.h                   |    3 +-
 po/.gitignore                     |    2 +
 sieve/tests/vacation.at           |   78 ++++++++++++++++-
 17 files changed, 331 insertions(+), 50 deletions(-)

diff --git a/doc/texinfo/sieve.texi b/doc/texinfo/sieve.texi
index 4297c83..5e77fec 100644
--- a/doc/texinfo/sieve.texi
+++ b/doc/texinfo/sieve.texi
@@ -1453,20 +1453,35 @@ pipe "/usr/sbin/maidag --url smtp://gray@@mail.gnu.org"
 @deftypefn Action {} vacation [:days @var{ndays}(number)] @
                           [:subject @var{subject}(string)] @
                           [:aliases @var{addrlist}(string-list)] @
-                          [:addresses @var{noreply-address}(string-list)] @
+                          [:noreply @var{noreply-address}(string-list)] @
                           [:reply_regex @var{expr}(string)] @
                           [:reply_prefix @var{prefix}(string)] @
-                          @var{reply-text}(string)
+ 		          [:sender @var{email}(string)] @
+		          [:database @var{path}(string)] @
+		          [:return_address @var{email}(string)] @
+                          [:header @var{headers}(string-list)] @
+		          [:mime] @
+		          [:always_reply] @
+                          [:rfc2822] @
+		          [:file] @
+                          @var{text}(string)
 @*Syntax:
 @smallexample
 require "vacation";
 vacation @var{args};
 @end smallexample
 @*Description:
-The @code{vacation} action returns a message with @var{reply-text} to
+The @code{vacation} action returns a message with @var{text} to
 the sender.  It is intended to inform the sender that the recipient is
 not currently reading his mail.
 
+If the @code{:file} tag is present, @var{text} is treated as the name
+of the file to read the body of the reply message from.  When used together
+with tag @code{:rfc2822}, the file should be formatted as a valid RFC
+2822 message, i.e. headers followed by empty line and body.  Headers
+must not contain @samp{To}, @samp{From}, and @samp{Subject}, as these
+will be generated automatically.
+
 If the @code{:subject} tag is given, its argument sets the subject of
 the message.  Otherwise, the subject is formed by prefixing original
 subject with @samp{Re:}, or @var{prefix}, given with the
@@ -1475,6 +1490,11 @@ matching extended regular expression @var{expr} (@code{:reply_regex}
 tag) are stripped from the subject line.  If @code{:reply_regex} is not
 specified, the default regexp is @samp{^re: *}. 
 
+Another headers can be added using the @code{:header} tag.  Its
+argument is a list of header strings, each one having the form
+@samp{"@var{name}:@var{value}"}.  Additional whitespace is allowed on
+both sides of the colon.
+
 The @code{:aliases} tag instructs @code{vacation} to handle messages
 for any address in @var{addrlist} in the same manner as those received
 for the user's principal email.
@@ -1496,13 +1516,17 @@ exclusion list is:
     ^MAILER-DAEMON@@.*
 @end smallexample
 
-New entries can be added to this list using @code{:addresses} tag.
+New entries can be added to this list using @code{:noreply} tag.
 
 The @code{:days} tag sets the @dfn{reply interval}.  A reply is sent to
 each sender once in @var{ndays} days.  GNU Sieve keeps track of
-sender addresses and dates in a DBM file @file{.vacation} stored in
-the user's home directory.  This tag is available only if Mailutils is
-compiled with DBM support.
+sender addresses and dates in file @file{.vacation} stored in
+the user's home directory.  The file name can be changed using the
+@code{:database} tag.
+
+The tag @code{:always_reply} instructs vacation to respond to the
+message regardless of whether the user email is listed as a recipient
+for the message.
 @end deftypefn
 
 @node GNU Extensions
diff --git a/imap4d/io.c b/imap4d/io.c
index d3a14dc..18b57eb 100644
--- a/imap4d/io.c
+++ b/imap4d/io.c
@@ -139,7 +139,7 @@ imap4d_init_tls_server ()
   if (rc)
     {
       mu_diag_output (MU_DIAG_ERROR, _("cannot open TLS stream: %s"),
-		      mu_stream_strerror (tlsstream, rc));
+		      mu_strerror (rc));
       return 1;
     }
 
diff --git a/include/mailutils/Makefile.am b/include/mailutils/Makefile.am
index 9b118c2..befcd94 100644
--- a/include/mailutils/Makefile.am
+++ b/include/mailutils/Makefile.am
@@ -18,7 +18,7 @@
 BUILT_SOURCES=errno.h types.h
 EXTRA_DIST=errno.hin types.hin
 errno.h: $(top_srcdir)/libmailutils/diag/errors errno.hin
-	$(AM_V_GEN)$(AWK) -f $(mu_aux_dir)/generr.awk $^ > $@
+	$(AM_V_GEN)$(AWK) -f $(mu_aux_dir)/generr.awk $(top_srcdir)/libmailutils/diag/errors errno.hin > errno.h
 
 types.h: $(top_srcdir)/include/mailutils/types.hin Makefile
 	$(AM_V_GEN)sed 's/_MU_OFF_TYPE_/$(MU_OFF_TYPE)/;s/_MU_DEFAULT_RECORD_/$(MU_DEFAULT_RECORD)/' $(top_srcdir)/include/mailutils/types.hin > $@
diff --git a/include/mailutils/stream.h b/include/mailutils/stream.h
index 07f99c3..12d6d7c 100644
--- a/include/mailutils/stream.h
+++ b/include/mailutils/stream.h
@@ -93,7 +93,7 @@ enum mu_buffer_type
      If pat==NULL, any reads from that stream will return EOF. */
 #define MU_IOCTL_NULLSTREAM_SET_PATTERN 0
   /* Set pattern class for reads:  Argument int *pclass (a class mask
-     from mailutils/cctype.h */
+     from mailutils/cctype.h) */
 #define MU_IOCTL_NULLSTREAM_SET_PATCLASS 1
   /* Limit stream size.  Argument: mu_off_t *psize; */
 #define MU_IOCTL_NULLSTREAM_SETSIZE 2
diff --git a/include/mailutils/sys/Makefile.am b/include/mailutils/sys/Makefile.am
index 7ada4d7..2118cd6 100644
--- a/include/mailutils/sys/Makefile.am
+++ b/include/mailutils/sys/Makefile.am
@@ -66,5 +66,5 @@ sysinclude_HEADERS = \
 BUILT_SOURCES = debcat.h
 
 debcat.h: $(top_srcdir)/libmailutils/diag/debcat
-	$(AM_V_GEN)$(AWK) -f $(mu_aux_dir)/debcat.awk $^ > $@
+	$(AM_V_GEN)$(AWK) -f $(mu_aux_dir)/debcat.awk $(top_srcdir)/libmailutils/diag/debcat > debcat.h
 
diff --git a/libmailutils/base/usremail.c b/libmailutils/base/usremail.c
index cd840be..837b06d 100644
--- a/libmailutils/base/usremail.c
+++ b/libmailutils/base/usremail.c
@@ -46,6 +46,13 @@ mu_set_user_email (const char *candidate)
   size_t emailno = 0;
   char *email = NULL;
   const char *domain = NULL;
+
+  if (!candidate)
+    {
+      free (mu_user_email);
+      mu_user_email = NULL;
+      return 0;
+    }
   
   if ((err = mu_address_create (&addr, candidate)) != 0)
     return err;
@@ -62,8 +69,7 @@ mu_set_user_email (const char *candidate)
   if ((err = mu_address_aget_email (addr, 1, &email)) != 0)
     goto cleanup;
 
-  if (mu_user_email)
-    free (mu_user_email);
+  free (mu_user_email);
 
   mu_user_email = email;
 
@@ -81,16 +87,18 @@ static char *mu_user_email_domain = 0;
 int
 mu_set_user_email_domain (const char *domain)
 {
-  char *d = NULL;
+  char *d;
   
-  if (!domain)
-    return EINVAL;
-  
-  d = strdup (domain);
-
-  if (!d)
-    return ENOMEM;
+  if (domain)
+    {
+      d = strdup (domain);
 
+      if (!d)
+	return ENOMEM;
+    }
+  else
+    d = NULL;
+  
   if (mu_user_email_domain)
     free (mu_user_email_domain);
 
@@ -154,7 +162,7 @@ mu_get_user_email (const char *name)
 
   if (!name)
     {
-      struct mu_auth_data *auth = mu_get_auth_by_uid (getuid ());
+      struct mu_auth_data *auth = mu_get_auth_by_uid (geteuid ());
       if (!auth)
 	{
 	  errno = EINVAL;
diff --git a/libmailutils/diag/Makefile.am b/libmailutils/diag/Makefile.am
index fea4654..bea831a 100644
--- a/libmailutils/diag/Makefile.am
+++ b/libmailutils/diag/Makefile.am
@@ -36,7 +36,7 @@ EXTRA_DIST = \
 BUILT_SOURCES = muerrno.c
 
 muerrno.c: errors muerrno.cin
-	$(AWK) -f $(mu_aux_dir)/generr.awk $^ > $@
+	$(AWK) -f $(mu_aux_dir)/generr.awk errors muerrno.cin > muerrno.c
 
 
 
diff --git a/libmailutils/diag/debug.c b/libmailutils/diag/debug.c
index 3ad00b2..e5def63 100644
--- a/libmailutils/diag/debug.c
+++ b/libmailutils/diag/debug.c
@@ -34,6 +34,7 @@
 #include <mailutils/stdstream.h>
 #include <mailutils/iterator.h>
 #include <mailutils/cstr.h>
+#include <mailutils/io.h>
 
 int mu_debug_line_info;          /* Debug messages include source locations */
 
@@ -675,13 +676,30 @@ void
 mu_debug_log (const char *fmt, ...)
 {
   va_list ap;
+  char *buf = NULL;
+  size_t buflen = 0;
+  size_t n;
+  int rc;
 
   mu_diag_init ();
   va_start (ap, fmt);
-  mu_stream_printf (mu_strerr, "\033s<%d>", MU_LOG_DEBUG);
-  mu_stream_vprintf (mu_strerr, fmt, ap);
-  mu_stream_write (mu_strerr, "\n", 1, NULL);
+  rc = mu_vasnprintf (&buf, &buflen, fmt, ap);
   va_end (ap);
+  if (rc == 0)
+    {
+      size_t i;
+      int nl = 0;
+      for (i = 0; buf[i]; i += n)
+	{
+	  n = strcspn (buf + i, "\n");
+	  if ((nl = buf[i + n]))
+	    ++n;
+	  mu_stream_printf (mu_strerr, "\033s<%d>", MU_LOG_DEBUG);
+	  mu_stream_write (mu_strerr, buf + i, n, NULL);
+	}
+      if (!nl)
+	mu_stream_write (mu_strerr, "\n", 1, NULL);
+    }
 }
 
 void
diff --git a/libmu_argp/Makefile.am b/libmu_argp/Makefile.am
index c337063..3e1a672 100644
--- a/libmu_argp/Makefile.am
+++ b/libmu_argp/Makefile.am
@@ -34,8 +34,6 @@ libmu_argp_la_SOURCES =\
  muinit.c\
  sieve.c
 
-libmu_argp_la_LIBADD=\
- -L${top_builddir}/lib\
- -lmuaux
+libmu_argp_la_LIBADD=../lib/libmuaux.la
 
 libmu_argp_la_LDFLAGS=-version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@
diff --git a/libmu_sieve/extensions/vacation.c b/libmu_sieve/extensions/vacation.c
index 2e112a8..cd95202 100644
--- a/libmu_sieve/extensions/vacation.c
+++ b/libmu_sieve/extensions/vacation.c
@@ -24,10 +24,12 @@
 		    [:reply_prefix <prefix: string>]
 		    [:sender <email: string>]
 		    [:database <path: string>]
+		    [:rfc2822]
 		    [:file]
 		    [:mime]
 		    [:always_reply]
 		    [:return_address <email: string>]
+		    [:header <header-list: list>]
 		    <reply: string>
 */
 
@@ -477,7 +479,7 @@ vacation_subject (mu_sieve_machine_t mach, mu_list_t tags,
   mu_header_t hdr;
   
   if (mu_sieve_tag_lookup (tags, "subject", &arg))
-    subject =  arg->v.string;
+    subject = arg->v.string;
   else if (mu_message_get_header (msg, &hdr) == 0
 	   && mu_header_aget_value_unfold (hdr, MU_HEADER_SUBJECT,
 					   &value) == 0)
@@ -533,6 +535,81 @@ vacation_subject (mu_sieve_machine_t mach, mu_list_t tags,
     free (subject);
 }
 
+static int
+header_split (const char *str, char **hname, char **hval)
+{
+  char *p, *q, *fn, *fv;
+  size_t n;
+  
+  q = strchr (str, ':');
+  if (!q)
+    return MU_ERR_FORMAT;
+
+  for (p = q; p > str && mu_isspace (p[-1]); --p)
+    ;
+  if (p == str)
+    return MU_ERR_FORMAT;
+  
+  n = p - str;
+  fn = malloc (n + 1);
+  if (!fn)
+    return ENOMEM;
+
+  memcpy (fn, str, n);
+  fn[n] = 0;
+
+  for (++q; *q && mu_isspace (*q); ++q)
+    ;
+
+  fv = strdup (q);
+  if (!fv)
+    {
+      free (fn);
+      return ENOMEM;
+    }
+
+  *hname = fn;
+  *hval = fv;
+
+  return 0;
+}
+
+struct header_closure
+{
+  mu_sieve_machine_t mach;  
+  mu_header_t hdr;
+};
+
+static int
+add_header (void *item, void *data)
+{
+  char const *str = item;
+  struct header_closure *hc = data;
+  char *fn, *fv;
+  int rc;
+
+  rc = header_split (str, &fn, &fv);
+  if (rc)
+    {
+      mu_sieve_error (hc->mach,
+		      _("%lu: can't add header \"%s\": %s"),
+		      (unsigned long) mu_sieve_get_message_num (hc->mach),
+		      str, mu_strerror (rc));
+      return 0;
+    }
+
+  rc = mu_header_append (hc->hdr, fn, fv);
+  free (fn);
+  free (fv);
+  
+  if (rc)
+    mu_sieve_error (hc->mach,
+		    _("%lu: can't add header \"%s\": %s"),
+		    (unsigned long) mu_sieve_get_message_num (hc->mach),
+		    str, mu_strerror (rc));
+  return 0;
+}
+
 /* Generate and send the reply message */
 static int
 vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
@@ -545,6 +622,7 @@ vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
   char *value;
   mu_mailer_t mailer;
   int rc;
+  mu_sieve_value_t *val;
 
   if (mu_sieve_tag_lookup (tags, "file", NULL))
     {
@@ -560,17 +638,72 @@ vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
 			  mu_strerror (rc));
 	  return -1;
 	}
-      rc = mu_stream_to_message (instr, &newmsg);
-      mu_stream_unref (instr);
-      if (rc)
+      
+      if (mu_sieve_tag_lookup (tags, "rfc2822", NULL))
 	{
-	  mu_sieve_error (mach,
-			  _("%lu: cannot read message from file %s: %s"),
-			  (unsigned long) mu_sieve_get_message_num (mach),
-			  text,
-			  mu_strerror (rc));
-	  return -1;
-	} 
+	  rc = mu_stream_to_message (instr, &newmsg);
+	  mu_stream_unref (instr);
+	  if (rc)
+	    {
+	      mu_sieve_error (mach,
+			      _("%lu: cannot read message from file %s: %s"),
+			      (unsigned long) mu_sieve_get_message_num (mach),
+			      text,
+			      mu_strerror (rc));
+	      return -1;
+	    }
+	}
+      else
+	{
+	  mu_stream_t text_stream;
+	  mu_transport_t trans[2];
+
+	  rc = mu_memory_stream_create (&text_stream, MU_STREAM_RDWR);
+	  if (rc)
+	    {
+	      mu_stream_unref (instr);
+	      mu_sieve_error (mach,
+			      _("%lu: cannot create memory stream: %s"),
+			      (unsigned long) mu_sieve_get_message_num (mach),
+			      mu_strerror (rc));
+	      return -1;
+	    }
+
+	  rc = mu_stream_copy (text_stream, instr, 0, NULL);
+	  mu_stream_unref (instr);
+	  if (rc == 0)
+	    rc = mu_stream_write (text_stream, "", 1, NULL);
+	  if (rc)
+	    {
+	      mu_sieve_error (mach,
+			      _("%lu: failed reading from %s: %s"),
+			      (unsigned long) mu_sieve_get_message_num (mach),
+			      text,
+			      mu_strerror (rc));
+	      return -1;
+	    }
+
+	  rc = mu_stream_ioctl (text_stream, MU_IOCTL_TRANSPORT,
+				MU_IOCTL_OP_GET, trans);
+	  if (rc)
+	    {
+	      mu_stream_unref (text_stream);
+	      mu_sieve_error (mach,
+			      "%lu: mu_stream_ioctl: %s",
+			      (unsigned long) mu_sieve_get_message_num (mach),
+			      mu_strerror (rc));
+	      return -1;
+	    }
+
+	  if (build_mime (mach, tags, &mime, msg, (char const *) trans[0]))
+	    {
+	      mu_stream_unref (text_stream);
+	      return -1;
+	    }
+	  mu_mime_get_message (mime, &newmsg);
+	  mu_message_unref (newmsg);
+	  mu_stream_unref (text_stream);
+	}
     }
   else
     {
@@ -593,6 +726,14 @@ vacation_reply (mu_sieve_machine_t mach, mu_list_t tags, mu_message_t msg,
   else
     {
       mu_header_set_value (newhdr, MU_HEADER_TO, to, 0);
+
+      if (mu_sieve_tag_lookup (tags, "header", &val))
+	{
+	  struct header_closure hc;
+	  hc.mach = mach;
+	  hc.hdr = newhdr;
+	  mu_sieve_vlist_do (val, add_header, &hc);
+	}
       
       vacation_subject (mach, tags, msg, newhdr);
       
@@ -636,7 +777,7 @@ int
 sieve_action_vacation (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
 {
   int rc;
-  char *text, *from;
+  char *text, *from = NULL;
   char const *return_address;
   mu_sieve_value_t *val;
   mu_message_t msg;
@@ -670,15 +811,17 @@ sieve_action_vacation (mu_sieve_machine_t mach, mu_list_t args, mu_list_t tags)
           mu_sieve_abort (mach);
         }
     }
-  else if (mu_sieve_get_message_sender (msg, &from))
+  else if ((rc = mu_sieve_get_message_sender (msg, &from)) != 0)
     {
       mu_sieve_error (mach,
-		      _("%lu: cannot get sender address"),
-		      (unsigned long) mu_sieve_get_message_num (mach));
+		      _("%lu: cannot get sender address: %s"),
+		      (unsigned long) mu_sieve_get_message_num (mach),
+		      mu_strerror (rc));
       mu_sieve_abort (mach);
     }
 
   my_address = mu_get_user_email (NULL);
+
   if (mu_sieve_tag_lookup (tags, "always_reply", NULL))
     return_address = my_address;
   else
@@ -726,6 +869,8 @@ static mu_sieve_tag_def_t vacation_tags[] = {
   {"file", SVT_VOID},
   {"always_reply", SVT_VOID},
   {"return_address", SVT_STRING},
+  {"header", SVT_STRING_LIST},
+  {"rfc2822", SVT_VOID},
   {NULL}
 };
 
diff --git a/libproto/mailer/prog.c b/libproto/mailer/prog.c
index 4ad0601..e701661 100644
--- a/libproto/mailer/prog.c
+++ b/libproto/mailer/prog.c
@@ -349,7 +349,8 @@ url_to_argv (mu_url_t url, mu_message_t msg,
       wsflags |= MU_WRDSF_REUSE;
     }
   argv[i+1] = NULL;
-  mu_wordsplit_free (&ws);
+  if (wsflags & MU_WRDSF_REUSE)
+    mu_wordsplit_free (&ws);
   
   *pargc = argc;
   *pargv = argv;
diff --git a/libproto/mailer/sendmail.c b/libproto/mailer/sendmail.c
index 3130d05..33d96be 100644
--- a/libproto/mailer/sendmail.c
+++ b/libproto/mailer/sendmail.c
@@ -110,7 +110,7 @@ sendmail_open (mu_mailer_t mailer, int flags)
   if (access (path, X_OK) == -1)
     return errno;
   status = mu_progmailer_set_command (pm, path);
-  mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_TRACE, ("sendmail (%sn", path));
+  mu_debug (MU_DEBCAT_MAILER, MU_DEBUG_TRACE, ("sendmail binary: %s", path));
   return status;
 }
 
diff --git a/maidag/deliver.c b/maidag/deliver.c
index 113257e..ed936a3 100644
--- a/maidag/deliver.c
+++ b/maidag/deliver.c
@@ -271,6 +271,8 @@ do_delivery (mu_url_t url, mu_message_t msg, const char *name, char **errp)
   mu_mailbox_t mbox;
   int status;
 
+  mu_set_user_email_domain (default_domain);
+  
   if (name && !is_remote_url (url))
     {
       auth = mu_get_auth_by_name (name);
@@ -283,6 +285,10 @@ do_delivery (mu_url_t url, mu_message_t msg, const char *name, char **errp)
 	  return EX_NOUSER;
 	}
 
+      status = mu_set_user_email (name);
+      if (status)
+	mu_error (_("%s: invalid email: %s"), name, mu_strerror (status));
+      
       if (current_uid)
 	auth->change_uid = 0;
 
@@ -314,6 +320,8 @@ do_delivery (mu_url_t url, mu_message_t msg, const char *name, char **errp)
 	    return exit_code = EX_TEMPFAIL;
 	  }
     }
+  else
+    mu_set_user_email (NULL);
   
   if (!url)
     {
diff --git a/maidag/maidag.c b/maidag/maidag.c
index 32869e3..928553f 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -29,7 +29,7 @@ char *quotadbname = NULL;  /* Name of mailbox quota database */
 char *quota_query = NULL;  /* SQL query to retrieve mailbox quota */
 
 char *sender_address = NULL;       
-
+char *default_domain;
 mu_script_t script_handler;
 
 mu_list_t script_list;
@@ -450,6 +450,8 @@ struct mu_cfg_param maidag_cfg_param[] = {
   { "forward-file-checks", mu_cfg_callback, NULL, 0, cb_forward_file_checks,
     N_("Configure safety checks for the forward file."),
     N_("arg: list") },
+  { "domain", mu_cfg_string, &default_domain, 0, NULL,
+    N_("Default email domain") },
 /* LMTP support */
   { "group", mu_cfg_callback, &lmtp_groups, 0, cb_group,
     N_("In LMTP mode, retain these supplementary groups."),
diff --git a/maidag/maidag.h b/maidag/maidag.h
index ed9717e..6ae7d12 100644
--- a/maidag/maidag.h
+++ b/maidag/maidag.h
@@ -127,7 +127,8 @@ extern char *quota_query;
 extern char *forward_file;
 extern int forward_file_checks;
 
-extern char *sender_address;       
+extern char *sender_address;
+extern char *default_domain;
 extern mu_list_t script_list;
 extern char *message_id_header;
 extern int sieve_debug_flags; 
diff --git a/po/.gitignore b/po/.gitignore
index cd3a432..67d6c11 100644
--- a/po/.gitignore
+++ b/po/.gitignore
@@ -1,3 +1,5 @@
+/Makevars.template~
+/Makefile.in.in~
 *.gmo
 *.mo
 *.po
diff --git a/sieve/tests/vacation.at b/sieve/tests/vacation.at
index e3f259c..13710e5 100644
--- a/sieve/tests/vacation.at
+++ b/sieve/tests/vacation.at
@@ -253,10 +253,10 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
-MUT_SIEVE_EXT_TEST([reply from file],[vac05],
+MUT_SIEVE_EXT_TEST([reply from RFC2822 file],[vac05],
 [require "vacation";
 
-vacation :database "vacation.db" :always_reply :file "reply";
+vacation :database "vacation.db" :always_reply :rfc2822 :file "reply";
 ],
 [AT_DATA([reply],[X-Mail-Processor: sieve
 
@@ -320,5 +320,79 @@ VACATION on msg uid 2
 VACATION on msg uid 3
 ])
 
+MUT_SIEVE_EXT_TEST([reply body from file],[vac06],
+[require "vacation";
+
+vacation :database "vacation.db" :always_reply :file "reply";
+],
+[AT_DATA([reply],[I'm on vacation right now.
+I will attend to your message as soon as I'm back.
+
+Best regards,
+Ty Coon
+])
+MUT_MBCOPY($abs_top_srcdir/testsuite/spool/sieve.mbox,mailbox)
+MTA_DIAG=`pwd`/mta.diag
+MTA_APPEND=1
+export MTA_DIAG MTA_APPEND
+sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./mailbox prog || exit 1
+cat ./mta.diag
+],
+[ENVELOPE FROM: foobar@nonexistent.net
+ENVELOPE TO: <coyote@desert.example.org>
+   0: In-Reply-To: Your message of Sun May  6 22:16:47 2001
+   1: Subject: =?UTF-8?Q?Re:_I_have_a_present_for_you?=
+   2: To: coyote@desert.example.org
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation right now.
+   8: I will attend to your message as soon as I'm back.
+   9:
+  10: Best regards,
+  11: Ty Coon
+  12:
+END OF MESSAGE
+ENVELOPE FROM: foobar@nonexistent.net
+ENVELOPE TO: <b1ff@de.res.example.com>
+   0: In-Reply-To: Your message of TBD
+   1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
+   2: To: b1ff@de.res.example.com
+   3: Content-Transfer-Encoding: 8bit
+   4: Content-Type: text/plain;charset=UTF-8
+   5: MIME-Version: 1.0
+   6:
+   7: I'm on vacation right now.
+   8: I will attend to your message as soon as I'm back.
+   9:
+  10: Best regards,
+  11: Ty Coon
+  12:
+END OF MESSAGE
+ENVELOPE FROM: foobar@nonexistent.net
+ENVELOPE TO: <bar@dontmailme.org>
+   0: References: <200112232808.fERKR9N16790@dontmailme.org>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2: 	<200112232808.fERKR9N16790@dontmailme.org>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: bar@dontmailme.org
+   5: Content-Transfer-Encoding: 8bit
+   6: Content-Type: text/plain;charset=UTF-8
+   7: MIME-Version: 1.0
+   8:
+   9: I'm on vacation right now.
+  10: I will attend to your message as soon as I'm back.
+  11:
+  12: Best regards,
+  13: Ty Coon
+  14:
+END OF MESSAGE
+],
+[VACATION on msg uid 1
+VACATION on msg uid 2
+VACATION on msg uid 3
+])
+
 m4_popdef([MUT_SIEVE_EXT_NAME])
 


hooks/post-receive
-- 
GNU Mailutils


From MAILER-DAEMON Wed Oct 28 06:28:53 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZrNyP-0000Qv-Mo
	for mharc-commit-mailutils@gnu.org; Wed, 28 Oct 2015 06:28:53 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:58584)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZrNyM-0000L7-5J
	for commit-mailutils@gnu.org; Wed, 28 Oct 2015 06:28:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZrNyK-0004f2-Cy
	for commit-mailutils@gnu.org; Wed, 28 Oct 2015 06:28:50 -0400
Received: from vcs.savannah.gnu.org ([208.118.235.72]:47351)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZrNyK-0004er-3t
	for commit-mailutils@gnu.org; Wed, 28 Oct 2015 06:28:48 -0400
Received: from gray by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1ZrNyJ-0003Cc-AV
	for commit-mailutils@gnu.org; Wed, 28 Oct 2015 10:28:47 +0000
Date: Wed, 28 Oct 2015 10:28:47 +0000
Message-Id: <E1ZrNyJ-0003Cc-AV@vcs.savannah.gnu.org>
From: "Sergey Poznyakoff" <gray@gnu.org.ua>
To: commit-mailutils@gnu.org
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-744-g31e90a8
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: cdb95d01e4ead871b5d10543a32dd28ea5740a0d
X-Git-Newrev: 31e90a814915648fe37d1e579cfec4e407290396
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: commit-mailutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: Commit notices for GNU mailutils <commit-mailutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-mailutils>
List-Post: <mailto:commit-mailutils@gnu.org>
List-Help: <mailto:commit-mailutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-mailutils>,
	<mailto:commit-mailutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Oct 2015 10:28:52 -0000

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 "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=31e90a814915648fe37d1e579cfec4e407290396

The branch, master has been updated
       via  31e90a814915648fe37d1e579cfec4e407290396 (commit)
      from  cdb95d01e4ead871b5d10543a32dd28ea5740a0d (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 -----------------------------------------------------------------
commit 31e90a814915648fe37d1e579cfec4e407290396
Author: Sergey Poznyakoff <gray@gnu.org.ua>
Date:   Wed Oct 28 12:26:21 2015 +0200

    Document Sieve extensions

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

Summary of changes:
 doc/texinfo/sieve.texi        |   75 +++++++++++++++++++++++++++++-----------
 libmu_sieve/extensions/pipe.c |   31 +++++++++++++++--
 2 files changed, 82 insertions(+), 24 deletions(-)

diff --git a/doc/texinfo/sieve.texi b/doc/texinfo/sieve.texi
index 5e77fec..b5391b1 100644
--- a/doc/texinfo/sieve.texi
+++ b/doc/texinfo/sieve.texi
@@ -968,6 +968,35 @@ less than @var{count}, the test is true; otherwise, it is false.
 If the tagged argument is not given, @samp{:over} is assumed. 
 @end deftypefn
 
+@deftypefn Test {} pipe [:envelope] [:header] [:body] @
+                        [:exit @var{code}(number)] @
+  	                [:signal @var{code}(number)] @
+                        @var{command}(string)
+@*Synopsis:
+@smallexample
+require "test-pipe";
+
+if pipe @var{command}
+  @{
+    @dots{}
+  @}
+@end smallexample
+@*Description: 
+The @code{pipe} test executes a shell command specified by its
+argument and pipes the entire message (including envelope) to its
+standard input.  When given, tags @code{:envelope}, @code{:header},
+and @code{:body} control what parts of the message to pipe to the command.
+
+In the absence of the @code{:exit} tag, the test returns true if
+the command exits with code 0.  If @code{:exit} is given, the test returns
+true if the command exits with code equal to its argument.
+
+The @code{:signal} tag determines the result of the test in case if the program
+exits on signal.  By default, the test returns false.  If @code{:signal}
+is given and the number of signal which caused the program to terminate
+matches its argument, the test returns true.
+@end deftypefn
+
 @deftypefn Test {} spamd [:host @var{tcp-host}(string)] @
                          [:port @var{tcp-port}(number)] @
                          [:socket @var{unix-socket}(string)] @
@@ -1046,7 +1075,7 @@ if list @var{args}
   @}
 @end smallexample  
 @*Description:  
-The @code{list} test evaluates to true if any of @var{headers} match any
+The @code{list} test evaluates to true if any of @var{headers} matches any
 key from @var{keys}.  Each header is regarded as containing a list of
 keywords.  By default, comma is assumed as list separator.  This can be
 overridden by specifying the @code{:delim} tag, whose value is a
@@ -1362,13 +1391,13 @@ the old message in a new one.
 
 @node External Actions
 @subsection External Actions
-@UNREVISED
   GNU Mailutils is shipped with a set of external Sieve
 actions.  These actions are compiled as loadable modules and must be
 required prior to use (@pxref{Require Statement}).
 
 @deftypefn Action {}  moderator [:keep] [:address @var{address}(string)] @
-                                [:source @var{sieve-file}(string)]
+                                [:source @var{sieve-file}(string)] @
+                                [:program @var{sieve-text}(string)]
 @*Synopsis:
 @smallexample
 require "moderator"
@@ -1401,9 +1430,16 @@ control message, thereby causing the submission to be discarded.  The
 @code{:address} tag.  After discarding the message, @code{moderator}
 marks it as deleted, unless it is given @code{:keep} tag. 
 
-The argument of @code{:source} tag, if given, specifies the Sieve
-source file to be used on the message.  If @code{:tag} is not present,
-@code{moderator} will create and use a copy of the existing Sieve machine.
+If the @code{:source} tag is given, its argument specifies a Sieve
+source file to be used on the message.  Otherwise, if @code{:program}
+is given, its argument supplies a Sieve program to be used on this
+message.  At most one of these tags may be specified.  Supplying them
+both, or supplying several instances of the same tag, is an error. The
+behavior of the action in this case is undefined.
+   
+If neither @code{:program} nor @code{:source} is given,
+@code{moderator} will create a copy of the existing Sieve machine and
+use it on the message.
 
 The action checks the message structure: it will bail out if the message
 does not have exactly 3 MIME parts, or if parts 2 and 3 are not of
@@ -1421,22 +1457,19 @@ if allof(header :is "Sender" "mailman-bounces@@gnu.org",
 @end smallexample
 @end deftypefn
 
-@deftypefn Action {} pipe [:envelope] @var{command}(string)
+@deftypefn Action {} pipe [:envelope] [:header] [:body] @var{command}(string)
 @*Synopsis:
 @smallexample
 require "pipe";
-if pipe @var{args}
-  @{
-     @dots{}
-  @}
+
+pipe @var{command}
 @end smallexample
 @*Description:
-The @code{pipe} action sends executes a command specified by its
-argument and sends the entire message to its standard input.  The
-@var{command} argument supplies the command line.
-
-The envelope of the message is included, if the @code{:envelope} tag
-is given. 
+The @code{pipe} action executes a shell command specified by its
+argument and pipes the entire message (including envelope) to its
+standard input.  When given, tags @code{:envelope}, @code{:header},
+and @code{:body} control what parts of the message to pipe to the
+command.
 
 @*Example:
 The example below uses the @command{maidag} utility
@@ -1479,12 +1512,12 @@ If the @code{:file} tag is present, @var{text} is treated as the name
 of the file to read the body of the reply message from.  When used together
 with tag @code{:rfc2822}, the file should be formatted as a valid RFC
 2822 message, i.e. headers followed by empty line and body.  Headers
-must not contain @samp{To}, @samp{From}, and @samp{Subject}, as these
+may not contain @samp{To}, @samp{From}, and @samp{Subject}, as these
 will be generated automatically.
 
 If the @code{:subject} tag is given, its argument sets the subject of
 the message.  Otherwise, the subject is formed by prefixing original
-subject with @samp{Re:}, or @var{prefix}, given with the
+subject with @samp{Re:}, or the @var{prefix} given with the
 @code{:reply_prefix} tag.  Before prefixing, any original prefixes
 matching extended regular expression @var{expr} (@code{:reply_regex}
 tag) are stripped from the subject line.  If @code{:reply_regex} is not
@@ -1586,11 +1619,11 @@ may disappear from the subsequent releases.
 @item @code{fileinto} action
 
 The @code{fileinto} action allows to specify permissions on the mailbox,
-in case it is created (@pxref{fileinto}).
+in case it will be created (@pxref{fileinto}).
 
 @item Match type optional argument.
 
-Along with the usual @code{:is}, @code{:matches} and @code{contains}
+Along with the usual @code{:is}, @code{:matches} and @code{:contains}
 matching type, GNU sieve library understands @code{:regex} type.  This
 matching type toggles POSIX Extended Regular Expression matching.
 @end enumerate
diff --git a/libmu_sieve/extensions/pipe.c b/libmu_sieve/extensions/pipe.c
index e474c2c..a5c4cc8 100644
--- a/libmu_sieve/extensions/pipe.c
+++ b/libmu_sieve/extensions/pipe.c
@@ -16,12 +16,37 @@
    Public License along with this library.  If not, see
    <http://www.gnu.org/licenses/>. */
 
-/* Syntax: pipe [:envelope] <program: string>
+/* The "pipe" action
+   
+   Syntax: pipe [:envelope] [:header] [:body]
+                <command: string>
 
    The pipe action executes a shell command specified by its
-   argument and pipes the entire message to its standard input.
-   The envelope of the message is included, if the :envelope tag is given.
-
+   argument and pipes the entire message (including envelope) to its
+   standard input.  When given, tags :envelope, :header, and :body
+   control what parts of the message to pipe to the command.
+   
+   The "pipe" test
+   
+   Syntax: pipe [:envelope] [:header] [:body]
+                [:exit <code: number>]
+  	        [:signal <code: number>]
+                <command: string>
+
+   The pipe test executes a shell command specified by its
+   argument and pipes the entire message (including envelope) to its
+   standard input.  When given, tags :envelope, :header, and :body
+   control what parts of the message to pipe to the command.
+
+   In the absence of :exit and :signal tags, the test returns true if
+   the command exits with code 0.  If :exit is given, the test returns
+   true if the command exits with code equal to its argument.
+
+   The :signal tag determines the result in case if the program
+   exits on signal.  By default, the test returns false.  If :signal
+   is given and the number of signal which caused the program to terminate
+   matches its argument, the test returns true.
+		
    Notes/FIXME: 1. it would be nice to implement meta-variables in
 		<program call> which would expand to various
 		items from the message being handled.


hooks/post-receive
-- 
GNU Mailutils


