[gvfs/wip/oholy/afp-keyring: 3/3] afp: Try to find credentials even if user is not specified



commit b92980d078a51aebf5e167cb70e9dce9e4e37ef0
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Dec 19 15:46:23 2018 +0100

    afp: Try to find credentials even if user is not specified
    
    Currently, when you try to mount AFP share and don't specify username
    in the URI, the g_vfs_keyring_lookup_password() call is skipped and thus
    you have to specify the credentials manually even if "Remember Password
    Forever" was used last time. This is wrong and other backends in
    the same situation tries to use the stored credentials. This is especially
    annoying for locations which are propagated over DNS-SD. Let's change this.
    
    Closes: https://gitlab.gnome.org/GNOME/gvfs/issues/352

 daemon/gvfsafpserver.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c
index 615446a3..d1787a47 100644
--- a/daemon/gvfsafpserver.c
+++ b/daemon/gvfsafpserver.c
@@ -1027,23 +1027,23 @@ g_vfs_afp_server_login (GVfsAfpServer *server,
       anonymous = TRUE;
       goto try_login;
     }
+  }
 
-    else if (g_vfs_keyring_lookup_password (initial_user,
-                                            g_network_address_get_hostname (priv->addr),
-                                            NULL,
-                                            "afp",
-                                            NULL,
-                                            NULL,
-                                            g_network_address_get_port (priv->addr),
-                                            &user,
-                                            NULL,
-                                            &password) &&
-             user != NULL &&
-             password != NULL)
-    {
-      anonymous = FALSE;
-      goto try_login;
-    }
+  if (g_vfs_keyring_lookup_password (initial_user,
+                                     g_network_address_get_hostname (priv->addr),
+                                     NULL,
+                                     "afp",
+                                     NULL,
+                                     NULL,
+                                     g_network_address_get_port (priv->addr),
+                                     &user,
+                                     NULL,
+                                     &password) &&
+      user != NULL &&
+      password != NULL)
+  {
+    anonymous = FALSE;
+    goto try_login;
   }
 
   while (TRUE)


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