Re: [evolution-patches] proposed fix for bug #40788



new updated patch which treats garbage returns as -ERR

Jeff

On Thu, 2003-06-12 at 17:18, Ettore Perazzoli wrote:
> On Wed, 2003-06-11 at 21:21, Not Zed wrote:
> > > 1. we need to make sure the pop server will be ok to use after the
> > > broken response.
> > 
> > This is next to impossible now.  About all we can conclude is that if we
> > still have an open socket, the server must be ok with that.  Of course,
> > the protocol could get wildly out of sync, but i dont think there's much
> > else we can do (if the server can't even delineate responses with the
> > right number of eol's, then its too seriously fubar'd anyway).
> 
> I assume in that case it will just result in a user-reported error?  As
> long as it doesn't mess up the app in unexpected ways that should be
> fine.
> 
> -- Ettore
> _______________________________________________
> Evolution-patches mailing list
> Evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1828
diff -u -r1.1828 ChangeLog
--- ChangeLog	12 Jun 2003 04:48:05 -0000	1.1828
+++ ChangeLog	12 Jun 2003 22:10:33 -0000
@@ -1,3 +1,21 @@
+2003-06-05  Jeffrey Stedfast  <fejj ximian com>
+
+	Fix for bug #40788.
+
+	* providers/pop3/camel-pop3-engine.c (camel_pop3_engine_new): Now
+	takes a flags argument. Currently there is only 1 flag which can
+	be used to disable Pop3 server extensions.
+	(get_capabilities): Don't check for Pop3 server extensions if the
+	DISABLE_EXTENSIONS flag is set on the engine.
+	(camel_pop3_engine_iterate): If we get a response that is neither
+	+OK nor -ERR, default to treating it like a -ERR.
+
+	* providers/pop3/camel-pop3-store.c (connect_to_server): Check for
+	the disable_extensions param.
+
+	* providers/pop3/camel-pop3-provider.c: Define a checkbox to
+	disable all POP3 extension support.
+
 2003-06-11  Jeffrey Stedfast  <fejj ximian com>
 
 	Partial fix for bug #44457.
Index: providers/pop3/camel-pop3-provider.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-provider.c,v
retrieving revision 1.29
diff -u -r1.29 camel-pop3-provider.c
--- providers/pop3/camel-pop3-provider.c	3 Apr 2002 18:18:29 -0000	1.29
+++ providers/pop3/camel-pop3-provider.c	12 Jun 2003 22:10:34 -0000
@@ -42,6 +42,8 @@
 	{ CAMEL_PROVIDER_CONF_CHECKSPIN, "delete_after", "UNIMPLEMENTED",
 	  N_("Delete after %s day(s)"), "0:1:7:365" },
 #endif
+	{ CAMEL_PROVIDER_CONF_CHECKBOX, "disable_extensions", NULL,
+	  N_("Disable support for all POP3 extensions"), "0" },
 	{ CAMEL_PROVIDER_CONF_SECTION_END },
 	{ CAMEL_PROVIDER_CONF_END }
 };
Index: providers/pop3/camel-pop3-engine.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-engine.c,v
retrieving revision 1.6
diff -u -r1.6 camel-pop3-engine.c
--- providers/pop3/camel-pop3-engine.c	1 Jun 2003 23:49:29 -0000	1.6
+++ providers/pop3/camel-pop3-engine.c	12 Jun 2003 22:10:34 -0000
@@ -97,6 +97,7 @@
 /**
  * camel_pop3_engine_new:
  * @source: source stream
+ * @flags: engine flags
  *
  * Returns a NULL stream.  A null stream is always at eof, and
  * always returns success for all reads and writes.
@@ -104,7 +105,7 @@
  * Return value: the stream
  **/
 CamelPOP3Engine *
-camel_pop3_engine_new(CamelStream *source)
+camel_pop3_engine_new(CamelStream *source, guint32 flags)
 {
 	CamelPOP3Engine *pe;
 
@@ -112,7 +113,8 @@
 
 	pe->stream = (CamelPOP3Stream *)camel_pop3_stream_new(source);
 	pe->state = CAMEL_POP3_ENGINE_AUTH;
-
+	pe->flags = flags;
+	
 	get_capabilities(pe, TRUE);
 
 	return pe;
@@ -213,21 +215,23 @@
 		pe->auth = g_list_prepend(pe->auth, &camel_pop3_password_authtype);
 	}
 	
-	pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, "CAPA\r\n");
-	while (camel_pop3_engine_iterate(pe, pc) > 0)
-		;
-	camel_pop3_engine_command_free(pe, pc);
-	
-	if (pe->state == CAMEL_POP3_ENGINE_TRANSACTION && !(pe->capa & CAMEL_POP3_CAP_UIDL)) {
-		/* check for UIDL support manually */
-		pc = camel_pop3_engine_command_new (pe, CAMEL_POP3_COMMAND_SIMPLE, NULL, NULL, "UIDL 1\r\n");
-		while (camel_pop3_engine_iterate (pe, pc) > 0)
+	if (!(pe->flags & CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS)) {
+		pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, "CAPA\r\n");
+		while (camel_pop3_engine_iterate(pe, pc) > 0)
 			;
+		camel_pop3_engine_command_free(pe, pc);
 		
-		if (pc->state == CAMEL_POP3_COMMAND_OK)
-			pe->capa |= CAMEL_POP3_CAP_UIDL;
-		
-		camel_pop3_engine_command_free (pe, pc);
+		if (pe->state == CAMEL_POP3_ENGINE_TRANSACTION && !(pe->capa & CAMEL_POP3_CAP_UIDL)) {
+			/* check for UIDL support manually */
+			pc = camel_pop3_engine_command_new (pe, CAMEL_POP3_COMMAND_SIMPLE, NULL, NULL, "UIDL 1\r\n");
+			while (camel_pop3_engine_iterate (pe, pc) > 0)
+				;
+			
+			if (pc->state == CAMEL_POP3_COMMAND_OK)
+				pe->capa |= CAMEL_POP3_CAP_UIDL;
+			
+			camel_pop3_engine_command_free (pe, pc);
+		}
 	}
 }
 
@@ -304,8 +308,8 @@
 	default:
 		/* what do we do now?  f'knows! */
 		g_warning("Bad server response: %s\n", p);
-		errno = EIO;
-		return -1;
+		pc->state = CAMEL_POP3_COMMAND_ERR;
+		break;
 	}
 
 	e_dlist_addtail(&pe->done, (EDListNode *)pc);
@@ -313,7 +317,7 @@
 
 	/* Set next command */
 	pe->current = (CamelPOP3Command *)e_dlist_remhead(&pe->active);
-
+	
 	/* check the queue for sending any we can now send also */
 	pw = (CamelPOP3Command *)pe->queue.head;
 	pn = pw->next;
Index: providers/pop3/camel-pop3-engine.h
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-engine.h,v
retrieving revision 1.3
diff -u -r1.3 camel-pop3-engine.h
--- providers/pop3/camel-pop3-engine.h	7 May 2002 07:31:26 -0000	1.3
+++ providers/pop3/camel-pop3-engine.h	12 Jun 2003 22:10:34 -0000
@@ -68,6 +68,11 @@
 	CAMEL_POP3_CAP_STLS = 1<<5
 };
 
+/* enable/disable flags for the engine itself */
+enum {
+	CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS = 1<<0,
+};
+
 typedef void (*CamelPOP3CommandFunc)(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data);
 
 struct _CamelPOP3Command {
@@ -86,7 +91,9 @@
 
 struct _CamelPOP3Engine {
 	CamelObject parent;
-
+	
+	guint32 flags;
+	
 	camel_pop3_engine_t state;
 
 	GList *auth;		/* authtypes supported */
@@ -114,7 +121,7 @@
 
 CamelType		  camel_pop3_engine_get_type	(void);
 
-CamelPOP3Engine  *camel_pop3_engine_new		(CamelStream *source);
+CamelPOP3Engine  *camel_pop3_engine_new		(CamelStream *source, guint32 flags);
 
 void              camel_pop3_engine_reget_capabilities (CamelPOP3Engine *engine);
 
Index: providers/pop3/camel-pop3-store.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/pop3/camel-pop3-store.c,v
retrieving revision 1.97
diff -u -r1.97 camel-pop3-store.c
--- providers/pop3/camel-pop3-store.c	8 Apr 2003 17:48:12 -0000	1.97
+++ providers/pop3/camel-pop3-store.c	12 Jun 2003 22:10:34 -0000
@@ -151,6 +151,7 @@
 	CamelStream *tcp_stream;
 	CamelPOP3Command *pc;
 	struct hostent *h;
+	guint32 flags = 0;
 	int clean_quit;
 	int ret, port;
 	
@@ -197,7 +198,10 @@
 		return FALSE;
 	}
 	
-	store->engine = camel_pop3_engine_new (tcp_stream);
+	if (camel_url_get_param (service->url, "disable_extensions"))
+		flags |= CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS;
+	
+	store->engine = camel_pop3_engine_new (tcp_stream, flags);
 	
 #ifdef HAVE_SSL
 	if (store->engine) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]