[evolution-patches] Exchange connector - forgetting password



Hi,

For all account modifications, we forget password and prompt for
passowrd with next login, even when remember password option is 
selected. 
Now this is done slectively.
Please review.

Thanks,
-Sushma.

Index: storage/exchange-config-listener.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-config-listener.c,v
retrieving revision 1.15
diff -u -p -r1.15 exchange-config-listener.c
--- storage/exchange-config-listener.c	26 Feb 2005 14:19:16 -0000	1.15
+++ storage/exchange-config-listener.c	28 Feb 2005 13:58:08 -0000
@@ -653,6 +653,48 @@ configured_account_destroyed (gpointer u
 	g_free (aud);
 }
 
+static gboolean
+requires_relogin (char *current_url, char *new_url)
+{
+	E2kUri *current_uri, *new_uri;
+	const char *current_param_val, *new_param_val;
+	const char *params [] = { "owa_url", "ad_server" };
+	const int n_params = G_N_ELEMENTS (params);
+	int i;
+	gboolean relogin = FALSE;
+
+	current_uri = e2k_uri_new (current_url);
+	new_uri = e2k_uri_new (new_url);
+
+	if (strcmp (current_uri->user, new_uri->user) ||
+	    strcmp (current_uri->host, new_uri->host)) {
+		relogin = TRUE;
+		goto end;
+	}
+
+	for (i=0; i<n_params; i++) { 
+		current_param_val = e2k_uri_get_param (current_uri, params[i]);
+		new_param_val = e2k_uri_get_param (new_uri, params[i]); 
+	
+		if (current_param_val && new_param_val) {
+			/* both the urls have params to be compared */
+			if (strcmp (current_param_val, new_param_val)) {
+				relogin = TRUE;
+				break;
+			}
+		}
+		else if (current_param_val || new_param_val){
+			/* check for added or deleted parameter */
+			relogin = TRUE;
+			break;
+		}
+	}
+end:
+	e2k_uri_free (new_uri);
+	e2k_uri_free (current_uri);
+	return relogin;
+}
+
 static void
 account_changed (EAccountList *account_list, EAccount *account)
 {
@@ -716,8 +758,20 @@ account_changed (EAccountList *account_l
 	if (strcmp (config_listener->priv->configured_uri, account->source->url)) { 
 		remove_sources (priv->exchange_account);
 
-		/* Ask user to authenticate at next login */
-		exchange_account_forget_password (priv->exchange_account);
+		/* Ask user to authenticate at next login if username, hostname,
+		 * OWA URL or GC server values are changed. 
+		 */
+		if (requires_relogin (config_listener->priv->configured_uri, 
+				      account->source->url)) {
+			exchange_account_forget_password (priv->exchange_account);
+		}
+		else {
+			/* FIXME: modify esources and don't ask for re-login */
+			/* modify_esource (priv->exchange_account, 
+			 * account->source->url); 
+			 * return;
+			 */
+		}
 	}
 	else if (strcmp (config_listener->priv->configured_name, account->name))
 		remove_sources (priv->exchange_account);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.276
diff -u -p -r1.276 ChangeLog
--- ChangeLog	28 Feb 2005 12:32:44 -0000	1.276
+++ ChangeLog	28 Feb 2005 14:14:36 -0000
@@ -1,5 +1,12 @@
 2005-02-28  Sushma Rai  <rsushma novell com>
 
+	* storage/exchange-config-listener.c (account_changed): Checks if
+	user needs to authenticate again, based on the url changes.
+	(requires_relogin): Compares the current url with the modified 
+	url, to see if user needs to relogin.
+
+2005-02-28  Sushma Rai  <rsushma novell com>
+
 	* storage/exchange-oof.c (sync_oof_info): Checking for NULL OOF 
 	message. Fixes the crash when oof_info file gets created here.
 


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