[gnome-disk-utility] Handle quirky gnome_keyring_find_password_sync() behavior



commit 35b950b470239ed6ab2d31b7ab0c7ed3da68ee57
Author: David Zeuthen <davidz redhat com>
Date:   Tue Feb 16 12:43:59 2010 -0500

    Handle quirky gnome_keyring_find_password_sync() behavior
    
    Looks like gnome_keyring_find_password_sync() is pretty busted - it
    returns GNOME_KEYRING_RESULT_OK when returning a NULL password. This
    is probably due to the libgnome-keyring transition. Therefore, double
    check that we actually get a password back.
    
    See https://bugzilla.redhat.com/show_bug.cgi?id=558678 for more
    details.

 src/gdu-gtk/gdu-gtk.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/gdu-gtk/gdu-gtk.c b/src/gdu-gtk/gdu-gtk.c
index cbca84b..a821405 100644
--- a/src/gdu-gtk/gdu-gtk.c
+++ b/src/gdu-gtk/gdu-gtk.c
@@ -898,10 +898,11 @@ gdu_util_dialog_ask_for_secret (GtkWidget      *parent_window,
 
         if (!bypass_keyring) {
 #ifdef HAVE_GNOME_KEYRING
+                password = NULL;
                 if (gnome_keyring_find_password_sync (&encrypted_device_password_schema,
                                                       &password,
                                                       "luks-device-uuid", uuid,
-                                                      NULL) == GNOME_KEYRING_RESULT_OK) {
+                                                      NULL) == GNOME_KEYRING_RESULT_OK && password != NULL) {
                         /* By contract, the caller is responsible for scrubbing the password
                          * so dupping the string into pageable memory is "fine". Or not?
                          */
@@ -1041,10 +1042,11 @@ gdu_util_dialog_change_secret (GtkWidget       *parent_window,
 
 #ifdef HAVE_GNOME_KEYRING
         if (!bypass_keyring) {
+                password = NULL;
                 if (gnome_keyring_find_password_sync (&encrypted_device_password_schema,
                                                       &password,
                                                       "luks-device-uuid", uuid,
-                                                      NULL) == GNOME_KEYRING_RESULT_OK) {
+                                                      NULL) == GNOME_KEYRING_RESULT_OK && password != NULL) {
                         /* By contract, the caller is responsible for scrubbing the password
                          * so dupping the string into pageable memory "fine". Or not?
                          */



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