On Thu, Dec 13, 2001 at 09:03:45PM -0500, Ken Murchison wrote:
> 
> Gary Mills wrote:
> > 
> > On Thu, Dec 13, 2001 at 11:21:14AM -0500, Ken Murchison wrote:
> > >
> > > How would we determine that they are redirecting to themselves?  You'd
> > > end up getting into the 'vacation' problem of knowing all of the user's
> > > addresses and aliases.
> > 
> > Well, if the redirect address is the same as the envelope recipient,
> > sieve could take a shortcut and just perform a `keep' operation.
> > I realize that this would not prevent all mail loops, but it covers
> > the most common case.  Sendmail with .forward files handles this
> > case correctly.
> 
> Hmm...  Well, this won't as-is for the same reason that people need to
> specify :addresses for vacation.  The envelope recipient when retrieved
> by sieve is unqualified (ie, no domain) and the redirect address is (as
> is required by the Sieve parser).

I posted a patch recently that re-qualifies the envelope recipient
with the same domain as used by the MTA.  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.  The patch
is for imap/lmtpengine.c.  I'll attach a copy.

> The vacation draft says that implementations SHOULD know what a users
> actual email address is, but cmu-sieve doesn't have any way of
> determining this.  Perhaps we should provide a hook for external address
> lookups based on the envelope recipient.  The default behavior could be
> to simply append the domain.

> I agree that it should not be so easy for a user to lose mail, but I'm
> not sure what the best way to avoid this is.  Obviously, redirecting a
> message to oneself is silly when it can just be kept.  Also there is
> only so much we can to do to protect users from themselves .

Yes, I agree.

-- 
-Gary Mills-    -Unix Support-    -U of M Academic Computing and Networking-
*** 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;

Reply via email to