[evolution-data-server] Should not ask for password of GOA IMAP account
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Should not ask for password of GOA IMAP account
- Date: Fri, 6 Mar 2015 07:29:16 +0000 (UTC)
commit ce8396f12d11ecbb96a2c5f233c0946f54157387
Author: Milan Crha <mcrha redhat com>
Date: Fri Mar 6 08:25:18 2015 +0100
Should not ask for password of GOA IMAP account
Evolution was asking for a GOA IMAP account password, even it should
take it from GOA, not from a user. The reason was that the function
e_source_credentials_provider_ref_credentials_source() works for
an Authentication extension, which the GOA (and UOA) doesn't use,
thus the correct credentials source was not found. Providing a similar
lookup function which lookups for GOA (or UOA) extension in the parent
sources makes this work properly.
.../gnome-online-accounts/e-goa-password-based.c | 40 +++++++++++++++++++-
.../e-signon-session-password.c | 40 +++++++++++++++++++-
2 files changed, 76 insertions(+), 4 deletions(-)
---
diff --git a/modules/gnome-online-accounts/e-goa-password-based.c
b/modules/gnome-online-accounts/e-goa-password-based.c
index fd05671..827c767 100644
--- a/modules/gnome-online-accounts/e-goa-password-based.c
+++ b/modules/gnome-online-accounts/e-goa-password-based.c
@@ -37,6 +37,42 @@ struct _EGoaPasswordBasedPrivate {
G_DEFINE_DYNAMIC_TYPE (EGoaPasswordBased, e_goa_password_based, E_TYPE_SOURCE_CREDENTIALS_PROVIDER_IMPL)
+static ESource *
+e_goa_password_based_ref_credentials_source (ESourceCredentialsProvider *provider,
+ ESource *source)
+{
+ ESource *adept, *cred_source = NULL;
+
+ g_return_val_if_fail (E_IS_SOURCE_CREDENTIALS_PROVIDER (provider), NULL);
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
+ adept = g_object_ref (source);
+
+ while (adept && !e_source_has_extension (adept, E_SOURCE_EXTENSION_GOA)) {
+ ESource *parent;
+
+ if (!e_source_get_parent (adept)) {
+ break;
+ }
+
+ parent = e_source_credentials_provider_ref_source (provider, e_source_get_parent (adept));
+
+ g_clear_object (&adept);
+ adept = parent;
+ }
+
+ if (adept && e_source_has_extension (adept, E_SOURCE_EXTENSION_GOA)) {
+ cred_source = g_object_ref (adept);
+ }
+
+ g_clear_object (&adept);
+
+ if (!cred_source)
+ cred_source = e_source_credentials_provider_ref_credentials_source (provider, source);
+
+ return cred_source;
+}
+
static GoaObject *
e_goa_password_based_ref_account (ESourceCredentialsProvider *provider,
ESource *source,
@@ -51,7 +87,7 @@ e_goa_password_based_ref_account (ESourceCredentialsProvider *provider,
if (e_source_has_extension (source, E_SOURCE_EXTENSION_GOA)) {
extension = e_source_get_extension (source, E_SOURCE_EXTENSION_GOA);
} else {
- cred_source = e_source_credentials_provider_ref_credentials_source (provider, source);
+ cred_source = e_goa_password_based_ref_credentials_source (provider, source);
if (cred_source && e_source_has_extension (cred_source, E_SOURCE_EXTENSION_GOA))
extension = e_source_get_extension (cred_source, E_SOURCE_EXTENSION_GOA);
}
@@ -108,7 +144,7 @@ e_goa_password_based_can_process (ESourceCredentialsProviderImpl *provider_impl,
if (!can_process) {
ESource *cred_source;
- cred_source = e_source_credentials_provider_ref_credentials_source (
+ cred_source = e_goa_password_based_ref_credentials_source (
e_source_credentials_provider_impl_get_provider (provider_impl),
source);
diff --git a/modules/ubuntu-online-accounts/e-signon-session-password.c
b/modules/ubuntu-online-accounts/e-signon-session-password.c
index ff8c4fa..02a36c2 100644
--- a/modules/ubuntu-online-accounts/e-signon-session-password.c
+++ b/modules/ubuntu-online-accounts/e-signon-session-password.c
@@ -96,6 +96,42 @@ signon_session_password_state_changed_cb (SignonAuthSession *signon_auth_session
e_signon_session_password_msg (source, "(signond) %s", message);
}
+static ESource *
+e_uoa_signon_session_password_ref_credentials_source (ESourceCredentialsProvider *provider,
+ ESource *source)
+{
+ ESource *adept, *cred_source = NULL;
+
+ g_return_val_if_fail (E_IS_SOURCE_CREDENTIALS_PROVIDER (provider), NULL);
+ g_return_val_if_fail (E_IS_SOURCE (source), NULL);
+
+ adept = g_object_ref (source);
+
+ while (adept && !e_source_has_extension (adept, E_SOURCE_EXTENSION_UOA)) {
+ ESource *parent;
+
+ if (!e_source_get_parent (adept)) {
+ break;
+ }
+
+ parent = e_source_credentials_provider_ref_source (provider, e_source_get_parent (adept));
+
+ g_clear_object (&adept);
+ adept = parent;
+ }
+
+ if (adept && e_source_has_extension (adept, E_SOURCE_EXTENSION_UOA)) {
+ cred_source = g_object_ref (adept);
+ }
+
+ g_clear_object (&adept);
+
+ if (!cred_source)
+ cred_source = e_source_credentials_provider_ref_credentials_source (provider, source);
+
+ return cred_source;
+}
+
static AgAccountService *
signon_session_password_new_account_service (ESourceCredentialsProviderImpl *provider_impl,
ESource *source,
@@ -118,7 +154,7 @@ signon_session_password_new_account_service (ESourceCredentialsProviderImpl *pro
provider = e_source_credentials_provider_impl_get_provider (provider_impl);
- cred_source = e_source_credentials_provider_ref_credentials_source (provider, source);
+ cred_source = e_uoa_signon_session_password_ref_credentials_source (provider, source);
if (cred_source && e_source_has_extension (cred_source, E_SOURCE_EXTENSION_UOA))
extension = e_source_get_extension (cred_source, E_SOURCE_EXTENSION_UOA);
}
@@ -166,7 +202,7 @@ e_signon_session_password_can_process (ESourceCredentialsProviderImpl *provider_
if (!can_process) {
ESource *cred_source;
- cred_source = e_source_credentials_provider_ref_credentials_source (
+ cred_source = e_uoa_signon_session_password_ref_credentials_source (
e_source_credentials_provider_impl_get_provider (provider_impl),
source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]