summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-05-19 14:31:52 +0000
committerMatthew Barnes <mbarnes@src.gnome.org>2008-05-19 14:31:52 +0000
commit211ca26f44c21579f47bb56826dd2f83ce7d11ca (patch)
treefdff0352201fa9499c13798732b6d2cb28353cd5
parent9e3b99a38dbb39d81b18cf6c0dc20a9dc154be45 (diff)
downloadevolution-data-server-211ca26f44c21579f47bb56826dd2f83ce7d11ca.tar.gz
** Fixes bug #531439
2008-05-19 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #531439 * e-passwords.c (ep_keyring_uri_new): Prevent GPG passphrases from destroying other passwords. GPG passphrases are only cached for the current session, not stored permanently in the keyring (mainly because those types of keys are not URIs with server and usernames). We defer to third-party GPG agents like Seahorse for persistent storage of passphrases. svn path=/trunk/; revision=8814
-rw-r--r--libedataserverui/ChangeLog11
-rw-r--r--libedataserverui/e-passwords.c31
2 files changed, 33 insertions, 9 deletions
diff --git a/libedataserverui/ChangeLog b/libedataserverui/ChangeLog
index df3d8fe31..1b7b4c48d 100644
--- a/libedataserverui/ChangeLog
+++ b/libedataserverui/ChangeLog
@@ -1,5 +1,16 @@
2008-05-19 Matthew Barnes <mbarnes@redhat.com>
+ ** Fixes bug #531439
+
+ * e-passwords.c (ep_keyring_uri_new):
+ Prevent GPG passphrases from destroying other passwords. GPG
+ passphrases are only cached for the current session, not stored
+ permanently in the keyring (mainly because those types of keys
+ are not URIs with server and usernames). We defer to third-party
+ GPG agents like Seahorse for persistent storage of passphrases.
+
+2008-05-19 Matthew Barnes <mbarnes@redhat.com>
+
** Fixes bug #354923
* e-passwords.c:
diff --git a/libedataserverui/e-passwords.c b/libedataserverui/e-passwords.c
index 3d37fefa3..0195d8e23 100644
--- a/libedataserverui/e-passwords.c
+++ b/libedataserverui/e-passwords.c
@@ -193,19 +193,29 @@ ep_keyring_error_domain (void)
}
static EUri *
-ep_keyring_uri_new (const gchar *string)
+ep_keyring_uri_new (const gchar *string,
+ GError **error)
{
EUri *uri;
uri = e_uri_new (string);
- if (uri == NULL)
- return NULL;
+ g_return_val_if_fail (uri != NULL, NULL);
/* LDAP URIs do not have usernames, so use the URI as the username. */
if (uri->user == NULL && uri->protocol != NULL &&
(strcmp (uri->protocol, "ldap") == 0|| strcmp (uri->protocol, "google") == 0))
uri->user = g_strdelimit (g_strdup (string), "/=", '_');
+ /* Make sure the URI has the required components. */
+ if (uri->user == NULL && uri->host == NULL) {
+ g_set_error (
+ error, EP_KEYRING_ERROR,
+ GNOME_KEYRING_RESULT_BAD_ARGUMENTS,
+ _("Keyring key is unusable: no user or host name"));
+ e_uri_free (uri);
+ uri = NULL;
+ }
+
return uri;
}
@@ -644,8 +654,9 @@ ep_remember_password_keyring (EPassMsg *msg)
return;
}
- uri = ep_keyring_uri_new (msg->key);
- g_return_if_fail (uri != NULL);
+ uri = ep_keyring_uri_new (msg->key, &msg->error);
+ if (uri == NULL)
+ return;
/* Only remove the password from the session hash
* if the keyring insertion was successful. */
@@ -707,8 +718,9 @@ ep_forget_password_keyring (EPassMsg *msg)
EUri *uri;
GError *error = NULL;
- uri = ep_keyring_uri_new (msg->key);
- g_return_if_fail (uri != NULL);
+ uri = ep_keyring_uri_new (msg->key, &msg->error);
+ if (uri == NULL)
+ return;
/* Find all Evolution passwords matching the URI and delete them.
*
@@ -787,8 +799,9 @@ ep_get_password_keyring (EPassMsg *msg)
EUri *uri;
GError *error = NULL;
- uri = ep_keyring_uri_new (msg->key);
- g_return_if_fail (uri != NULL);
+ uri = ep_keyring_uri_new (msg->key, &msg->error);
+ if (uri == NULL)
+ return;
/* Find the first Evolution password that matches the URI. */
passwords = ep_keyring_lookup_passwords (uri->user, uri->host, uri->protocol, &error);