[evolution-patches] Exchange connector - authentication mechanisms



Hi,

This patch is to set the auth mechanism, during the account creation.
And also to set the auth type in both source and transport urls,
if the user changes the authentication type from editor.

Please review.
-Sushma.


Index: exchange-account-setup.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/exchange-account-setup/exchange-account-setup.c,v
retrieving revision 1.12
diff -u -p -r1.12 exchange-account-setup.c
--- exchange-account-setup.c	27 Feb 2005 10:05:22 -0000	1.12
+++ exchange-account-setup.c	16 Mar 2005 11:50:51 -0000
@@ -602,29 +602,42 @@ exchange_authtype_changed (GtkComboBox *
 	GtkTreeModel *model;
 	GtkTreeIter iter;
 	CamelServiceAuthType *authtype;
-	CamelURL *url;
-	const char *source_url;
-	char *url_string;
+	CamelURL *url_source, *url_transport;
+	const char *source_url, *transport_url;
+	char *source_url_string, *transport_url_string;
 
 	source_url = e_account_get_string (target->account,
 					   E_ACCOUNT_SOURCE_URL);
 	if (id == -1)
 		return;
 
-	url = camel_url_new (source_url, NULL);
+	url_source = camel_url_new (source_url, NULL);
+
+	transport_url = e_account_get_string (target->account,
+					      E_ACCOUNT_TRANSPORT_URL);
+	url_transport = camel_url_new (transport_url, NULL);
+	
 	model = gtk_combo_box_get_model(dropdown);
 	if (gtk_tree_model_iter_nth_child(model, &iter, NULL, id)) {
 		gtk_tree_model_get(model, &iter, 1, &authtype, -1);
-		if (authtype)
-			camel_url_set_authmech(url, authtype->authproto);
-		else
-			camel_url_set_authmech(url, NULL);
+		if (authtype) {
+			camel_url_set_authmech(url_source, authtype->authproto);
+			camel_url_set_authmech(url_transport, authtype->authproto);
+		}
+		else {
+			camel_url_set_authmech(url_source, NULL);
+			camel_url_set_authmech(url_transport, NULL);
+		}
 	
-		url_string = camel_url_to_string(url, 0);
-		e_account_set_string(target->account, E_ACCOUNT_SOURCE_URL, url_string);
-		g_free(url_string);
+		source_url_string = camel_url_to_string(url_source, 0);
+		transport_url_string = camel_url_to_string(url_transport, 0);
+		e_account_set_string(target->account, E_ACCOUNT_SOURCE_URL, source_url_string);
+		e_account_set_string(target->account, E_ACCOUNT_TRANSPORT_URL, transport_url_string);
+		g_free(source_url_string);
+		g_free(transport_url_string);
 	}
-	camel_url_free(url);
+	camel_url_free(url_source);
+	camel_url_free(url_transport);
 }
 
 
Index: camel/camel-exchange-provider.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-exchange-provider.c,v
retrieving revision 1.17
diff -u -p -r1.17 camel-exchange-provider.c
--- camel/camel-exchange-provider.c	15 Mar 2005 09:40:13 -0000	1.17
+++ camel/camel-exchange-provider.c	16 Mar 2005 12:36:36 -0000
@@ -151,11 +151,15 @@ exchange_validate_user_cb (CamelURL *cam
 	exchange_params->ad_server = NULL;
 	exchange_params->mailbox = NULL;
 	exchange_params->owa_path = NULL;
+	exchange_params->is_ntlm = TRUE;
 
 	valid = e2k_validate_user (owa_url, camel_url->user, 
 				   exchange_params, remember_password);
 
+	/* If not valid we will not proceed with account setup */
 	camel_url_set_host(camel_url, valid?exchange_params->host:"");
+	if (valid)
+		camel_url_set_authmech (camel_url, exchange_params->is_ntlm?"NTLM":"Basic");
 	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);
Index: lib/e2k-autoconfig.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/lib/e2k-autoconfig.c,v
retrieving revision 1.15
diff -u -p -r1.15 e2k-autoconfig.c
--- lib/e2k-autoconfig.c	15 Mar 2005 09:40:13 -0000	1.15
+++ lib/e2k-autoconfig.c	16 Mar 2005 12:40:41 -0000
@@ -296,6 +296,7 @@ get_ctx_auth_handler (SoupMessage *msg, 
 	const char *challenge_hdr;
 	GByteArray *challenge;
 
+	ac->saw_ntlm = ac->saw_basic = FALSE;
 	headers = soup_message_get_header_list (msg->response_headers,
 						"WWW-Authenticate");
 	while (headers) {
@@ -316,6 +317,7 @@ get_ctx_auth_handler (SoupMessage *msg, 
 					       ac->nt_domain ? NULL : &ac->nt_domain,
 					       ac->w2k_domain ? NULL : &ac->w2k_domain);
 			g_byte_array_free (challenge, TRUE);
+			ac->saw_ntlm = TRUE;
 			return;
 		}
 
@@ -1426,6 +1428,7 @@ validate (const char *owa_url, char *use
 		exchange_params->host = ac->pf_server;
 		if (ac->gc_server) 
 			exchange_params->ad_server = ac->gc_server;
+		exchange_params->is_ntlm = ac->saw_ntlm;
 
 		valid = TRUE;
 	}


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