From be73726a2f4ea94ff1a2ef346c57dcdad1f4252e Mon Sep 17 00:00:00 2001 From: Sankar P Date: Thu, 4 Aug 2005 05:28:00 +0000 Subject: Added code to get the password from the cache, instead of asking the user 2005-07-27 Sankar P * camel-gw-listener.c (get_addressbook_names_from_server) : Added code to get the password from the cache, instead of asking the user twice. and also freeing the password that was leaking before. Fixes #310353 svn path=/trunk/; revision=29981 --- plugins/groupwise-account-setup/ChangeLog | 7 +++++ .../groupwise-account-setup/camel-gw-listener.c | 30 +++++++++++++--------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/plugins/groupwise-account-setup/ChangeLog b/plugins/groupwise-account-setup/ChangeLog index 3ee3025ece..7ce45ca221 100644 --- a/plugins/groupwise-account-setup/ChangeLog +++ b/plugins/groupwise-account-setup/ChangeLog @@ -1,3 +1,10 @@ +2005-07-27 Sankar P + + * camel-gw-listener.c (get_addressbook_names_from_server) : + Added code to get the password from the cache, instead of asking the user twice. + and also freeing the password that was leaking before. + Fixes #310353 + 2005-07-23 Sushma Rai * camel-gw-listener.c (add_addressbook_sources): marking diff --git a/plugins/groupwise-account-setup/camel-gw-listener.c b/plugins/groupwise-account-setup/camel-gw-listener.c index 8474d25b37..c2f6e0c7c2 100644 --- a/plugins/groupwise-account-setup/camel-gw-listener.c +++ b/plugins/groupwise-account-setup/camel-gw-listener.c @@ -458,24 +458,30 @@ get_addressbook_names_from_server (char *source_url) failed_auth = ""; cnc = NULL; - do { - password_prompt = g_strdup_printf (_("Enter password for %s (user %s)"), - poa_address, url->user); - prompt = g_strconcat (failed_auth, password_prompt, NULL); - g_free (password_prompt); - password = e_passwords_ask_password (prompt, "Groupwise", key, prompt, - E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET, &remember, - NULL); - g_free (prompt); - - if (!password) - break; + do { + password = e_passwords_get_password ("Groupwise", key); + if (!password) { + password_prompt = g_strdup_printf (_("Enter password for %s (user %s)"), + poa_address, url->user); + prompt = g_strconcat (failed_auth, password_prompt, NULL); + g_free (password_prompt); + password = e_passwords_ask_password (prompt, "Groupwise", key, prompt, + E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET, &remember, + NULL); + g_free (prompt); + + if (!password) + break; + } cnc = e_gw_connection_new (uri, url->user, password); if (!E_IS_GW_CONNECTION(cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) { char *http_uri = g_strconcat ("http://", uri + 8, NULL); cnc = e_gw_connection_new (http_uri, url->user, password); g_free (http_uri); } + + g_free (password); + failed_auth = _("Failed to authenticate.\n"); flags |= E_PASSWORDS_REPROMPT; } while (cnc == NULL); -- cgit