Added code to get the password from the cache, instead of asking the user

2005-07-27  Sankar P  <psankar@novell.com>

	* 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
This commit is contained in:
Sankar P
2005-08-04 05:28:00 +00:00
committed by Sankarasivasubramanian Pasupathilingam
parent 1b28d2f6d5
commit be73726a2f
2 changed files with 25 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2005-07-27 Sankar P <psankar@novell.com>
* 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 <rsushma@novell.com>
* camel-gw-listener.c (add_addressbook_sources): marking

View File

@ -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);