seahorse r2179 - in branches/gnome-2-22: . libseahorse
- From: sadam svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2179 - in branches/gnome-2-22: . libseahorse
- Date: Thu, 17 Apr 2008 19:48:16 +0100 (BST)
Author: sadam
Date: Thu Apr 17 19:48:15 2008
New Revision: 2179
URL: http://svn.gnome.org/viewvc/seahorse?rev=2179&view=rev
Log:
2008-04-17 Adam Schreiber <sadam clemson edu>
* libseahorse/seahorse-secure-memory.c: Test for secure memory
before
remapping memory functions. Patch from Coleman Kane. Fixes bug
#527193
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/libseahorse/seahorse-secure-memory.c
Modified: branches/gnome-2-22/libseahorse/seahorse-secure-memory.c
==============================================================================
--- branches/gnome-2-22/libseahorse/seahorse-secure-memory.c (original)
+++ branches/gnome-2-22/libseahorse/seahorse-secure-memory.c Thu Apr 17 19:48:15 2008
@@ -94,16 +94,34 @@
}
}
+static gboolean
+seahorse_try_gk_secure_memory ()
+{
+ gpointer p;
+
+ p = gnome_keyring_memory_try_alloc (10);
+ if (p != NULL) {
+ gnome_keyring_memory_free (p);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void
seahorse_secure_memory_init ()
{
- GMemVTable vtable;
-
- memset (&vtable, 0, sizeof (vtable));
- vtable.malloc = switch_malloc;
- vtable.realloc = switch_realloc;
- vtable.free = switch_free;
- vtable.calloc = switch_calloc;
- g_mem_set_vtable (&vtable);
-}
+ if (seahorse_try_gk_secure_memory() == TRUE) {
+ GMemVTable vtable;
+ memset (&vtable, 0, sizeof (vtable));
+ vtable.malloc = switch_malloc;
+ vtable.realloc = switch_realloc;
+ vtable.free = switch_free;
+ vtable.calloc = switch_calloc;
+ g_mem_set_vtable (&vtable);
+ } else {
+ g_warning ("Unable to allocate secure memory from gnome-keyring.\n");
+ g_warning ("Proceeding using insecure memory for password fields.\n");
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]