[evolution-ews] Bug #703181 - Book/calendar backends can authenticate without password
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Bug #703181 - Book/calendar backends can authenticate without password
- Date: Fri, 16 Aug 2013 14:26:17 +0000 (UTC)
commit addcca8b5803a3abcb532f52523962fae3fa0e11
Author: Milan Crha <mcrha redhat com>
Date: Fri Aug 16 16:25:44 2013 +0200
Bug #703181 - Book/calendar backends can authenticate without password
src/addressbook/e-book-backend-ews.c | 13 +++++++
src/calendar/e-cal-backend-ews.c | 13 +++++++
src/configuration/e-ews-config-utils.c | 9 +++++
src/configuration/e-mail-config-ews-autodiscover.c | 18 ++++++++-
.../e-mail-config-ews-delegates-page.c | 13 +++++++
.../e-mail-config-ews-oal-combo-box.c | 18 ++++++++-
src/configuration/e-mail-config-ews-ooo-page.c | 16 +++++++-
src/server/e-ews-connection.c | 39 +++++++++++++++++++-
src/server/e-ews-connection.h | 3 ++
9 files changed, 135 insertions(+), 7 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index ca54ee9..27ca4dd 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -3751,6 +3751,18 @@ e_book_backend_ews_dispose (GObject *object)
G_OBJECT_CLASS (e_book_backend_ews_parent_class)->dispose (object);
}
+static gboolean
+book_backend_ews_get_without_password (ESourceAuthenticator *authenticator)
+{
+ EBookBackendEws *ews_backend;
+ CamelEwsSettings *ews_settings;
+
+ ews_backend = E_BOOK_BACKEND_EWS (authenticator);
+ ews_settings = book_backend_ews_get_collection_settings (ews_backend);
+
+ return e_ews_connection_util_get_authentication_without_password (ews_settings);
+}
+
static ESourceAuthenticationResult
book_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
const GString *password,
@@ -3833,6 +3845,7 @@ e_book_backend_ews_class_init (EBookBackendEwsClass *klass)
static void
e_book_backend_ews_authenticator_init (ESourceAuthenticatorInterface *interface)
{
+ interface->get_without_password = book_backend_ews_get_without_password;
interface->try_password_sync = book_backend_ews_try_password_sync;
}
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index fe17ed6..366c398 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -4367,6 +4367,18 @@ e_cal_backend_ews_finalize (GObject *object)
G_OBJECT_CLASS (e_cal_backend_ews_parent_class)->finalize (object);
}
+static gboolean
+cal_backend_ews_get_without_password (ESourceAuthenticator *authenticator)
+{
+ ECalBackendEws *ews_backend;
+ CamelEwsSettings *ews_settings;
+
+ ews_backend = E_CAL_BACKEND_EWS (authenticator);
+ ews_settings = cal_backend_ews_get_collection_settings (ews_backend);
+
+ return e_ews_connection_util_get_authentication_without_password (ews_settings);
+}
+
static ESourceAuthenticationResult
cal_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
const GString *password,
@@ -4516,6 +4528,7 @@ e_cal_backend_ews_class_init (ECalBackendEwsClass *class)
static void
e_cal_backend_ews_authenticator_init (ESourceAuthenticatorInterface *interface)
{
+ interface->get_without_password = cal_backend_ews_get_without_password;
interface->try_password_sync = cal_backend_ews_try_password_sync;
}
diff --git a/src/configuration/e-ews-config-utils.c b/src/configuration/e-ews-config-utils.c
index 5f18f38..d288994 100644
--- a/src/configuration/e-ews-config-utils.c
+++ b/src/configuration/e-ews-config-utils.c
@@ -262,6 +262,14 @@ struct _EEwsConfigUtilsAuthenticatorClass {
GObjectClass parent_class;
};
+static gboolean
+ews_config_utils_authenticator_get_without_password (ESourceAuthenticator *authenticator)
+{
+ EEwsConfigUtilsAuthenticator *ews_authenticator = (EEwsConfigUtilsAuthenticator *) authenticator;
+
+ return e_ews_connection_util_get_authentication_without_password (ews_authenticator->ews_settings);
+}
+
static ESourceAuthenticationResult
ews_config_utils_authenticator_try_password_sync (ESourceAuthenticator *auth,
const GString *password,
@@ -365,6 +373,7 @@ e_ews_config_utils_authenticator_class_init (EEwsConfigUtilsAuthenticatorClass *
static void
e_ews_config_utils_authenticator_authenticator_init (ESourceAuthenticatorInterface *interface)
{
+ interface->get_without_password = ews_config_utils_authenticator_get_without_password;
interface->try_password_sync = ews_config_utils_authenticator_try_password_sync;
}
diff --git a/src/configuration/e-mail-config-ews-autodiscover.c
b/src/configuration/e-mail-config-ews-autodiscover.c
index 3c6987f..cf5b0ab 100644
--- a/src/configuration/e-mail-config-ews-autodiscover.c
+++ b/src/configuration/e-mail-config-ews-autodiscover.c
@@ -246,6 +246,20 @@ mail_config_ews_autodiscover_clicked (GtkButton *button)
mail_config_ews_autodiscover_run (autodiscover);
}
+static gboolean
+mail_config_ews_autodiscover_get_without_password (ESourceAuthenticator *authenticator)
+{
+ EMailConfigEwsAutodiscover *autodiscover;
+ EMailConfigServiceBackend *backend;
+ CamelSettings *settings;
+
+ autodiscover = E_MAIL_CONFIG_EWS_AUTODISCOVER (authenticator);
+ backend = e_mail_config_ews_autodiscover_get_backend (autodiscover);
+ settings = e_mail_config_service_backend_get_settings (backend);
+
+ return e_ews_connection_util_get_authentication_without_password (CAMEL_EWS_SETTINGS (settings));
+}
+
static ESourceAuthenticationResult
mail_config_ews_autodiscover_try_password_sync (ESourceAuthenticator *auth,
const GString *password,
@@ -321,8 +335,8 @@ e_mail_config_ews_autodiscover_class_init (EMailConfigEwsAutodiscoverClass *clas
static void
e_mail_config_ews_autodiscover_authenticator_init (ESourceAuthenticatorInterface *interface)
{
- interface->try_password_sync =
- mail_config_ews_autodiscover_try_password_sync;
+ interface->get_without_password = mail_config_ews_autodiscover_get_without_password;
+ interface->try_password_sync = mail_config_ews_autodiscover_try_password_sync;
}
static void
diff --git a/src/configuration/e-mail-config-ews-delegates-page.c
b/src/configuration/e-mail-config-ews-delegates-page.c
index f6c6adb..e32a67c 100644
--- a/src/configuration/e-mail-config-ews-delegates-page.c
+++ b/src/configuration/e-mail-config-ews-delegates-page.c
@@ -1510,6 +1510,18 @@ sort_by_display_name_cb (gconstpointer a,
return g_utf8_collate (aname, bname);
}
+static gboolean
+mail_config_ews_delegates_page_get_without_password (ESourceAuthenticator *authenticator)
+{
+ EMailConfigEwsDelegatesPage *page;
+ CamelSettings *settings;
+
+ page = E_MAIL_CONFIG_EWS_DELEGATES_PAGE (authenticator);
+ settings = mail_config_ews_delegates_page_get_settings (page);
+
+ return e_ews_connection_util_get_authentication_without_password (CAMEL_EWS_SETTINGS (settings));
+}
+
static ESourceAuthenticationResult
mail_config_ews_delegates_page_try_password_sync (ESourceAuthenticator *auth,
const GString *password,
@@ -1644,6 +1656,7 @@ e_mail_config_ews_delegates_page_interface_init (EMailConfigPageInterface *inter
static void
e_mail_config_ews_delegates_page_authenticator_init (ESourceAuthenticatorInterface *interface)
{
+ interface->get_without_password = mail_config_ews_delegates_page_get_without_password;
interface->try_password_sync = mail_config_ews_delegates_page_try_password_sync;
}
diff --git a/src/configuration/e-mail-config-ews-oal-combo-box.c
b/src/configuration/e-mail-config-ews-oal-combo-box.c
index 7a03275..a6c3142 100644
--- a/src/configuration/e-mail-config-ews-oal-combo-box.c
+++ b/src/configuration/e-mail-config-ews-oal-combo-box.c
@@ -135,6 +135,20 @@ mail_config_ews_oal_combo_box_finalize (GObject *object)
finalize (object);
}
+static gboolean
+mail_config_ews_oal_combo_box_get_without_password (ESourceAuthenticator *authenticator)
+{
+ EMailConfigEwsOalComboBox *combo_box;
+ EMailConfigServiceBackend *backend;
+ CamelSettings *settings;
+
+ combo_box = E_MAIL_CONFIG_EWS_OAL_COMBO_BOX (authenticator);
+ backend = e_mail_config_ews_oal_combo_box_get_backend (combo_box);
+ settings = e_mail_config_service_backend_get_settings (backend);
+
+ return e_ews_connection_util_get_authentication_without_password (CAMEL_EWS_SETTINGS (settings));
+}
+
static ESourceAuthenticationResult
mail_config_ews_oal_combo_box_try_password_sync (ESourceAuthenticator *auth,
const GString *password,
@@ -219,8 +233,8 @@ e_mail_config_ews_oal_combo_box_class_init (EMailConfigEwsOalComboBoxClass *clas
static void
e_mail_config_ews_oal_combo_box_authenticator_init (ESourceAuthenticatorInterface *interface)
{
- interface->try_password_sync =
- mail_config_ews_oal_combo_box_try_password_sync;
+ interface->get_without_password = mail_config_ews_oal_combo_box_get_without_password;
+ interface->try_password_sync = mail_config_ews_oal_combo_box_try_password_sync;
}
static void
diff --git a/src/configuration/e-mail-config-ews-ooo-page.c b/src/configuration/e-mail-config-ews-ooo-page.c
index acc958d..a88b51c 100644
--- a/src/configuration/e-mail-config-ews-ooo-page.c
+++ b/src/configuration/e-mail-config-ews-ooo-page.c
@@ -800,6 +800,18 @@ mail_config_ews_ooo_page_submit_finish (EMailConfigPage *page,
return !g_simple_async_result_propagate_error (simple, error);
}
+static gboolean
+mail_config_ews_ooo_page_get_without_password (ESourceAuthenticator *authenticator)
+{
+ EMailConfigEwsOooPage *page;
+ CamelSettings *settings;
+
+ page = E_MAIL_CONFIG_EWS_OOO_PAGE (authenticator);
+ settings = mail_config_ews_ooo_page_get_settings (page);
+
+ return e_ews_connection_util_get_authentication_without_password (CAMEL_EWS_SETTINGS (settings));
+}
+
static ESourceAuthenticationResult
mail_config_ews_ooo_page_try_password_sync (ESourceAuthenticator *auth,
const GString *password,
@@ -929,8 +941,8 @@ e_mail_config_ews_ooo_page_interface_init (EMailConfigPageInterface *interface)
static void
e_mail_config_ews_ooo_page_authenticator_init (ESourceAuthenticatorInterface *interface)
{
- interface->try_password_sync =
- mail_config_ews_ooo_page_try_password_sync;
+ interface->get_without_password = mail_config_ews_ooo_page_get_without_password;
+ interface->try_password_sync = mail_config_ews_ooo_page_try_password_sync;
}
static void
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index ad9f1e4..38e0263 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -1417,6 +1417,41 @@ ews_connection_finalize (GObject *object)
G_OBJECT_CLASS (e_ews_connection_parent_class)->finalize (object);
}
+gboolean
+e_ews_connection_util_get_authentication_without_password (CamelEwsSettings *ews_settings)
+{
+ gboolean auth_without_password;
+ gchar *auth_mechanism;
+
+ g_return_val_if_fail (CAMEL_IS_EWS_SETTINGS (ews_settings), FALSE);
+
+ auth_mechanism = camel_network_settings_dup_auth_mechanism (
+ CAMEL_NETWORK_SETTINGS (ews_settings));
+
+ /* the other one is currently NTLM */
+ auth_without_password = g_strcmp0 (auth_mechanism, "PLAIN") != 0;
+
+ g_free (auth_mechanism);
+
+ return auth_without_password;
+}
+
+static gboolean
+ews_connection_get_without_password (ESourceAuthenticator *authenticator)
+{
+ CamelEwsSettings *ews_settings;
+ gboolean auth_without_password;
+
+ ews_settings = e_ews_connection_ref_settings (E_EWS_CONNECTION (authenticator));
+ g_return_val_if_fail (ews_settings != NULL, FALSE);
+
+ auth_without_password = e_ews_connection_util_get_authentication_without_password (ews_settings);
+
+ g_clear_object (&ews_settings);
+
+ return auth_without_password;
+}
+
static ESourceAuthenticationResult
ews_connection_try_password_sync (ESourceAuthenticator *authenticator,
const GString *password,
@@ -1463,6 +1498,7 @@ ews_connection_try_password_sync (ESourceAuthenticator *authenticator,
}
e_ews_connection_set_password (connection, NULL);
+ ews_connection_schedule_abort (connection);
}
return result;
@@ -1508,6 +1544,7 @@ e_ews_connection_class_init (EEwsConnectionClass *class)
static void
e_ews_connection_authenticator_init (ESourceAuthenticatorInterface *interface)
{
+ interface->get_without_password = ews_connection_get_without_password;
interface->try_password_sync = ews_connection_try_password_sync;
}
@@ -1970,7 +2007,7 @@ e_ews_connection_set_password (EEwsConnection *cnc,
memset (cnc->priv->password, 0, strlen (cnc->priv->password));
g_free (cnc->priv->password);
- cnc->priv->password = g_strdup (password);
+ cnc->priv->password = g_strdup ((password && *password) ? password : NULL);
g_mutex_unlock (&cnc->priv->password_lock);
diff --git a/src/server/e-ews-connection.h b/src/server/e-ews-connection.h
index 53d3fc7..db418d7 100644
--- a/src/server/e-ews-connection.h
+++ b/src/server/e-ews-connection.h
@@ -211,6 +211,9 @@ void ews_oal_details_free (EwsOALDetails *details);
void e_ews_connection_utils_unref_in_thread
(gpointer object);
+gboolean e_ews_connection_util_get_authentication_without_password
+ (CamelEwsSettings *ews_settings);
+
GType e_ews_connection_get_type (void);
EEwsConnection *e_ews_connection_new (const gchar *uri,
CamelEwsSettings *settings);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]