imapfeed patches

Ken Murchison ken at oceana.com
Fri Aug 30 18:36:41 UTC 2002



"Jeffrey M. Vinocur" wrote:
> 
> On Fri, 28 Jun 2002, Ken Murchison wrote:
> >
> > FWIW, I worked closely with the folks at CMU on this.  In fact they
> > proposed the adding of the To: header to faciliate wide replies.  I like
> > the idea and hope I implemented it correctly.
> 
> Just committed, thanks.  I have no idea if it's correct, but it compiles
> cleanly at least.  Well, there is one signficant compilation warning in
> imap_connection.c, but it doesn't seem to be due to your patch so no
> reason to delay.
> 
> If you want to have a look, one call to syslog (grep for STATS_MSG) in
> cxnLogStats() doesn't have nearly enough arguments.  Some of them just
> need to be set to zero, but it looks like someone familiar with imapfeed
> might be able to dig up actual data for a couple of the log entries.

Jeff,

Sorry it took me so long to get back to this.  I haven't looked into the
STATS_MSG problem yet, because I had to fix some bugs first.

Attached is a patch against today's snapshot which fixes some concat()
related bugs which were preventing authentication to both imapd and
lmtpd.  Apparently we can't free the concat() buffer (at least not
immediately) because the writes must be buffered and we need the pointer
around until the data is output.  This is obviously a memory leak which
needs plugging.

This patch also allows imapfeed to deal with multi-line LMTP responses
(Cyrus lmtpd sends multi-line 550 on RCPT TO failure).

I'll take a look at cleaning up the other stuff next.

BTW, Is there any anonymous CVS access so I can kep my eye on any
imapfeed related changes?

Thanks,
Ken
-- 
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

-- Attached file included as plaintext by Ecartis --
-- File: imapfeed.patch

--- imap_connection.c.orig	Sun Aug 25 17:35:05 2002
+++ imap_connection.c	Fri Aug 30 13:40:55 2002
@@ -2102,7 +2102,6 @@
 #endif /* SMTPMODE */
 
     result = WriteToWire_lmtpstr(cxn, p, strlen(p));
-    free(p);
     if (result!=RET_OK) return result;
 
     cxn->lmtp_state = LMTP_WRITING_LHLO;
@@ -2168,7 +2167,6 @@
     }
 
     result = WriteToWire_lmtpstr(cxn, p, strlen(p));
-    free(p);
 
     cxn->lmtp_state = LMTP_WRITING_STARTAUTH;
 
@@ -2655,7 +2653,6 @@
 
     imap_GetTag(cxn);
     tosend = concat(cxn->imap_currentTag, " ", atom, "\r\n", (char *) 0);
-    sprintf(tosend,"%s %s\r\n", cxn->imap_currentTag, atom);
 
     result = WriteToWire_imapstr(cxn, tosend, -1);
     if (result != RET_OK) return result;
@@ -2683,19 +2680,7 @@
 
 static conn_ret imap_sendCapability(connection_t *cxn)
 {
-    conn_ret result;
-    char *tosend;
-
-    imap_GetTag(cxn);
-
-    tosend = concat(cxn->imap_currentTag, " CAPABILITY\r\n");
-
-    result = WriteToWire_imapstr(cxn, tosend, -1);
-    if (result != RET_OK) return result;
-
-    cxn->imap_state = IMAP_WRITING_CAPABILITY;
-
-    return RET_OK;
+    return imap_sendSimple(cxn, "CAPABILITY", IMAP_WRITING_CAPABILITY);
 }
 
 /************************** END IMAP sending functions ************************/
@@ -3484,6 +3469,9 @@
 #endif /* HAVE_SASL */
 		    
 	case LMTP_READING_RSET:
+	    if (ask_keepgoing(str)) {
+		goto reset;
+	    }
 	    if (ask_code(str) != 250) {
 		d_printf(0,"%s:%d:LMTP RSET failed with (%d)\n",
 			 hostPeerName (cxn->myHost),cxn->ident,
@@ -3497,6 +3485,9 @@
 	    goto reset;
 
 	case LMTP_READING_MAILFROM:
+	    if (ask_keepgoing(str)) {
+		goto reset;
+	    }
 	    if (ask_code(str) != 250) {
 		d_printf(0,"%s:%d:LMTP MAILFROM failed with (%d)\n",
 			 hostPeerName (cxn->myHost),cxn->ident,
@@ -3511,6 +3502,9 @@
 	    break;
 
 	case LMTP_READING_RCPTTO:
+	    if (ask_keepgoing(str)) {
+		goto reset;
+	    }
 	    if (ask_code(str)!=250) {
 		d_printf(1,"%s:%d:LMTP RCPT TO failed with (%d) %s\n",
 			 hostPeerName (cxn->myHost),cxn->ident,
@@ -3534,6 +3528,9 @@
 	    break;
 
 	case LMTP_READING_DATA:
+	    if (ask_keepgoing(str)) {
+		goto reset;
+	    }
 	    if (cxn->current_rcpts_issued == 0) {
 		if (cxn->current_article->trys < 100) {
 		    d_printf(1, "%s:%d:LMTP None of the rcpts "
@@ -3560,6 +3557,10 @@
 	    break;
 
 	case LMTP_READING_CONTENTS:
+	    if (ask_keepgoing(str)) {
+		goto reset;
+	    }
+
 	    /* need 1 response from server for every rcpt */
 	    cxn->current_rcpts_issued--;
 	    
@@ -3600,6 +3601,9 @@
 	    break;
 
 	case LMTP_READING_NOOP:
+	    if (ask_keepgoing(str)) {
+		goto reset;
+	    }
 	    cxn->lmtp_state = LMTP_AUTHED_IDLE;
 	    break;
 




More information about the inn-bugs mailing list