[evolution-data-server/gnome-3-16] [CalDAV] Claim error when user name is missing for authentication
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-16] [CalDAV] Claim error when user name is missing for authentication
- Date: Mon, 23 Mar 2015 16:56:35 +0000 (UTC)
commit 948932872d5ba21d2b6f7860d84b4f680a0a55ef
Author: Milan Crha <mcrha redhat com>
Date: Mon Mar 23 14:01:25 2015 +0100
[CalDAV] Claim error when user name is missing for authentication
The missing user name could cause repeated tries to authenticate
to the server, which was only a ping to the server, returned
auth-required and the connection close, because of no user name,
even the password could be provided.
calendar/backends/caldav/e-cal-backend-caldav.c | 31 ++++++++++++++++++----
1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index 4e1693e..fa90ce1 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -5417,12 +5417,31 @@ caldav_authenticate_sync (EBackend *backend,
g_cond_signal (&cbdav->priv->cond);
} else if (g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationFailed) ||
g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationRequired)) {
- if (!e_named_parameters_get (credentials, E_SOURCE_CREDENTIAL_PASSWORD) ||
- g_error_matches (local_error, E_DATA_CAL_ERROR, AuthenticationRequired))
- result = E_SOURCE_AUTHENTICATION_REQUIRED;
- else
- result = E_SOURCE_AUTHENTICATION_REJECTED;
- g_clear_error (&local_error);
+ gchar *auth_user = NULL;
+
+ if (!username || !*username) {
+ ESource *source;
+ ESourceAuthentication *auth_extension;
+
+ source = e_backend_get_source (backend);
+ auth_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_AUTHENTICATION);
+ auth_user = e_source_authentication_dup_user (auth_extension);
+
+ username = auth_user;
+ }
+
+ if (username && *username) {
+ if (!e_named_parameters_get (credentials, E_SOURCE_CREDENTIAL_PASSWORD))
+ result = E_SOURCE_AUTHENTICATION_REQUIRED;
+ else
+ result = E_SOURCE_AUTHENTICATION_REJECTED;
+ g_clear_error (&local_error);
+ } else {
+ result = E_SOURCE_AUTHENTICATION_ERROR;
+ g_propagate_error (error, local_error);
+ }
+
+ g_free (auth_user);
} else if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_SSL_FAILED)) {
result = E_SOURCE_AUTHENTICATION_ERROR_SSL_FAILED;
g_propagate_error (error, local_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]