[evolution-data-server/gnome-2-28] Bug #604544 - Try Exchange fallback authentication only once



commit ba875a50d40c2ea6f4d28b27a7d7d28d6d34a8d7
Author: Milan Crha <mcrha redhat com>
Date:   Tue Dec 15 17:53:09 2009 +0100

    Bug #604544 - Try Exchange fallback authentication only once

 servers/exchange/lib/e2k-kerberos.c         |    3 +++
 servers/exchange/storage/exchange-account.c |   17 ++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/servers/exchange/lib/e2k-kerberos.c b/servers/exchange/lib/e2k-kerberos.c
index bf1a99e..c32176f 100644
--- a/servers/exchange/lib/e2k-kerberos.c
+++ b/servers/exchange/lib/e2k-kerberos.c
@@ -58,6 +58,7 @@ krb5_result_to_e2k_kerberos_result (gint result)
 
 	case KRB5KRB_AP_ERR_BAD_INTEGRITY:
 	case KRB5KDC_ERR_PREAUTH_FAILED:
+	case KRB5KDC_ERR_CLIENT_REVOKED:
 		return E2K_KERBEROS_PASSWORD_INCORRECT;
 
 	case KRB5KDC_ERR_KEY_EXP:
@@ -71,6 +72,8 @@ krb5_result_to_e2k_kerberos_result (gint result)
 
 	default:
 		g_warning ("Unexpected kerberos error %d", result);
+
+	case KRB5_REALM_UNKNOWN:
 		return E2K_KERBEROS_FAILED;
 	}
 }
diff --git a/servers/exchange/storage/exchange-account.c b/servers/exchange/storage/exchange-account.c
index ab6f077..82e804a 100644
--- a/servers/exchange/storage/exchange-account.c
+++ b/servers/exchange/storage/exchange-account.c
@@ -1385,6 +1385,7 @@ exchange_account_connect (ExchangeAccount *account, const gchar *pword,
 	E2kGlobalCatalogEntry *entry;
 	E2kOperation gcop;
 	gchar *user_name = NULL;
+	gboolean tried_ntlm = FALSE, tried_basic = FALSE;
 
 	*info_result = EXCHANGE_ACCOUNT_UNKNOWN_ERROR;
 	g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL);
@@ -1442,6 +1443,9 @@ exchange_account_connect (ExchangeAccount *account, const gchar *pword,
 
 	e2k_autoconfig_set_password (ac, pword);
 
+	tried_basic = !ac->use_ntlm;
+	tried_ntlm = ac->use_ntlm;
+
  try_connect_again:
 	account->priv->ctx = e2k_autoconfig_get_context (ac, NULL, &result);
 
@@ -1477,16 +1481,27 @@ exchange_account_connect (ExchangeAccount *account, const gchar *pword,
 			return NULL;
 
 		case E2K_AUTOCONFIG_AUTH_ERROR_TRY_NTLM:
+			if (tried_ntlm)
+				break;
+
+			tried_ntlm = TRUE;
 			ac->use_ntlm = 1;
 			goto try_connect_again;
 
 		case E2K_AUTOCONFIG_AUTH_ERROR_TRY_BASIC:
+			if (tried_basic)
+				break;
+
+			tried_basic = TRUE;
 			ac->use_ntlm = 0;
 			goto try_connect_again;
 
 		case E2K_AUTOCONFIG_REDIRECT:
-			if (!redirected && account_moved (account, ac))
+			if (!redirected && account_moved (account, ac)) {
+				tried_basic = !ac->use_ntlm;
+				tried_ntlm = ac->use_ntlm;
 				goto try_connect_again;
+			}
 			break;
 
 		case E2K_AUTOCONFIG_TRY_SSL:



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