[evolution-patches] Exchange connector: Patch for 74050



Hi,

When wrong protocol is used in the owa url during account 
creation, displaying error, instead of continuing with the 
account creation (as in x-c-s) by correcting the url and then 
failing at the end.

Also preceeding the owa path with a slash.

Please review,
Sushma.

Index: lib/e2k-autoconfig.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/lib/e2k-autoconfig.c,v
retrieving revision 1.16
diff -u -p -r1.16 e2k-autoconfig.c
--- lib/e2k-autoconfig.c	17 Mar 2005 11:27:26 -0000	1.16
+++ lib/e2k-autoconfig.c	24 Mar 2005 15:04:22 -0000
@@ -1398,7 +1398,8 @@ validate (const char *owa_url, char *use
 	E2kAutoconfigResult result;
 	E2kUri *euri;
 	gboolean valid = FALSE;
-	const char *old, *new, *path;
+	const char *old, *new;
+	char *path, *mailbox;
 
 	ac = e2k_autoconfig_new (owa_url, user, password, 
 				 E2K_AUTOCONFIG_USE_EITHER);
@@ -1409,22 +1410,44 @@ validate (const char *owa_url, char *use
 	result = e2k_autoconfig_check_exchange (ac, &op);
 
 	if (result == E2K_AUTOCONFIG_OK) {
+		/*
+		 * On error code 403 and SSL seen in server response 
+		 * e2k_autoconfig_get_context() tries to
+		 * connect using https if owa url has http and vice versa.
+		 * And also re-sets the owa_uri in E2kAutoconfig.
+		 * So even if the uri is incorrect, 
+		 * e2k_autoconfig_check_exchange() will return success.
+		 * In this case of account set up, owa_url paramter will still
+		 * have wrong url entered, and we throw the error, instead of
+		 * going ahead with account setup and failing later. 
+		 */
+		if (g_str_has_prefix (ac->owa_uri, "http:")) {
+		    if (!g_str_has_prefix (owa_url, "http:"))
+			result = E2K_AUTOCONFIG_CANT_CONNECT;
+		}
+		else if (!g_str_has_prefix (owa_url, "https:"))
+			result = E2K_AUTOCONFIG_CANT_CONNECT;
+	}
+
+	if (result == E2K_AUTOCONFIG_OK) {
 		result = e2k_autoconfig_check_global_catalog (ac, &op);
 		e2k_operation_free (&op);
 		
 		/* find mailbox and owa_path values */	
 		euri = e2k_uri_new (ac->home_uri);
-		exchange_params->owa_path = g_strdup (euri->path + 1);
+		path = g_strdup (euri->path + 1);
 		e2k_uri_free (euri);
-		path = exchange_params->owa_path;
-		exchange_params->mailbox = strrchr (path, '/');
-		if (exchange_params->mailbox && !exchange_params->mailbox[1]) {
-			*exchange_params->mailbox = '\0';
-			exchange_params->mailbox = strrchr (path, '/');
+		mailbox = strrchr (path, '/');
+		if (mailbox && !mailbox[1]) {
+			*mailbox = '\0';
+			mailbox = strrchr (path, '/');
 		}
-		if (exchange_params->mailbox)
-			*exchange_params->mailbox++ = '\0';
+		if (mailbox)
+			*mailbox++ = '\0';
 
+		exchange_params->mailbox  = g_strdup (mailbox);
+		exchange_params->owa_path = g_strdup_printf ("%s%s", "/", path);
+		g_free (path);
 		exchange_params->host = ac->pf_server;
 		if (ac->gc_server) 
 			exchange_params->ad_server = ac->gc_server;
Index: camel/camel-exchange-provider.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-provider.c,v
retrieving revision 1.18
diff -u -p -r1.18 camel-exchange-provider.c
--- camel/camel-exchange-provider.c	17 Mar 2005 11:27:25 -0000	1.18
+++ camel/camel-exchange-provider.c	24 Mar 2005 15:05:45 -0000
@@ -164,7 +164,9 @@ exchange_validate_user_cb (CamelURL *cam
 	camel_url_set_param(camel_url, "ad_server", valid?exchange_params->ad_server:NULL);
 	camel_url_set_param(camel_url, "mailbox", valid?exchange_params->mailbox:NULL);
 	camel_url_set_param(camel_url, "owa_path", valid?exchange_params->owa_path:NULL);
+
 	g_free (exchange_params->owa_path);
+	g_free (exchange_params->mailbox);
 	g_free (exchange_params);
 	return valid;
 }


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