[evolution-patches] Exchange connector: Patch for #72801



Hi,

Attached is the patch for trying nt_domain for kerberos 
authentications we do, in case authentication fails with
windows domain.

Please review.
Thanks,
Sushma.
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/storage/exchange-account.c,v
retrieving revision 1.38
diff -u -p -r1.38 exchange-account.c
--- storage/exchange-account.c	9 Mar 2005 07:50:40 -0000	1.38
+++ storage/exchange-account.c	10 Mar 2005 12:31:20 -0000
@@ -78,7 +78,7 @@ struct _ExchangeAccountPrivate {
 	gboolean uris_use_email, offline_sync;
 
 	char *identity_name, *identity_email, *source_uri, *password_key;
-	char *username, *password, *windows_domain, *ad_server;
+	char *username, *password, *windows_domain, *nt_domain, *ad_server;
 	char *owa_url;
 	E2kAutoconfigAuthPref auth_pref;
 	int ad_limit, passwd_exp_warn_period;
@@ -282,6 +282,9 @@ finalize (GObject *object)
 	if (account->priv->windows_domain)
 		g_free (account->priv->windows_domain);
 
+	if (account->priv->nt_domain)
+		g_free (account->priv->nt_domain);
+
 	if (account->priv->ad_server)
 		g_free (account->priv->ad_server);
 
@@ -908,6 +911,15 @@ is_password_expired (ExchangeAccount *ac
 
 	result = e2k_kerberos_check_password (ac->username, domain,
 					      ac->password);
+	if (result != E2K_KERBEROS_OK || 
+	    result != E2K_KERBEROS_PASSWORD_EXPIRED) {
+		/* try again with nt domain */
+		domain = ac->nt_domain;
+		if (domain)
+			result = e2k_kerberos_check_password (ac->username, 
+							      domain,
+							      ac->password);
+	} 
 
 	return (result == E2K_KERBEROS_PASSWORD_EXPIRED);
 }
@@ -1040,12 +1052,21 @@ exchange_account_set_password (ExchangeA
 			domain++;
 	}
 	if (!domain) {
+		/* email id is not proper, we return instead of trying nt_domain */
 		e_notice (NULL, GTK_MESSAGE_ERROR, _("Cannot change password due to configuration problems"));
 		return;
 	}
 
 	result = e2k_kerberos_change_password (account->priv->username, domain,
 					       old_pass, new_pass);
+	if (result != E2K_KERBEROS_OK || result != E2K_KERBEROS_PASSWORD_TOO_WEAK) {
+		/* try with nt_domain */
+		domain = account->priv->nt_domain;
+		if (domain)
+			result = e2k_kerberos_change_password (account->priv->username, 
+							       domain, old_pass,
+							       new_pass);
+	}
 	switch (result) {
 	case E2K_KERBEROS_OK:
 		e_passwords_forget_password ("Exchange", account->priv->password_key);
@@ -1326,6 +1347,11 @@ exchange_account_connect (ExchangeAccoun
 
  try_connect_again:
 	account->priv->ctx = e2k_autoconfig_get_context (ac, NULL, &result);
+
+	if (ac->nt_domain)
+		account->priv->nt_domain = g_strdup (ac->nt_domain);
+	else
+		account->priv->nt_domain = NULL;
 
 	if (result != E2K_AUTOCONFIG_OK) {
 		if ( is_password_expired (account, ac)) {
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.292
diff -u -r1.292 ChangeLog
--- ChangeLog	10 Mar 2005 10:02:58 -0000	1.292
+++ ChangeLog	10 Mar 2005 12:39:49 -0000
@@ -1,3 +1,12 @@
+2005-03-10  Sushma Rai  <rsushma novell com>
+
+	* storage/exchange-account.c (is_password_expired)
+	(exchange_account_set_password): If kerberos calls with windows domain
+	and domain extracted from e-mail id fail, trying again with NT domain.
+	(exchange_account_connect): Storing the NT domain value in exchange 
+	account.
+	(finalize): Clearing NT domain value stored.
+
 2005-03-10 Sivaiah Nallagatla <snallagatla novell com>
                                                                                            
         * calendar/backends/e-cal-backend-exchange.c


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