commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. release-2.2-743-gcdb95d0


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-743-gcdb95d0
Date: Tue, 27 Oct 2015 15:34:39 +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 <address@hidden>
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 <address@hidden>
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 <address@hidden>
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 <address@hidden>
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 <address@hidden>
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 <address@hidden>
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 <address@hidden>
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
address@hidden"@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
address@hidden: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: address@hidden
+ENVELOPE TO: <address@hidden>
+   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: address@hidden
+   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: address@hidden
+ENVELOPE TO: <address@hidden>
+   0: In-Reply-To: Your message of TBD
+   1: Subject: =?UTF-8?Q?Re:_$$$_YOU,_TOO,_CAN_BE_A_MILLIONAIRE!_$$$?=
+   2: To: address@hidden
+   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: address@hidden
+ENVELOPE TO: <address@hidden>
+   0: References: <address@hidden>
+   1: In-Reply-To: Your message of Fri, 28 Dec 2001 23:28:08 +0200
+   2:  <address@hidden>
+   3: Subject: =?UTF-8?Q?Re:_Coffee?=
+   4: To: address@hidden
+   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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]