Patch for a crash in POP when TLS errors happen
- From: Sergio Villar Senin <svillar igalia com>
- To: tinymail-devel-list <tinymail-devel-list gnome org>
- Subject: Patch for a crash in POP when TLS errors happen
- Date: Tue, 03 Jun 2008 18:33:29 +0200
Hi,
this patch fixes a crash when trying to connect to a POP3 server, which
for example requires SSL, and only TLS was specified.
The problem is the following:
1- connect_to_server of camel-pop3-store.c fails and then it goes to
stls_exception.
2- then that code executes
/* try to disconnect cleanly */
pc = camel_pop3_engine_command_new (store->engine, 0, NULL, NULL,
"QUIT\r\n");
while (camel_pop3_engine_iterate (store->engine, NULL) > 0)
;
camel_pop3_engine_command_free (store->engine, pc);
3- the problem is that this camel_pop3_engine_iterate can (and it indeed
does) issue a camel_service_disconnect which for pop calls
pop3_disconnect_online, that in line 178 does store->engine = NULL
4- so the after the "innocent" call to camel_pop3_engine_iterate we'll
get a NULL store->engine, amazing he? :-)
5- you all know what happens when we later call
camel_object_unref(store->engine) ;-)
Br
Index: libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c (revision 3686)
+++ libtinymail-camel/camel-lite/camel/providers/pop3/camel-pop3-store.c (working copy)
@@ -581,7 +581,10 @@
camel_pop3_engine_command_free (store->engine, pc);
}
- camel_object_unref (CAMEL_OBJECT (store->engine));
+ /* camel_pop3_engine_iterate could issue a disconnect that
+ could set engine to NULL */
+ if (store->engine)
+ camel_object_unref (CAMEL_OBJECT (store->engine));
camel_object_unref (CAMEL_OBJECT (tcp_stream));
g_static_rec_mutex_lock (store->eng_lock);
store->engine = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]