[tpop3d-discuss]Outlook duplicate messages

Dragos Nitu dragos.nitu at idilis.net
Tue, 25 May 2004 01:36:58 +0200


OK, thanks. I didn't understand what the problem was about. I made another
patch :). This one sure works.

In case the connection is closed by the client, and QUIT command is still
there, it does apply changes.

Because I didn't have an Outlook 2000 to test this, I wrote my own client
which doesn't wait for an answer to QUIT, and it works. Behaves just like Outlook.

--- tpop3d-1.5.3/netloop.c.orig Mon Nov 24 21:58:28 2003
+++ tpop3d-1.5.3/netloop.c      Tue May 25 01:08:39 2004
@@ -463,7 +463,17 @@
             /* We should now log the closure of the connection and ending
              * of any authenticated session. */
             if (c->a)
+           {
+               pop3command p;
+               if((p = connection_parsecommand(c)))
+                   if(p->cmd == QUIT)
+                   {
+                       mailbox curmbox;
+                       curmbox=c->m;
+                       (curmbox)->apply_changes(curmbox);
+                   }
                 log_print(LOG_INFO, _("connections_post_select: client %s:
finished session for `%s' with %s"), c->idstr, c->a->user, c->a->auth);
+           }
             log_print(LOG_INFO, _("connections_post_select: client %s:
disconnected; %d/%d bytes read/written"), c->idstr, c->nrd, c->nwr);
  
 /*            remove_connection(c);*/



Look at the tests:

Original tpop3d:
[root@dragos pop3]# ./a.out 217.156.85.7 root xxx
Connected to: 217.156.85.7
+OK <992c4058c2881bdcd4e72307c37b9a8d@hotlog.idilis.net>
+OK Welcome aboard! You have 404 messages.
DELE: +OK Done.
[root@dragos pop3]# ./a.out 217.156.85.7 root xxx
Connected to: 217.156.85.7
+OK <7e56ead706b46767ce0e4b33a2ac787e@hotlog.idilis.net>
+OK Welcome aboard! You have 403 messages.
DELE: +OK Done.
[root@dragos pop3]# ./a.out 217.156.85.7 root xxx
Connected to: 217.156.85.7
+OK <56e6d824e324040b8c980b260abf6685@hotlog.idilis.net>
+OK Welcome aboard! You have 403 messages.
DELE: +OK Done.

First time it deletes one message. After that, doesn't work anymore. It's random.

Modified tpop3:

[root@dragos pop3]# ./a.out 217.156.85.7 root xxx
Connected to: 217.156.85.7
+OK <bb4c1897d5bcca87d673fb831f6ed1ca@hotlog.idilis.net>
+OK Welcome aboard! You have 403 messages.
DELE: +OK Done.
[root@dragos pop3]# ./a.out 217.156.85.7 root xxx
Connected to: 217.156.85.7
+OK <41e652965bbe941bed1890dbd8c847c2@hotlog.idilis.net>
+OK Welcome aboard! You have 402 messages.
DELE: +OK Done.
[root@dragos pop3]# ./a.out 217.156.85.7 root xxx
Connected to: 217.156.85.7
+OK <b1268af5d16f3fdbd76c48231a5b2e55@hotlog.idilis.net>
+OK Welcome aboard! You have 401 messages.
DELE: +OK Done.
[root@dragos pop3]# ./a.out 217.156.85.7 root xxx
Connected to: 217.156.85.7

I hope you understand something from the output of my program... It's very
late here. Anyway, I hope you can test this patch on a real Outlook.

Dragos Nitu
Idilis S.A.
Tel: +40-21-2082800
Fax: +40-21-2082801


---------- Original Message -----------
From: Matthew Trent <mtrent@localaccess.com>
To: "Dragos Nitu" <dragos.nitu@idilis.net>
Sent: Mon, 24 May 2004 10:57:52 -0700
Subject: Re: [tpop3d-discuss]Outlook duplicate messages

> On Monday 24 May 2004 11:41 am, you wrote:
> > OK, I was a little ambiguous. This patch that I made, makes tpop3d behave
> > like this: when a QUIT command is issued, it doesn't close the connection. 
> > If there are more comands in the queue, takes care of them first.
> 
> Ok, I see. And this seems to have stopped the duplicate emails in Outlook?
> 
> > After that the client is suposed to close that connection (Microsoft
> > Outlook does that). If not, the connection closes in 30 seconds (default
> > timeout).
> >
> > If there are not other commands after QUIT, tpop3d closes connection in
> > just 10 seconds (Opera hangs if the server doesn't close connection).
> >
> > So it actually works ! I think that 10 seconds timeout it's not necessary,
> > but a hve to make some other tests. My server runs fine since sunday
> > morning, and the problem with Outlook seems gone.
> >
> > Non-Outlook clients still run fine. The timeout is at the end, after all
> > commands (after QUIT).
> 
> So you think it might not need the full 10 second delay? We have 
> about 10,000 email addresses and some of them DO use Opera and would 
> complain, no doubt.
> 
> > This patch was made to get people of my back, too. However is nice to share
> > :).
> 
> Yeah, thanks for sharing!
> 
> > PS. The problem was that Microsoft Outlook send DELE commands after QUIT,
> > but tpop3d ingores them. Other clients don't have that problem (not even
> > Outlook Express).
> 
> I understood the problem a bit differently. I thought the problem 
> was because tpop3d doesn't actually delete anything until after a 
> successfull QUIT command (even if they've been DELEted), and Outlook 
> was closing the connection so fast after sending QUIT that it was 
> closed before tpop3d processed the QUIT and therefore things weren't 
> deleting (and thus were downloaded again next time).
> -- 
> Matt
> Systems Administrator
> Local Access Communications
> 360.330.5535
------- End of Original Message -------