aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-11-20 13:37:27 +0800
committerDan Winship <danw@src.gnome.org>2001-11-20 13:37:27 +0800
commit3bbe7554d7b1dc2fc35ee152de56092bfee6899b (patch)
treead40febdc476fef8aa9c03636fcb654a0f3d3a3f /e-util
parentb9a14234743f054653ffffa5fe1f3c5847d70751 (diff)
downloadgsoc2013-evolution-3bbe7554d7b1dc2fc35ee152de56092bfee6899b.tar.gz
gsoc2013-evolution-3bbe7554d7b1dc2fc35ee152de56092bfee6899b.tar.zst
gsoc2013-evolution-3bbe7554d7b1dc2fc35ee152de56092bfee6899b.zip
Clear the password in bonobo-conf as well. Fixes ximian 14893.
* e-passwords.c (e_passwords_forget_password): Clear the password in bonobo-conf as well. Fixes ximian 14893. svn path=/trunk/; revision=14754
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog5
-rw-r--r--e-util/e-passwords.c49
2 files changed, 36 insertions, 18 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index ff7722a872..9b0f4d0ec1 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,8 @@
+2001-11-20 Dan Winship <danw@ximian.com>
+
+ * e-passwords.c (e_passwords_forget_password): Clear the password
+ in bonobo-conf as well. Fixes ximian 14893.
+
2001-11-13 Ettore Perazzoli <ettore@ximian.com>
* Makefile.am (libeutil_la_LIBADD): Remove `-lc'. It makes the
diff --git a/e-util/e-passwords.c b/e-util/e-passwords.c
index bf632c26eb..996d6cc592 100644
--- a/e-util/e-passwords.c
+++ b/e-util/e-passwords.c
@@ -158,6 +158,22 @@ e_passwords_clear_component_passwords ()
g_free (path);
}
+static char *
+password_path (const char *key)
+{
+ int len, state, save;
+ char *key64, *path;
+
+ len = strlen (key);
+ key64 = g_malloc0 ((len + 2) * 4 / 3 + 1);
+ state = save = 0;
+ base64_encode_close ((char*)key, len, FALSE, key64, &state, &save);
+ path = g_strdup_printf ("/Passwords/%s/%s", component_name, key64);
+ g_free (key64);
+
+ return path;
+}
+
/**
* e_passwords_remember_password:
* @key: the key
@@ -168,19 +184,14 @@ void
e_passwords_remember_password (const char *key)
{
gpointer okey, value;
- char *path, *key64, *pass64;
+ char *path, *pass64;
int len, state, save;
if (!g_hash_table_lookup_extended (passwords, key, &okey, &value))
return;
/* add it to the on-disk cache of passwords */
- len = strlen (okey);
- key64 = g_malloc0 ((len + 2) * 4 / 3 + 1);
- state = save = 0;
- base64_encode_close (okey, len, FALSE, key64, &state, &save);
- path = g_strdup_printf ("/Passwords/%s/%s", component_name, key64);
- g_free (key64);
+ path = password_path (okey);
len = strlen (value);
pass64 = g_malloc0 ((len + 2) * 4 / 3 + 1);
@@ -201,20 +212,28 @@ e_passwords_remember_password (const char *key)
* e_passwords_forget_password:
* @key: the key
*
- * Forgets the password associated with @key for the rest of the session,
- * but does not affect the on-disk cache.
+ * Forgets the password associated with @key, in memory and on disk.
**/
void
e_passwords_forget_password (const char *key)
{
gpointer okey, value;
-
+ CORBA_Environment ev;
+ char *path;
+
if (g_hash_table_lookup_extended (passwords, key, &okey, &value)) {
g_hash_table_remove (passwords, key);
memset (value, 0, strlen (value));
g_free (okey);
g_free (value);
}
+
+ /* clear it in the on disk db */
+ path = password_path (key);
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_removeValue (db, path, &ev);
+ CORBA_exception_free (&ev);
+ g_free (path);
}
/**
@@ -228,20 +247,14 @@ char *
e_passwords_get_password (const char *key)
{
char *passwd = g_hash_table_lookup (passwords, key);
- char *path, *key64;
- int len, state, save;
+ char *path;
CORBA_Environment ev;
if (passwd)
return g_strdup (passwd);
/* not part of the session hash, look it up in the on disk db */
- len = strlen (key);
- key64 = g_malloc0 ((len + 2) * 4 / 3 + 1);
- state = save = 0;
- base64_encode_close ((char*)key, len, FALSE, key64, &state, &save);
- path = g_strdup_printf ("/Passwords/%s/%s", component_name, key64);
- g_free (key64);
+ path = password_path (key);
/* We need to pass an ev to bonobo-conf, or it will emit a
* g_warning if the data isn't found.