[gnome-keyring] Revert "ssh-agent: Fix leak in search_keys_like_attributes()"



commit 06422ea18cebfd6d4d554d01445eafb3d140d6b8
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Mar 6 10:36:04 2015 +0100

    Revert "ssh-agent: Fix leak in search_keys_like_attributes()"
    
    This reverts commit d177a8b5353f3156ab504f39c20753d6786e5e4d.
    
    This breaks the ssh agent as this causes it to fail to remember unlocked
    keys, and to always ask for a key passphrase when attempting an ssh
    connection.
    From https://bugzilla.gnome.org/show_bug.cgi?id=744280 :
    « ssh foo.example.com is always asking to unlock the corresponding key
    while before this commit this works fine.
    
    gkd-ssh-agent-ops.c:op_sign_request has:
    result = unlock_and_sign (session, key, mech, hash, n_hash, &n_result,
    &error);
    g_object_unref (session);
    g_object_unref (key);
    
    After the leak fix mentioned above, unreffing 'key' causes the last
    reference to be released, so it's destroyed, and this locks the just
    unlocked key.
    Removing the g_object_unref() avoids this issue, but readds a leak. I
    assume 'key' should be added somewhere so that it's kept alive, but I'm
    not really sure where/how »

 daemon/ssh-agent/gkd-ssh-agent-ops.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
---
diff --git a/daemon/ssh-agent/gkd-ssh-agent-ops.c b/daemon/ssh-agent/gkd-ssh-agent-ops.c
index 2b30747..d70875c 100644
--- a/daemon/ssh-agent/gkd-ssh-agent-ops.c
+++ b/daemon/ssh-agent/gkd-ssh-agent-ops.c
@@ -139,7 +139,6 @@ search_keys_like_attributes (GList *modules, GckSession *session, GckAttributes
                en = gck_modules_enumerate_objects (modules, search, GCK_SESSION_AUTHENTICATE | 
GCK_SESSION_READ_WRITE);
 
                for (;;) {
-                       gboolean done;
                        object = gck_enumerator_next (en, NULL, &error);
                        if (!object) {
                                if (error) {
@@ -149,9 +148,7 @@ search_keys_like_attributes (GList *modules, GckSession *session, GckAttributes
                                break;
                        }
 
-                       done = !(func) (object, user_data);
-                       g_object_unref (object);
-                       if (done)
+                       if (!(func) (object, user_data))
                                break;
                }
 


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