[evolution-data-server/gnome-2-30] Re-fetch capabilities after STARTTLS. There might be new auth methods available (cherry picked from



commit 82298b9b058a4307024d9094090a9ed3ef060654
Author: David Woodhouse <David Woodhouse intel com>
Date:   Thu Jun 17 14:58:41 2010 +0100

    Re-fetch capabilities after STARTTLS. There might be new auth methods available
    (cherry picked from commit 2c9e14be88463cb00819393f17573dd4aed0e56c)

 camel/providers/imapx/camel-imapx-server.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 88a22c9..6ce78ea 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -2397,6 +2397,16 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 			camel_imapx_command_free(ic);
 			goto exit;
 		}
+
+		/* See if we got new capabilities in the STARTTLS response */
+		imapx_free_capability(is->cinfo);
+		is->cinfo = NULL;
+		if (ic->status->condition == IMAPX_CAPABILITY) {
+			is->cinfo = ic->status->u.cinfo;
+			ic->status->u.cinfo = NULL;
+			c(printf("got capability flags %08x\n", is->cinfo->capa));
+		}
+
 		camel_imapx_command_free(ic);
 
 		if (camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream)) == -1) {
@@ -2405,6 +2415,16 @@ imapx_connect_to_server (CamelIMAPXServer *is, CamelException *ex)
 					is->url->host, _("SSL negotiations failed"));
 			goto exit;
 		}
+		/* Get new capabilities if they weren't already given */
+		if (!is->cinfo) {
+			ic = camel_imapx_command_new("CAPABILITY", NULL, "CAPABILITY");
+			imapx_command_run (is, ic);
+			camel_exception_xfer (ex, ic->ex);
+			camel_imapx_command_free(ic);
+
+			if (camel_exception_is_set (ex))
+				goto exit;
+		}
 	}
 #endif
 



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