Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jan 2011 23:30:10 -0800 (PST)
From:      "G. Paul Ziemba" <p-fbsd-bugs@ziemba.us>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/154254: [patch] asmail imap login broken with gmail at al.
Message-ID:  <201101240730.p0O7UAdI024700@hairball.ziemba.us>
Resent-Message-ID: <201101240740.p0O7e9DJ048235@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         154254
>Category:       ports
>Synopsis:       [patch] asmail imap login broken with gmail at al.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 24 07:40:08 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     G. Paul Ziemba
>Release:        FreeBSD 8.2-PRERELEASE i386
>Organization:
Olive Hill Networks, Inc.
>Environment:
System: FreeBSD hairball.ziemba.us 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #1: Sun Jan 23 00:28:46 PST 2011 root@hairball:/usr/obj/usr/src/sys/GPZ-110111-camdebug i386


>Description:
	Imap logins fail with gmail and other providers due to response
	lines longer than expected and untagged responses.

>How-To-Repeat:
	Configure asmail to check mail via imap at imap.gmail.com
>Fix:

	- Increase line length
	- ignore responses with no/unexpected tags

	These two patches should be added to /usr/ports/mail/asmail/files

--- patch-imap.c begins here ---
--- imap.c.orig	2007-02-27 10:19:38.000000000 -0800
+++ imap.c	2011-01-06 23:12:58.000000000 -0800
@@ -138,13 +138,18 @@
 
 	/* connection is open, let's log in */
 
-	sprintf(output, "A000 LOGIN %s %s\r\n", mb->user, mb->pass);
-   WRITE_OUTPUT;
+    sprintf(output, "A000 LOGIN %s %s\r\n", mb->user, mb->pass);
+    WRITE_OUTPUT;
+    while (1) {
 	WAITOK;
+	if (strncmp(input, "A000 ", 5)) /* allow for other tags/untagged */
+	    continue;
+
 	if ( strncmp(input, "A000 OK", 7) ) {
-		BYE(STAT_LOGIN);
+	    BYE(STAT_LOGIN);
 	}
 	return(STAT_IDLE);
+    }
 }
 
 
@@ -287,6 +292,7 @@
 					imap_checkmbox(mb, &s);
 			}
 		} else {
+			mb->status = STAT_RUN;
 			mb->status |= imap_login(mb, &s);
 			mb->status |= imap_checkmbox(mb, &s);
 			mb->status |= imap_goodbye(mb, &s);
--- patch-imap.c ends here ---

--- patch-globals.h begins here ---
--- globals.h.orig	2007-04-09 00:51:09.000000000 -0700
+++ globals.h	2011-01-06 22:55:10.000000000 -0800
@@ -15,7 +15,9 @@
 #define VERSION "2.1"
 #define RCFILE ".asmailrc"
 /* Watch out! The MAX_INPUT_LENGTH must be a multiple of 64! */
-#define MAX_INPUT_LENGTH 255
+/* Why?? 255 (the original value) is not a multiple of 64. 255 is too small */
+/* for IMAP responses */
+#define MAX_INPUT_LENGTH 4096
 
 #define pthread_attr_default NULL
 
--- patch-globals.h ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101240730.p0O7UAdI024700>