[libgdata] core: Use gcr instead of libgnome-keyring for secure memory



commit 935e69fe86b51508cb22860a5db96aa1989c58ca
Author: Stef Walter <stefw gnome org>
Date:   Tue Jul 17 21:16:11 2012 +0100

    core: Use gcr instead of libgnome-keyring for secure memory
    
    * libgnome-keyring will be deprecated in the future
    
    Closes: https://bugzilla.gnome.org/show_bug.cgi?id=679867

 README                                |    2 +-
 configure.ac                          |    4 ++--
 docs/reference/gdata-overview.xml     |    4 ++--
 gdata/gdata-client-login-authorizer.c |    4 ++--
 gdata/gdata-service.c                 |    9 +++++----
 5 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/README b/README
index b7c4b2f..26b29ab 100644
--- a/README
+++ b/README
@@ -21,7 +21,7 @@ Dependencies
 
 If compiling with --enable-gnome (for GNOME support):
  * libsoup-gnome-2.4
- * gnome-keyring-1
+ * gcr-base-3
 
 Environment variables
 =====================
diff --git a/configure.ac b/configure.ac
index 2e4adf0..4cf625f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,13 +81,13 @@ AC_SUBST(GDK_PIXBUF_LIBS)
 PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQS], [have_gtk=yes], [have_gtk=no])
 AM_CONDITIONAL([HAVE_GTK], [test "x$have_gtk" = "xyes"])
 
-# GNOME support, which pulls in libsoup-gnome-2.4 to provide transparent proxy support and gnome-keyring-1 to provide non-pageable memory
+# GNOME support, which pulls in libsoup-gnome-2.4 to provide transparent proxy support and gcr-base-3 to provide non-pageable memory
 AC_MSG_CHECKING(whether to build with GNOME support)
 AC_ARG_ENABLE(gnome, AS_HELP_STRING([--enable-gnome], [Whether to enable GNOME support]),, enable_gnome=yes)
 AC_MSG_RESULT($enable_gnome)
 AM_CONDITIONAL([ENABLE_GNOME], [test "x$enable_gnome" = "xyes"])
 
-GNOME_PACKAGES="libsoup-gnome-2.4 gnome-keyring-1 goa-1.0 >= $GOA_REQS"
+GNOME_PACKAGES="libsoup-gnome-2.4 gcr-base-3 goa-1.0 >= $GOA_REQS"
 AC_SUBST([GNOME_PACKAGES])
 
 if test "x$enable_gnome" = "xyes"; then
diff --git a/docs/reference/gdata-overview.xml b/docs/reference/gdata-overview.xml
index aaffddb..7e8c0fb 100644
--- a/docs/reference/gdata-overview.xml
+++ b/docs/reference/gdata-overview.xml
@@ -189,8 +189,8 @@
 				is done in several ways in libgdata:</para>
 			<itemizedlist>
 				<listitem>
-					<para>If libgdata is compiled with libgnome-keyring support enabled (using the
-						<code class="literal">--enable-gnome</code> configuration flag), it will use gnome-keyring's support for
+					<para>If libgdata is compiled with libgcr support enabled (using the
+						<code class="literal">--enable-gnome</code> configuration flag), it will use libgcr's support for
 						non-pageable memory. This will try hard to avoid passwords and auth. tokens being paged out to disk at
 						any point (although there are circumstances, such as when hibernating, where this is
 						unavoidable).</para>
diff --git a/gdata/gdata-client-login-authorizer.c b/gdata/gdata-client-login-authorizer.c
index d60d219..4e4c8f8 100644
--- a/gdata/gdata-client-login-authorizer.c
+++ b/gdata/gdata-client-login-authorizer.c
@@ -209,7 +209,7 @@ gdata_client_login_authorizer_class_init (GDataClientLoginAuthorizerClass *klass
 	 * then be set to the password passed to gdata_client_login_authorizer_authenticate(), and a #GObject::notify signal will be emitted. If
 	 * authentication fails, it will be set to %NULL.
 	 *
-	 * If libgdata is compiled with libgnome-keyring support, the password will be stored in non-pageable memory. However, if it is retrieved
+	 * If libgdata is compiled with libgcr support, the password will be stored in non-pageable memory. However, if it is retrieved
 	 * using g_object_get() (or related functions) it will be copied to non-pageable memory and could end up being written to disk. Accessing
 	 * the password using gdata_client_login_authorizer_get_password() will not perform any copies, and so maintains privacy.
 	 *
@@ -1237,7 +1237,7 @@ gdata_client_login_authorizer_get_username (GDataClientLoginAuthorizer *self)
  *
  * It is not safe to call this while an authentication operation is ongoing.
  *
- * If libgdata is compiled with libgnome-keyring support, the password will be stored in non-pageable memory. Since this function doesn't return
+ * If libgdata is compiled with libgcr support, the password will be stored in non-pageable memory. Since this function doesn't return
  * a copy of the password, the returned value is guaranteed to not hit disk. It's advised that any copies of the password made in client programs
  * also use non-pageable memory.
  *
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index 1ce3f6b..31a5827 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -46,7 +46,8 @@
 
 #ifdef HAVE_GNOME
 #include <libsoup/soup-gnome-features.h>
-#include <gnome-keyring-memory.h>
+#define GCR_API_SUBJECT_TO_CHANGE
+#include <gcr/gcr-base.h>
 #endif /* HAVE_GNOME */
 
 #include "gdata-service.h"
@@ -2199,7 +2200,7 @@ GDataSecureString
 _gdata_service_secure_strdup (const gchar *str)
 {
 #ifdef HAVE_GNOME
-	return gnome_keyring_memory_strdup (str);
+	return gcr_secure_memory_strdup (str);
 #else /* if !HAVE_GNOME */
 	return g_strdup (str);
 #endif /* !HAVE_GNOME */
@@ -2228,7 +2229,7 @@ _gdata_service_secure_strndup (const gchar *str, gsize n_bytes)
 	}
 
 	str_len = MIN (strlen (str), n_bytes);
-	duped_str = (GDataSecureString) gnome_keyring_memory_alloc (str_len + 1);
+	duped_str = (GDataSecureString) gcr_secure_memory_alloc (str_len + 1);
 	strncpy (duped_str, str, str_len);
 	*(duped_str + str_len) = '\0';
 
@@ -2251,7 +2252,7 @@ void
 _gdata_service_secure_strfree (GDataSecureString str)
 {
 #ifdef HAVE_GNOME
-	gnome_keyring_memory_free (str);
+	gcr_secure_memory_free (str);
 #else /* if !HAVE_GNOME */
 	/* Poor man's approximation to non-pageable memory: the best we can do is ensure that we don't leak it in free memory.
 	 * This can't guarantee that it hasn't hit disk at some point, but does mean it can't hit disk in future. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]