Re: Patch: imap LOGINDISABLED does not abort if we have auth methods



El mié, 05-03-2008 a las 13:06 +0100, Jose Dapena Paz escribió:
> 	Hi,
> 
> 	This patch only aborts login attempt with LOGINDISABLED if there's no
> auth method available. Should help in detection and usage of these
> secure auth methods for some servers.

	Modified the patch a bit. Now we only ignore LOGINDISABLED if any
offered auth method is secure.

-- 
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3465)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2008-03-05  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c:
+	(connect_to_server): we don't abort connection attempt if we get
+	LOGINDISABLED but we have secure auth methods in capabilities.
+
 2008-03-04  Philip Van Hoof <pvanhoof gnome org>
 
 	* Leave on disk, MIME parsing. Highly experimental
Index: libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c	(revision 3465)
+++ libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c	(working copy)
@@ -873,7 +873,27 @@
 	return TRUE;
 }
 
+static void
+is_secure_auth (gpointer key, gpointer value, gpointer userdata)
+{
+	gchar *auth_name = (gchar *) key;
+	gboolean *result = (gboolean *) userdata;
+
+	if (camel_strstrcase (auth_name, "CRAM-MD5") != NULL)
+		*result = TRUE;
+}
+
 static gboolean
+has_secure_auth_types (GHashTable *table)
+{
+	gboolean result = FALSE;
+
+	g_hash_table_foreach (table, is_secure_auth, &result);
+	
+	return result;
+}
+
+static gboolean
 connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, int must_tls, CamelException *ex)
 {
 	CamelImapStore *store = (CamelImapStore *) service;
@@ -1014,7 +1034,8 @@
 	if (!must_tls && (not_ssl || ssl_mode != MODE_TLS))
 	{
 		/* LOGINDISABLED but no SSL either? :-\ */
-		if (store->capabilities & IMAP_CAPABILITY_LOGINDISABLED) {
+		if ((!has_secure_auth_types (store->authtypes)) &&
+		    (store->capabilities & IMAP_CAPABILITY_LOGINDISABLED)) {
 			clean_quit = TRUE;
 			camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
 				"Failed to connect to IMAP server %s: %s",


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