[evolution-ews] Bug 763455 - Server-side password change doesn't reconnect book/calendar
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Bug 763455 - Server-side password change doesn't reconnect book/calendar
- Date: Thu, 1 Mar 2018 12:53:53 +0000 (UTC)
commit 9beee4069cbe3749f1f22033b16b4b70fd16a0d2
Author: Milan Crha <mcrha redhat com>
Date: Thu Mar 1 13:54:59 2018 +0100
Bug 763455 - Server-side password change doesn't reconnect book/calendar
src/addressbook/e-book-backend-ews.c | 18 ++++++++++++++++++
src/calendar/e-cal-backend-ews.c | 23 +++++++++++++++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index e521f36..79d6f34 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -149,6 +149,19 @@ ebb_ews_convert_error_to_edb_error (GError **perror)
}
}
+static void
+ebb_ews_maybe_disconnect_sync (EBookBackendEws *bbews,
+ GError **in_perror,
+ GCancellable *cancellable)
+{
+ g_return_if_fail (E_IS_BOOK_BACKEND_EWS (bbews));
+
+ if (in_perror && g_error_matches (*in_perror, E_DATA_BOOK_ERROR,
E_DATA_BOOK_STATUS_AUTHENTICATION_FAILED)) {
+ e_book_meta_backend_disconnect_sync (E_BOOK_META_BACKEND (bbews), cancellable, NULL);
+ e_backend_schedule_credentials_required (E_BACKEND (bbews),
E_SOURCE_CREDENTIALS_REASON_REJECTED, NULL, 0, NULL, NULL, G_STRFUNC);
+ }
+}
+
static const struct phone_field_mapping {
EContactField field;
const gchar *element;
@@ -2633,6 +2646,7 @@ ebb_ews_update_cache_for_expression (EBookBackendEws *bbews,
g_rec_mutex_unlock (&bbews->priv->cnc_lock);
ebb_ews_convert_error_to_edb_error (error);
+ ebb_ews_maybe_disconnect_sync (bbews, error, cancellable);
return success;
}
@@ -3024,6 +3038,7 @@ ebb_ews_get_changes_sync (EBookMetaBackend *meta_backend,
g_rec_mutex_unlock (&bbews->priv->cnc_lock);
ebb_ews_convert_error_to_edb_error (error);
+ ebb_ews_maybe_disconnect_sync (bbews, error, cancellable);
g_clear_object (&book_cache);
@@ -3079,6 +3094,7 @@ ebb_ews_load_contact_sync (EBookMetaBackend *meta_backend,
g_slist_free_full (items, g_object_unref);
ebb_ews_convert_error_to_edb_error (error);
+ ebb_ews_maybe_disconnect_sync (bbews, error, cancellable);
return success;
}
@@ -3219,6 +3235,7 @@ ebb_ews_save_contact_sync (EBookMetaBackend *meta_backend,
g_rec_mutex_unlock (&bbews->priv->cnc_lock);
ebb_ews_convert_error_to_edb_error (error);
+ ebb_ews_maybe_disconnect_sync (bbews, error, cancellable);
return success;
}
@@ -3251,6 +3268,7 @@ ebb_ews_remove_contact_sync (EBookMetaBackend *meta_backend,
g_rec_mutex_unlock (&bbews->priv->cnc_lock);
ebb_ews_convert_error_to_edb_error (error);
+ ebb_ews_maybe_disconnect_sync (bbews, error, cancellable);
return success;
}
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 9efd5f5..268955b 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -184,6 +184,19 @@ ecb_ews_convert_error_to_edc_error (GError **perror)
}
static void
+ecb_ews_maybe_disconnect_sync (ECalBackendEws *cbews,
+ GError **in_perror,
+ GCancellable *cancellable)
+{
+ g_return_if_fail (E_IS_CAL_BACKEND_EWS (cbews));
+
+ if (in_perror && g_error_matches (*in_perror, E_DATA_CAL_ERROR, AuthenticationFailed)) {
+ e_cal_meta_backend_disconnect_sync (E_CAL_META_BACKEND (cbews), cancellable, NULL);
+ e_backend_schedule_credentials_required (E_BACKEND (cbews),
E_SOURCE_CREDENTIALS_REASON_REJECTED, NULL, 0, NULL, NULL, G_STRFUNC);
+ }
+}
+
+static void
ecb_ews_server_notification_cb (ECalBackendEws *cbews,
GSList *events,
EEwsConnection *cnc)
@@ -1735,6 +1748,7 @@ ecb_ews_get_changes_sync (ECalMetaBackend *meta_backend,
g_rec_mutex_unlock (&cbews->priv->cnc_lock);
ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
g_clear_object (&cal_cache);
return success;
@@ -1821,6 +1835,7 @@ ecb_ews_load_component_sync (ECalMetaBackend *meta_backend,
g_rec_mutex_unlock (&cbews->priv->cnc_lock);
ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
g_slist_free_full (components, g_object_unref);
g_slist_free_full (items, g_object_unref);
@@ -2710,6 +2725,7 @@ ecb_ews_save_component_sync (ECalMetaBackend *meta_backend,
e_ews_folder_id_free (fid);
ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
return success;
}
@@ -2753,6 +2769,7 @@ ecb_ews_remove_component_sync (ECalMetaBackend *meta_backend,
g_rec_mutex_unlock (&cbews->priv->cnc_lock);
ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
g_object_unref (comp);
return success;
@@ -2841,6 +2858,7 @@ ecb_ews_discard_alarm_sync (ECalBackendSync *cal_backend_sync,
g_free (convert_data.change_key);
ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
}
static gboolean
@@ -3439,6 +3457,9 @@ ecb_ews_receive_objects_sync (ECalBackendSync *sync_backend,
if (success && do_refresh)
e_cal_meta_backend_schedule_refresh (E_CAL_META_BACKEND (cbews));
+
+ ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
}
static void
@@ -3528,6 +3549,7 @@ ecb_ews_send_objects_sync (ECalBackendSync *sync_backend,
icalcomponent_free (icalcomp);
ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
}
static void
@@ -3593,6 +3615,7 @@ ecb_ews_get_free_busy_sync (ECalBackendSync *sync_backend,
g_slist_free_full (freebusy, (GDestroyNotify) icalcomponent_free);
ecb_ews_convert_error_to_edc_error (error);
+ ecb_ews_maybe_disconnect_sync (cbews, error, cancellable);
}
static gchar *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]