evolution-data-server r9619 - in trunk/camel/providers: nntp pop3 smtp



Author: mcrha
Date: Fri Sep 26 09:20:02 2008
New Revision: 9619
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9619&view=rev

Log:
2008-09-26  Milan Crha  <mcrha redhat com>

	** Fix for bug #553301

	* camel/providers/nntp/camel-nntp-store.c: (camel_nntp_try_authenticate): Do not forget
	password when server not available at the moment or user cancelled.
	* camel/providers/nntp/camel-nntp-auth.c: (camel_nntp_auth_authenticate):
	Use correct parameters.

	* camel/providers/pop3/camel-pop3-store.c: (pop3_try_authenticate):
	Return 'int', not gboolean.
	* camel/providers/pop3/camel-pop3-store.c: (pop3_connect):
	Also forget password in a session before reprompting it.

	* camel/providers/smtp/camel-smtp-transport.c: (smtp_connect): Do not forget password
	when server not available at the moment or user cancelled.
	* camel/providers/smtp/camel-smtp-transport.c: (smtp_data): Compiler warning cleanup.



Modified:
   trunk/camel/providers/nntp/ChangeLog
   trunk/camel/providers/nntp/camel-nntp-auth.c
   trunk/camel/providers/nntp/camel-nntp-store.c
   trunk/camel/providers/pop3/ChangeLog
   trunk/camel/providers/pop3/camel-pop3-store.c
   trunk/camel/providers/smtp/ChangeLog
   trunk/camel/providers/smtp/camel-smtp-transport.c

Modified: trunk/camel/providers/nntp/camel-nntp-auth.c
==============================================================================
--- trunk/camel/providers/nntp/camel-nntp-auth.c	(original)
+++ trunk/camel/providers/nntp/camel-nntp-auth.c	Fri Sep 26 09:20:02 2008
@@ -47,7 +47,7 @@
 			"NNTP", service->url->user, service->url->host);
 
 		service->url->passwd = camel_session_get_password (
-			session, prompt, TRUE, service, "password", ex);
+			session, service, NULL, prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
 
 		g_free (prompt);
 

Modified: trunk/camel/providers/nntp/camel-nntp-store.c
==============================================================================
--- trunk/camel/providers/nntp/camel-nntp-store.c	(original)
+++ trunk/camel/providers/nntp/camel-nntp-store.c	Fri Sep 26 09:20:02 2008
@@ -1189,8 +1189,14 @@
 
 	if (ret != NNTP_AUTH_ACCEPTED) {
 		if (ret != -1) {
+			if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL ||
+			    camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
+				return ret;
+
 			/* Need to forget the password here since we have no context on it */
 			camel_session_forget_password(session, service, NULL, "password", ex);
+			g_free (service->url->passwd);
+			service->url->passwd = NULL;
 			goto retry;
 		}
 		return -1;

Modified: trunk/camel/providers/pop3/camel-pop3-store.c
==============================================================================
--- trunk/camel/providers/pop3/camel-pop3-store.c	(original)
+++ trunk/camel/providers/pop3/camel-pop3-store.c	Fri Sep 26 09:20:02 2008
@@ -489,7 +489,7 @@
 		g_free (base_prompt);
 		g_free (full_prompt);
 		if (!service->url->passwd)
-			return FALSE;
+			return 0;
 	}
 
 	if (!service->url->authmech) {
@@ -509,7 +509,7 @@
 						_("Unable to connect to POP server %s:	Invalid APOP ID received. Impersonation attack suspected. Please contact your admin."),
 						CAMEL_SERVICE (store)->url->host);
 
-				return FALSE;
+				return 0;
 			}
 			d++;
 		}
@@ -528,7 +528,7 @@
 		while (l) {
 			auth = l->data;
 			if (strcmp(auth->authproto, service->url->authmech) == 0)
-				return try_sasl(store, service->url->authmech, ex) == -1;
+				return try_sasl (store, service->url->authmech, ex);
 			l = l->next;
 		}
 		
@@ -536,7 +536,7 @@
 				      _("Unable to connect to POP server %s: "
 					"No support for requested authentication mechanism."),
 				      CAMEL_SERVICE (store)->url->host);
-		return FALSE;
+		return 0;
 	}
 	
 	while ((status = camel_pop3_engine_iterate(store->engine, pcp)) > 0)
@@ -610,10 +610,14 @@
 		/* we only re-prompt if we failed to authenticate, any other error and we just abort */
 		if (status == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE) {
 			errbuf = g_markup_printf_escaped ("%s\n\n", camel_exception_get_description (ex));
+			camel_exception_clear (ex);
+
+			camel_session_forget_password (session, service, NULL, "password", ex);
+			camel_exception_clear (ex);
+
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
 			reprompt = TRUE;
-			camel_exception_clear (ex);
 		} else
 			break;
 	}

Modified: trunk/camel/providers/smtp/camel-smtp-transport.c
==============================================================================
--- trunk/camel/providers/smtp/camel-smtp-transport.c	(original)
+++ trunk/camel/providers/smtp/camel-smtp-transport.c	Fri Sep 26 09:20:02 2008
@@ -560,6 +560,10 @@
 
 			authenticated = smtp_auth (transport, authtype->authproto, ex);
 			if (!authenticated) {
+				if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL ||
+				    camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
+					return FALSE;
+
 				errbuf = g_markup_printf_escaped (
 					_("Unable to authenticate "
 					  "to SMTP server.\n%s\n\n"),
@@ -1369,7 +1373,7 @@
 	}
 	
 	/* find out how large the message is... */
-	null = camel_stream_null_new ();
+	null = CAMEL_STREAM_NULL (camel_stream_null_new ());
 	camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (null));
 	
 	filtered_stream = camel_stream_filter_new_with_stream (transport->ostream);



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