diff -up evolution-data-server-3.12.11/calendar/backends/caldav/e-cal-backend-caldav.c.caldav-password-ask-for-oauth evolution-data-server-3.12.11/calendar/backends/caldav/e-cal-backend-caldav.c
--- evolution-data-server-3.12.11/calendar/backends/caldav/e-cal-backend-caldav.c.caldav-password-ask-for-oauth 2015-08-21 21:19:05.100977813 +0200
+++ evolution-data-server-3.12.11/calendar/backends/caldav/e-cal-backend-caldav.c 2015-08-21 21:19:23.430977037 +0200
@@ -130,6 +130,7 @@ struct _ECalBackendCalDAVPrivate {
* message than a generic 401 description. */
GError *bearer_auth_error;
GMutex bearer_auth_error_lock;
+ gboolean using_bearer_auth;
};
/* Forward Declarations */
@@ -558,6 +559,7 @@ status_code_to_result (SoupMessage *mess
GError **perror)
{
ECalBackendCalDAVPrivate *priv;
+ gchar *uri;
g_return_val_if_fail (cbdav != NULL, FALSE);
g_return_val_if_fail (message != NULL, FALSE);
@@ -616,14 +618,17 @@ status_code_to_result (SoupMessage *mess
default:
d (g_debug ("CalDAV:%s: Unhandled status code %d\n", G_STRFUNC, status_code));
+ uri = soup_uri_to_string (soup_message_get_uri (message), FALSE);
g_propagate_error (
perror,
e_data_cal_create_error_fmt (
OtherError,
- _("Unexpected HTTP status code %d returned (%s)"),
+ _("Unexpected HTTP status code %d returned (%s) for URI: %s"),
message->status_code,
message->reason_phrase && *message->reason_phrase ? message->reason_phrase :
- (soup_status_get_phrase (message->status_code) ? soup_status_get_phrase (message->status_code) : _("Unknown error"))));
+ (soup_status_get_phrase (message->status_code) ? soup_status_get_phrase (message->status_code) : _("Unknown error")),
+ uri ? uri : "[null]"));
+ g_free (uri);
break;
}
@@ -1039,12 +1044,14 @@ soup_authenticate (SoupSession *session,
extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
auth_extension = e_source_get_extension (source, extension_name);
+ cbdav->priv->using_bearer_auth = E_IS_SOUP_AUTH_BEARER (auth);
+
if (retrying || cbdav->priv->force_ask_password) {
- cbdav->priv->force_ask_password = TRUE;
+ cbdav->priv->force_ask_password = !cbdav->priv->using_bearer_auth;
return;
}
- if (E_IS_SOUP_AUTH_BEARER (auth)) {
+ if (cbdav->priv->using_bearer_auth) {
soup_authenticate_bearer (session, msg, auth, cbdav);
/* do not send same password twice, but keep it for later use */
@@ -5190,7 +5197,7 @@ caldav_try_password_sync (ESourceAuthent
/* Busy lock is already acquired by caldav_do_open(). */
- if (cbdav->priv->force_ask_password) {
+ if (cbdav->priv->force_ask_password && !cbdav->priv->using_bearer_auth) {
cbdav->priv->force_ask_password = FALSE;
return E_SOURCE_AUTHENTICATION_REJECTED;
}
@@ -5202,7 +5209,7 @@ caldav_try_password_sync (ESourceAuthent
if (local_error == NULL) {
result = E_SOURCE_AUTHENTICATION_ACCEPTED;
- } else if (g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationFailed)) {
+ } else if (!cbdav->priv->using_bearer_auth && g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationFailed)) {
result = E_SOURCE_AUTHENTICATION_REJECTED;
g_clear_error (&local_error);
} else {