Lawrence Greenfield wrote:
> 
> --On Wednesday, November 15, 2000 08:21:43 AM +0100 Frank Richter
> <[EMAIL PROTECTED]> wrote:
> 
> >>>    a user has a sieve file containing:
> >>>      redirect "[EMAIL PROTECTED]";
> >>>      keep;
> >>>    It works fine, but when this user's mailbox is over quota ...:
> >>>    Whenever sendmail runs its queue, a mail is sent to
> >>>    "[EMAIL PROTECTED]", but as the local delivery failes, the mail
> >>>    remains in sendmail's queue.
> >
> >> What behavior do you expect?  Desire?
> >
> > Hmm, perform the redirect action only once, and try to do the keep action.
> > I assume this is hard to implement...
> >
> 
> I've thought about this more and decided that it isn't that hard.
> Basically, upon a successful "redirect", add an entry into the duplicate
> delivery database indicating that message X was redirected to location Y,
> and so all subsequent attempts should succeed without actually redirecting.

Here's a patch which does exactly what Larry states above.  I just
checked it into both the 1.6 and 2.0 sources trees, so any new releases
will contain this fix.

Ken

*** deliver.c   2000/11/11 04:53:52     1.123.2.13
--- deliver.c   2000/12/19 19:23:57
***************
*** 1040,1048 ****
--- 1040,1063 ----
      sieve_redirect_context_t *rc = (sieve_redirect_context_t *) ac;
      script_data_t *sd = (script_data_t *) sc;
      message_data_t *m = (message_data_t *) mc;
+     char buf[8192], *sievedb = NULL;
      int res;
  
+     /* if we have a msgid, we can track our redirects */
+     if (m->id) {
+       snprintf(buf, sizeof(buf), "%s-%s", m->id, rc->addr);
+       sievedb = make_sieve_db(sd->username);
+ 
+       /* ok, let's see if we've redirected this message before */
+       if (duplicate_check(buf, strlen(buf), sievedb, strlen(sievedb)))
+           return SIEVE_OK;
+     }
+ 
      if ((res = send_forward(rc->addr, m->return_path, m->data)) == 0)
{
+       /* mark this message as redirected */
+       if (sievedb) duplicate_mark(buf, strlen(buf), 
+                                   sievedb, strlen(sievedb),
time(NULL));
+ 
        return SIEVE_OK;
      } else {
        if (res == -1)


-- 
Kenneth Murchison     Oceana Matrix Ltd.
Software Engineer     21 Princeton Place
716-662-8973 x26      Orchard Park, NY 14127
--PGP Public Key--    http://www.oceana.com/~ken/ksm.pgp

Reply via email to