Two other people reported the same issue.  I suspect that the problem
is the unguarded fs_give().

Try the attached more detailed patch, which is what I actually did as
opposed to what I typed in off-hand into Hotmail.  It replaces the
existing IDLE code in imapd.c; delete the old code and drop the new
code in.  Make sure that you get the correct places to delete/insert.

I would like definite confirmation that it works.

-- Mark --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.

_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
                                /* idle mode */
        else if (!strcmp (cmd,"IDLE")) {
                                /* no arguments */
          if (arg) response = badarg;
          else {                /* tell client ready for argument */
            unsigned long donefake = 0;
            PSOUT ("+ Waiting for DONE\015\012");
            PFLUSH ();          /* dump output buffer */
                                /* inactivity countdown */
            i = ((TIMEOUT) / (IDLETIMER)) + 1;
            do {                /* main idle loop */
              if (!donefake) {  /* don't ping mailbox if faking */
                mail_parameters (stream,SET_ONETIMEEXPUNGEATPING,
                                 (void *) stream);
                ping_mailbox (uid);
                                /* maybe do a checkpoint if not anonymous */
                if (!anonymous && stream && (time (0) > lastcheck + 
CHECKTIMER)) {
                  mail_check (stream);
                                /* cancel likely altwin from mail_check() */
                  if (lsterr) fs_give ((void **) &lsterr);
                  if (lstwrn) fs_give ((void **) &lstwrn);
                                /* remember last checkpoint */
                  lastcheck = time (0);
                }
              }
              if (lstwrn) {     /* have a warning? */
                PSOUT ("* NO ");
                PSOUT (lstwrn);
                CRLF;
                fs_give ((void **) &lstwrn);
              }
              if (!(i % 2)) {   /* prevent NAT timeouts */
                sprintf (tmp,"* OK Timeout in %lu minutes\015\012",
                         (i * IDLETIMER) / 60);
                PSOUT (tmp);
              }
                                /* two minutes before the end... */
              if ((state == OPEN) && (i <= 2)) {
                sprintf (tmp,"* %lu EXISTS\015\012* %lu RECENT\015\012",
                         donefake = nmsgs + 1,recent + 1);
                PSOUT (tmp);    /* prod client to wake up */
              }
              PFLUSH ();        /* dump output buffer */
            } while ((state != LOGOUT) && !INWAIT (IDLETIMER) && --i);

                                /* time to exit idle loop */
            if (state != LOGOUT) {
              if (i) {          /* still have time left? */
                                /* yes, read expected DONE */
                slurp (tmp,MAILTMPLEN,INPUTTIMEOUT);
                if (((tmp[0] != 'D') && (tmp[0] != 'd')) ||
                    ((tmp[1] != 'O') && (tmp[1] != 'o')) ||
                    ((tmp[2] != 'N') && (tmp[2] != 'n')) ||
                    ((tmp[3] != 'E') && (tmp[3] != 'e')) ||
                    (((tmp[4] != '\015') || (tmp[5] != '\012')) &&
                     (tmp[4] != '\012')))
                  response = "%.80s BAD Bogus IDLE continuation\015\012";
                if (donefake) { /* if faking at the end */
                                /* send EXPUNGE (should be just 1) */
                  while (donefake > nmsgs) {
                    sprintf (tmp,"* %lu EXPUNGE\015\012",donefake--);
                    PSOUT (tmp);
                  }
                  sprintf (tmp,"* %lu EXISTS\015\012* %lu RECENT\015\012",
                           nmsgs,recent);
                  PSOUT (tmp);
                }
              }
              else clkint ();   /* otherwise do autologout action */
            }
          }
        }
_______________________________________________
Imap-uw mailing list
[email protected]
http://mailman2.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to