[evolution-data-server] [CalDAV] Backend not initialized when asked to authenticate



commit 749194f631692a8796d609bdf13555d67c7f1e80
Author: Milan Crha <mcrha redhat com>
Date:   Wed Apr 13 15:52:23 2016 +0200

    [CalDAV] Backend not initialized when asked to authenticate
    
    There could happen a race condition where one thread was opening
    the calendar, but another thread was processing an authentication
    request and that later thread won the race for the busy_lock, but
    the backend wasn't initialized, thus the priv->uri was still NULL
    and a runtime warning:
    > soup_message_new: assertion 'uri_string != NULL' failed
    had been printed on the factory console. The reason was that
    the collection backend called authenticate for its children. Count
    with this case and initialize the backend when needed, rather than
    fake-fail or fake-reject the credentials in the authenticate callback,
    because the fake response can have side effects on the credentials.

 calendar/backends/caldav/e-cal-backend-caldav.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index a79ec36..94e2cce 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -2809,8 +2809,8 @@ initialize_backend (ECalBackendCalDAV *cbdav,
        if (!g_signal_handler_find (G_OBJECT (source), G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, 
caldav_source_changed_cb, cbdav))
                g_signal_connect (G_OBJECT (source), "changed", G_CALLBACK (caldav_source_changed_cb), cbdav);
 
+       cbdav->priv->loaded = TRUE;
        cbdav->priv->do_offline = e_source_offline_get_stay_synchronized (offline_extension);
-
        cbdav->priv->auth_required = e_source_authentication_required (auth_extension);
 
        soup_uri = e_source_webdav_dup_soup_uri (webdav_extension);
@@ -2937,6 +2937,9 @@ open_calendar_wrapper (ECalBackendCalDAV *cbdav,
 
        g_return_val_if_fail (cbdav != NULL, FALSE);
 
+       if (!cbdav->priv->loaded && !initialize_backend (cbdav, error))
+               return FALSE;
+
        if (!caldav_maybe_prepare_bearer_auth (cbdav, cancellable, error))
                return FALSE;
 
@@ -3019,7 +3022,6 @@ caldav_do_open (ECalBackendSync *backend,
                return;
        }
 
-       cbdav->priv->loaded = TRUE;
        cbdav->priv->opened = TRUE;
        cbdav->priv->is_google = FALSE;
 


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