[evolution-ews] Bug 732850 - GSSAPI authentication doesn't need a password



commit 78afd10aa511192ff039d1668e1cb4eae0bb5b5b
Author: Daniel Sands <dnsands sandia gov>
Date:   Tue Jul 22 16:38:46 2014 +0100

    Bug 732850 - GSSAPI authentication doesn't need a password
    
    Add get_without_password() method for EWS sources, and make it return
    TRUE for GSSAPI authentication.

 src/addressbook/e-book-backend-ews.c               |   14 ++++++++++++++
 src/calendar/e-cal-backend-ews.c                   |   14 ++++++++++++++
 src/configuration/e-ews-config-utils.c             |   13 ++++++++++++-
 src/configuration/e-mail-config-ews-autodiscover.c |   19 +++++++++++++++++++
 .../e-mail-config-ews-delegates-page.c             |   20 +++++++++++++++++++-
 .../e-mail-config-ews-oal-combo-box.c              |   20 ++++++++++++++++++++
 src/configuration/e-mail-config-ews-ooo-page.c     |   17 +++++++++++++++++
 src/server/e-ews-connection-utils.c                |   16 ++++++++++++++++
 src/server/e-ews-connection-utils.h                |    3 +++
 src/server/e-ews-connection.c                      |   14 ++++++++++++++
 10 files changed, 148 insertions(+), 2 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index 5e05a2c..66e2299 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -43,6 +43,7 @@
 #include "server/e-ews-item-change.h"
 #include "server/e-ews-message.h"
 #include "server/e-ews-connection.h"
+#include "server/e-ews-connection-utils.h"
 #include "server/e-ews-item.h"
 #include "server/e-source-ews-folder.h"
 
@@ -4012,6 +4013,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 *backend;
+       CamelEwsSettings *ews_settings;
+
+       backend = E_BOOK_BACKEND_EWS (authenticator);
+       ews_settings = book_backend_ews_get_collection_settings (backend);
+
+       return e_ews_connection_utils_get_without_password (ews_settings);
+}
+
 static ESourceAuthenticationResult
 book_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
                                     const GString *password,
@@ -4097,6 +4110,7 @@ e_book_backend_ews_class_init (EBookBackendEwsClass *klass)
 static void
 e_book_backend_ews_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
+       iface->get_without_password = book_backend_ews_get_without_password;
        iface->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 a9fc25e..df01c84 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -43,6 +43,7 @@
 #include <calendar/gui/itip-utils.h>
 
 #include "server/e-source-ews-folder.h"
+#include "server/e-ews-connection-utils.h"
 
 #include "utils/ews-camel-common.h"
 
@@ -4204,6 +4205,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 *backend;
+       CamelEwsSettings *ews_settings;
+
+       backend = E_CAL_BACKEND_EWS (authenticator);
+       ews_settings = cal_backend_ews_get_collection_settings (backend);
+
+       return e_ews_connection_utils_get_without_password (ews_settings);
+}
+
 static ESourceAuthenticationResult
 cal_backend_ews_try_password_sync (ESourceAuthenticator *authenticator,
                                    const GString *password,
@@ -4296,6 +4309,7 @@ e_cal_backend_ews_class_init (ECalBackendEwsClass *class)
 static void
 e_cal_backend_ews_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
+       iface->get_without_password = cal_backend_ews_get_without_password;
        iface->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 b7201be..89cd651 100644
--- a/src/configuration/e-ews-config-utils.c
+++ b/src/configuration/e-ews-config-utils.c
@@ -37,6 +37,7 @@
 #include <shell/e-shell-window.h>
 
 #include "server/e-ews-connection.h"
+#include "server/e-ews-connection-utils.h"
 #include "server/e-source-ews-folder.h"
 
 #include "e-ews-edit-folder-permissions.h"
@@ -265,6 +266,13 @@ struct _EEwsConfigUtilsAuthenticatorClass {
        GObjectClass parent_class;
 };
 
+static gboolean
+ews_config_utils_authenticator_get_without_password (ESourceAuthenticator *auth)
+{
+       EEwsConfigUtilsAuthenticator *authenticator = (EEwsConfigUtilsAuthenticator *) auth;
+       return e_ews_connection_utils_get_without_password (authenticator->ews_settings);
+}
+
 static ESourceAuthenticationResult
 ews_config_utils_authenticator_try_password_sync (ESourceAuthenticator *auth,
                                                   const GString *password,
@@ -359,7 +367,10 @@ e_ews_config_utils_authenticator_class_init (EEwsConfigUtilsAuthenticatorClass *
 static void
 e_ews_config_utils_authenticator_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
-       iface->try_password_sync = ews_config_utils_authenticator_try_password_sync;
+       iface->get_without_password =
+               ews_config_utils_authenticator_get_without_password;
+       iface->try_password_sync =
+               ews_config_utils_authenticator_try_password_sync;
 }
 
 static void
diff --git a/src/configuration/e-mail-config-ews-autodiscover.c 
b/src/configuration/e-mail-config-ews-autodiscover.c
index ad7878f..f8485c7 100644
--- a/src/configuration/e-mail-config-ews-autodiscover.c
+++ b/src/configuration/e-mail-config-ews-autodiscover.c
@@ -27,6 +27,7 @@
 #include <mail/e-mail-config-service-page.h>
 
 #include "server/e-ews-connection.h"
+#include "server/e-ews-connection-utils.h"
 
 #define E_MAIL_CONFIG_EWS_AUTODISCOVER_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
@@ -245,6 +246,22 @@ mail_config_ews_autodiscover_clicked (GtkButton *button)
        mail_config_ews_autodiscover_run (autodiscover);
 }
 
+static gboolean
+mail_config_ews_autodiscover_get_without_password (ESourceAuthenticator *auth)
+{
+       EMailConfigEwsAutodiscover *autodiscover;
+       EMailConfigServiceBackend *backend;
+       CamelSettings *settings;
+       CamelEwsSettings *ews_settings;
+
+       autodiscover = E_MAIL_CONFIG_EWS_AUTODISCOVER (auth);
+       backend = e_mail_config_ews_autodiscover_get_backend (autodiscover);
+       settings = e_mail_config_service_backend_get_settings (backend);
+       ews_settings = CAMEL_EWS_SETTINGS (settings);
+
+       return e_ews_connection_utils_get_without_password (ews_settings);
+}
+
 static ESourceAuthenticationResult
 mail_config_ews_autodiscover_try_password_sync (ESourceAuthenticator *auth,
                                                 const GString *password,
@@ -320,6 +337,8 @@ e_mail_config_ews_autodiscover_class_init (EMailConfigEwsAutodiscoverClass *clas
 static void
 e_mail_config_ews_autodiscover_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
+       iface->get_without_password =
+               mail_config_ews_autodiscover_get_without_password;
        iface->try_password_sync =
                mail_config_ews_autodiscover_try_password_sync;
 }
diff --git a/src/configuration/e-mail-config-ews-delegates-page.c 
b/src/configuration/e-mail-config-ews-delegates-page.c
index 935bf17..ced835b 100644
--- a/src/configuration/e-mail-config-ews-delegates-page.c
+++ b/src/configuration/e-mail-config-ews-delegates-page.c
@@ -31,6 +31,7 @@
 
 #include "server/camel-ews-settings.h"
 #include "server/e-ews-connection.h"
+#include "server/e-ews-connection-utils.h"
 #include "server/e-ews-oof-settings.h"
 #include "camel/camel-ews-store.h"
 
@@ -1498,6 +1499,20 @@ sort_by_display_name_cb (gconstpointer a,
        return g_utf8_collate (aname, bname);
 }
 
+static gboolean
+mail_config_ews_delegates_page_get_without_password (ESourceAuthenticator *auth)
+{
+       EMailConfigEwsDelegatesPage *page;
+       CamelSettings *settings;
+       CamelEwsSettings *ews_settings;
+
+       page = E_MAIL_CONFIG_EWS_DELEGATES_PAGE (auth);
+       settings = mail_config_ews_delegates_page_get_settings (page);
+       ews_settings = CAMEL_EWS_SETTINGS (settings);
+
+       return e_ews_connection_utils_get_without_password (ews_settings);
+}
+
 static ESourceAuthenticationResult
 mail_config_ews_delegates_page_try_password_sync (ESourceAuthenticator *auth,
                                                   const GString *password,
@@ -1635,7 +1650,10 @@ e_mail_config_ews_delegates_page_interface_init (EMailConfigPageInterface *iface
 static void
 e_mail_config_ews_delegates_page_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
-       iface->try_password_sync = mail_config_ews_delegates_page_try_password_sync;
+       iface->get_without_password =
+               mail_config_ews_delegates_page_get_without_password;
+       iface->try_password_sync =
+               mail_config_ews_delegates_page_try_password_sync;
 }
 
 static void
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 4018b7b..1dcef79 100644
--- a/src/configuration/e-mail-config-ews-oal-combo-box.c
+++ b/src/configuration/e-mail-config-ews-oal-combo-box.c
@@ -25,6 +25,7 @@
 #include <mail/e-mail-config-service-page.h>
 
 #include "server/e-ews-connection.h"
+#include "server/e-ews-connection-utils.h"
 
 #define E_MAIL_CONFIG_EWS_OAL_COMBO_BOX_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
@@ -135,6 +136,23 @@ mail_config_ews_oal_combo_box_finalize (GObject *object)
                finalize (object);
 }
 
+static gboolean
+mail_config_ews_oal_combo_box_get_without_password (ESourceAuthenticator *auth)
+{
+       EMailConfigEwsOalComboBox *combo_box;
+       EMailConfigServiceBackend *backend;
+       CamelSettings *settings;
+       CamelEwsSettings *ews_settings;
+
+       combo_box = E_MAIL_CONFIG_EWS_OAL_COMBO_BOX (auth);
+       backend = e_mail_config_ews_oal_combo_box_get_backend (combo_box);
+       settings = e_mail_config_service_backend_get_settings (backend);
+
+       ews_settings = CAMEL_EWS_SETTINGS (settings);
+
+       return e_ews_connection_utils_get_without_password (ews_settings);
+}
+
 static ESourceAuthenticationResult
 mail_config_ews_oal_combo_box_try_password_sync (ESourceAuthenticator *auth,
                                                  const GString *password,
@@ -219,6 +237,8 @@ e_mail_config_ews_oal_combo_box_class_init (EMailConfigEwsOalComboBoxClass *clas
 static void
 e_mail_config_ews_oal_combo_box_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
+       iface->get_without_password =
+               mail_config_ews_oal_combo_box_get_without_password;
        iface->try_password_sync =
                mail_config_ews_oal_combo_box_try_password_sync;
 }
diff --git a/src/configuration/e-mail-config-ews-ooo-page.c b/src/configuration/e-mail-config-ews-ooo-page.c
index 4c72a0f..d1a190f 100644
--- a/src/configuration/e-mail-config-ews-ooo-page.c
+++ b/src/configuration/e-mail-config-ews-ooo-page.c
@@ -32,6 +32,7 @@
 
 #include "server/camel-ews-settings.h"
 #include "server/e-ews-connection.h"
+#include "server/e-ews-connection-utils.h"
 #include "server/e-ews-oof-settings.h"
 
 #define E_MAIL_CONFIG_EWS_OOO_PAGE_GET_PRIVATE(obj) \
@@ -789,6 +790,20 @@ 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 *auth)
+{
+       EMailConfigEwsOooPage *page;
+       CamelSettings *settings;
+       CamelEwsSettings *ews_settings;
+
+       page = E_MAIL_CONFIG_EWS_OOO_PAGE (auth);
+       settings = mail_config_ews_ooo_page_get_settings (page);
+       ews_settings = CAMEL_EWS_SETTINGS (settings);
+
+       return e_ews_connection_utils_get_without_password (ews_settings);
+}
+
 static ESourceAuthenticationResult
 mail_config_ews_ooo_page_try_password_sync (ESourceAuthenticator *auth,
                                             const GString *password,
@@ -921,6 +936,8 @@ e_mail_config_ews_ooo_page_interface_init (EMailConfigPageInterface *iface)
 static void
 e_mail_config_ews_ooo_page_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
+       iface->get_without_password =
+               mail_config_ews_ooo_page_get_without_password;
        iface->try_password_sync =
                mail_config_ews_ooo_page_try_password_sync;
 }
diff --git a/src/server/e-ews-connection-utils.c b/src/server/e-ews-connection-utils.c
index e01a316..1c1f3ec 100644
--- a/src/server/e-ews-connection-utils.c
+++ b/src/server/e-ews-connection-utils.c
@@ -241,4 +241,20 @@ e_ews_connection_utils_check_element (const gchar *function_name,
        return TRUE;
 }
 
+/* Return TRUE if using GSSAPI.  */
+gboolean
+e_ews_connection_utils_get_without_password (CamelEwsSettings *ews_settings)
+{
+       gboolean result = FALSE;
+       gchar *auth_mech = NULL;
+
+       g_object_get (G_OBJECT (ews_settings), "auth-mechanism", &auth_mech,
+                     NULL);
 
+       if (g_strcmp0 (auth_mech, "GSSAPI") == 0)
+               result = TRUE;
+
+       g_free (auth_mech);
+
+       return result;
+}
diff --git a/src/server/e-ews-connection-utils.h b/src/server/e-ews-connection-utils.h
index 7cc2022..12479ba 100644
--- a/src/server/e-ews-connection-utils.h
+++ b/src/server/e-ews-connection-utils.h
@@ -41,6 +41,9 @@ gboolean      e_ews_connection_utils_check_element    (const gchar *function_name,
                                                         const gchar *element_name,
                                                         const gchar *expected_name);
 
+gboolean       e_ews_connection_utils_get_without_password
+                                                       (CamelEwsSettings *ews_settings);
+
 G_END_DECLS
 
 #endif /* E_EWS_CONNECTION_UTILS_H */
diff --git a/src/server/e-ews-connection.c b/src/server/e-ews-connection.c
index eedb5dd..998265d 100644
--- a/src/server/e-ews-connection.c
+++ b/src/server/e-ews-connection.c
@@ -488,6 +488,19 @@ typedef struct _EwsScheduleData
        gpointer queue_user_data;
 } EwsScheduleData;
 
+static gboolean
+ews_connection_get_without_password (ESourceAuthenticator *authenticator)
+{
+       gboolean result;
+       EEwsConnection *cnc = E_EWS_CONNECTION (authenticator);
+       CamelEwsSettings *ews_settings = e_ews_connection_ref_settings (cnc);
+
+       result = e_ews_connection_utils_get_without_password (ews_settings);
+
+       g_object_unref (ews_settings);
+       return result;
+}
+
 /* this is run in priv->soup_thread */
 static gboolean
 ews_connection_scheduled_cb (gpointer user_data)
@@ -1751,6 +1764,7 @@ e_ews_connection_folders_list_free (gpointer data)
 static void
 e_ews_connection_authenticator_init (ESourceAuthenticatorInterface *iface)
 {
+       iface->get_without_password = ews_connection_get_without_password;
        iface->try_password_sync = ews_connection_try_password_sync;
 }
 


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