I'm running a CVS version of cyrus-imapd-2.0.16.  When I set up a
sieve script to do a vacation auto-response, and don't specify any
additional addresses in the script, the auto-response never works.
The only way I could get it to work was to CC my test message to
mills@unspecified-domain.  This happens because the sieve vacation
handler in lmtpd compares the header recipient addresses to the
envelope recipient address to determine if the incoming message is
personally addressed.  In my case, sendmail strips the domain portion
of the envelope recipient, but masquerades the header recipients with
the mail server's canonical name.  lmtpd qualifies the envelope recipient
with @unspecified-domain.  Consequently, the comparison never succeeds.

My solution is a patch to imap/lmtpengine.c so that it qualifies the
envelope recipient in the same way that sendmail qualifies header
recipients.  It also fixes an apparent bug in the handling of route
addresses.  The domain used to qualify the envelope recipient is taken
from the `servername' configuration parameter, which defaults to the
hostname of the server.  Here's the patch:

================================================================
*** lmtpengine.Oc       Fri Jul  6 20:40:25 2001
--- lmtpengine.c        Sun Nov  4 20:18:10 2001
***************
*** 898,930 ****
  {
      char *dest;
      char *user;
!     int r, sl;
      address_data_t *ret = (address_data_t *) xmalloc(sizeof(address_data_t));
  
      assert(addr != NULL && ad != NULL);
  
      if (*addr == '<') addr++;
-     dest = user = addr;
      
-     /* preserve the entire address */
-     ret->all = xstrdup(addr);
-     sl = strlen(ret->all);
-     if (ret->all[sl-1] == '>')
-       ret->all[sl-1] = '\0';
- 
-     /* now find just the user */
-     
      /* Skip at-domain-list */
      if (*addr == '@') {
        addr = strchr(addr, ':');
        if (!addr) {
-           free(ret->all);
            free(ret);
            return "501 5.5.4 Syntax error in parameters";
        }
        addr++;
      }
      
      if (*addr == '\"') {
        addr++;
        while (*addr && *addr != '\"') {
--- 898,923 ----
  {
      char *dest;
      char *user;
!     int r;
      address_data_t *ret = (address_data_t *) xmalloc(sizeof(address_data_t));
  
      assert(addr != NULL && ad != NULL);
  
      if (*addr == '<') addr++;
      
      /* Skip at-domain-list */
      if (*addr == '@') {
        addr = strchr(addr, ':');
        if (!addr) {
            free(ret);
            return "501 5.5.4 Syntax error in parameters";
        }
        addr++;
      }
+     dest = user = addr;
      
+     /* now find just the user */
+     
      if (*addr == '\"') {
        addr++;
        while (*addr && *addr != '\"') {
***************
*** 943,954 ****
      r = verify_user(user);
      if (r) {
        /* we lost */
-       free(ret->all);
        free(ret);
        return convert_lmtp(r);
      }
      ret->user = xstrdup(user);
  
      *ad = ret;
  
      return NULL;
--- 936,950 ----
      r = verify_user(user);
      if (r) {
        /* we lost */
        free(ret);
        return convert_lmtp(r);
      }
      ret->user = xstrdup(user);
  
+     /* construct the masqueraded address */
+     ret->all = xmalloc(strlen(user) + strlen(config_servername) + 2);
+     sprintf(ret->all, "%s@%s", user, config_servername);
+ 
      *ad = ret;
  
      return NULL;
================================================================


-- 
-Gary Mills-    -Unix Support-    -U of M Academic Computing and Networking-

Reply via email to