[evolution-data-server] CamelImapStore: Use camel_service_set_password().
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] CamelImapStore: Use camel_service_set_password().
- Date: Mon, 26 Sep 2011 13:46:04 +0000 (UTC)
commit 590375e2247f96f530cecdef78ca0ba7d5d2b54f
Author: Matthew Barnes <mbarnes redhat com>
Date: Sun Sep 25 18:49:56 2011 -0400
CamelImapStore: Use camel_service_set_password().
Instead of stashing the password in its CamelURL.
camel/providers/imap/camel-imap-store.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 1e5c02e..d6d62e3 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -456,8 +456,10 @@ connect_to_server_process (CamelService *service,
gchar *cmd_copy;
gchar *full_cmd;
gchar *child_env[7];
+ const gchar *password;
url = camel_service_get_camel_url (service);
+ password = camel_service_get_password (service);
/* Put full details in the environment, in case the connection
* program needs them */
@@ -470,8 +472,8 @@ connect_to_server_process (CamelService *service,
child_env[i++] = g_strdup_printf("URLPORT=%d", url->port);
if (url->user)
child_env[i++] = g_strdup_printf("URLUSER=%s", url->user);
- if (url->passwd)
- child_env[i++] = g_strdup_printf("URLPASSWD=%s", url->passwd);
+ if (password)
+ child_env[i++] = g_strdup_printf("URLPASSWD=%s", password);
if (url->path)
child_env[i++] = g_strdup_printf("URLPATH=%s", url->path);
child_env[i] = NULL;
@@ -742,18 +744,21 @@ imap_auth_loop (CamelService *service,
}
while (!authenticated) {
+ const gchar *password;
GError *local_error = NULL;
if (errbuf) {
/* We need to un-cache the password before prompting again */
prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
- g_free (url->passwd);
- url->passwd = NULL;
+ camel_service_set_password (service, NULL);
}
- if (!url->passwd) {
+ password = camel_service_get_password (service);
+
+ if (password == NULL) {
gchar *base_prompt;
gchar *full_prompt;
+ gchar *new_passwd;
base_prompt = camel_session_build_password_prompt (
"IMAP", url->user, url->host);
@@ -763,16 +768,23 @@ imap_auth_loop (CamelService *service,
else
full_prompt = g_strdup (base_prompt);
- url->passwd = camel_session_get_password (
+ /* XXX This is a tad awkward. Maybe define a
+ * camel_service_ask_password() that calls
+ * camel_session_get_password() and caches
+ * the password itself? */
+ new_passwd = camel_session_get_password (
session, service, full_prompt,
"password", prompt_flags, error);
+ camel_service_set_password (service, new_passwd);
+ password = camel_service_get_password (service);
+ g_free (new_passwd);
g_free (base_prompt);
g_free (full_prompt);
g_free (errbuf);
errbuf = NULL;
- if (!url->passwd) {
+ if (password == NULL) {
g_set_error (
error, G_IO_ERROR,
G_IO_ERROR_CANCELLED,
@@ -803,7 +815,7 @@ imap_auth_loop (CamelService *service,
} else {
response = camel_imap_command (
store, NULL, cancellable, &local_error,
- "LOGIN %S %S", url->user, url->passwd);
+ "LOGIN %S %S", url->user, password);
if (response) {
camel_imap_response_free (store, response);
authenticated = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]