lefcha/imapfilter — Issue #22: Another become_daemon() issue with Exchange 2010
Author: ressy
Created: 2011-12-14 17:59:48+00:00
State: open

This has actually been happening since my server was upgraded from Exchange 2007 to 2010 a few months back, and I suspect it's a problem on that end-- but I'm hoping that becaome_daemon() can help work around it. Ever since the upgrade Exchange will occasionally give a strange response to a regular query. When I connect through DavMail Gateway (Exchange <-> IMAP adapter daemon) it would look like this:

```
sending command (4):

125C SELECT "INBOX"

getting response (4):

* BYE Closing connection
```

And connecting straight to the Exchange server (thinking maybe something was odd with DavMail) doesn't even give the BYE:

```
sending command (5):

F9DC STATUS "INBOX" (MESSAGES RECENT UNSEEN UIDNEXT)
```

(That's the last line in the debug file; no visible response.) Now that I'm using 4.2.1 (thanks again) I can see some things going on in the logfile too, some of each of these errors randomly when connecting to Exchange:

```
Mon Dec 12 23:59:07 2011: IMAP (6): 29B5 NO System error (Failure)
```
```
Tue Dec 13 23:28:11 2011: reading data; EOF in violation of the protocol
```

Possibly it's closing the connection unexpectedly, confusing imapfilter? I was hoping is that the pcall() in become_daemon() would ignore whatever this is and continue to the next cycle of filtering, but the program exits completely when this happens and needs to be restarted on the command line. Any thoughts about what this is and/or how I can catch the error in become_daemon when it occurs? Thanks!

P.S. Is the mailing list still active? Just let me know if this would be more appropriate there, particularly since I think it's more likely an Exchange bug than an imapfilter one.