fetchmail-friends
[Top] [All Lists]

[fetchmail]ODMR patches continued

2001-06-27 22:09:48
Three ODMR patches against 5.8.10, one bug and two cleanups.  The two
cleanups are optional -- the first patch is all that is strictly
necessary to get ODMR working.

This code tested against www.mailkeep.com's ODMR server, which appears
unsupported/unmaintained, but it seems you can use it for free.


The bug: odmr_getrange() now calls smtp_open() to connect to a local
        smtp server.  Bug is that smtp_open() starts to talk SMTP
        after connecting.  The ODMR case wants to proxy transparently.
        Solution is to return right after opening the socket in the
        ODMR case.

--- sink.c.orig Wed Jun 27 20:26:45 2001
+++ sink.c      Wed Jun 27 20:30:35 2001
@@ -112,8 +112,12 @@
                    continue;
            } else
            if ((ctl->smtp_socket = SockOpen(parsed_host,portnum,NULL,
                                             ctl->server.plugout)) == -1)
                continue;
+
+           /* return immediately for ODMR */
+           if (ctl->server.protocol == P_ODMR)
+               return(ctl->smtp_socket); /* success */
 
            /* are we doing SMTP or LMTP? */
            SMTP_setmode(ctl->listener);



Cleanup #1: The ODMR code shouldn't send a SMTP quit in odmr_logout()
            if the connection has already turned around (since at that
            point fetchmail is just a dumb proxy).


--- odmr.c.orig Wed Jun 27 21:44:05 2001
+++ odmr.c      Wed Jun 27 21:51:56 2001
@@ -182,7 +182,13 @@
 static int odmr_logout(int sock, struct query *ctl)
 /* send logout command */
 {
-    return(gen_transact(sock, "QUIT"));
+    /* if we have a smtp_socket, then we've turned around and the
+       local smtp server is in control of the connection (so we don't
+       send QUIT) */
+    if (ctl->smtp_socket == -1)
+       return(gen_transact(sock, "QUIT"));
+    else
+       return(PS_SUCCESS);
 }
 
 const static struct method odmr =



Cleanup #2: The code in terminate_poll() was also calling SMTP_quit()
            if the smtp_socket was set.  In the ODMR case, we don't
            want to be doing that.

--- fetchmail.c.orig    Wed Jun 27 21:57:12 2001
+++ fetchmail.c Wed Jun 27 21:58:46 2001
@@ -1300,7 +1300,10 @@
        for (ctl = querylist; ctl; ctl = ctl->next)
            if (ctl->smtp_socket != -1)
            {
-               SMTP_quit(ctl->smtp_socket);
+               /* don't send QUIT for ODMR case because we're acting
+                   as a proxy between the SMTP server and client. */
+               if (ctl->server.protocol != P_ODMR)
+                   SMTP_quit(ctl->smtp_socket);
                SockClose(ctl->smtp_socket);
                ctl->smtp_socket = -1;
            }



<Prev in Thread] Current Thread [Next in Thread>
  • [fetchmail]ODMR patches continued, Matt Armstrong <=