[gvfs] sftp: retain chosen password save option across mount phases



commit 82667b5437c49ab73d36d1d3b3f664ea25c35397
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Fri Feb 19 14:30:21 2010 +0100

    sftp: retain chosen password save option across mount phases
    
    When username changes, we need to respawn the underlying process and
    go through handle_login() again. We need to save the GPasswordSave value
    temporarily to have the password actually saved if desired.

 daemon/gvfsbackendsftp.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 659ed93..342b996 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -151,6 +151,7 @@ struct _GVfsBackendSftp
   gboolean user_specified_in_uri;
   char *user;
   char *tmp_password;
+  GPasswordSave password_save;
 
   guint32 my_uid;
   guint32 my_gid;
@@ -846,7 +847,6 @@ handle_login (GVfsBackend *backend,
   gboolean ret_val;
   char *new_password = NULL;
   char *new_user = NULL;
-  GPasswordSave password_save = G_PASSWORD_SAVE_NEVER;
   gsize bytes_written;
   gboolean password_in_keyring = FALSE;
   const gchar *authtype = NULL;
@@ -966,7 +966,7 @@ handle_login (GVfsBackend *backend,
                                                 &new_user,
                                                 NULL,
 						NULL,
-                                                &password_save) ||
+                                                &op_backend->password_save) ||
                   aborted)
                 {
                   g_set_error_literal (error, G_IO_ERROR,
@@ -1111,7 +1111,7 @@ handle_login (GVfsBackend *backend,
 				   :
 				   0, 
                                    new_password,
-                                   password_save);
+                                   op_backend->password_save);
     }
 
   g_free (object);
@@ -1696,8 +1696,11 @@ real_do_mount (GVfsBackend *backend,
 	       GMountSource *mount_source,
 	       gboolean is_automount)
 {
+  GVfsBackendSftp *op_backend = G_VFS_BACKEND_SFTP (backend);
+
   setup_ssh_environment ();
 
+  op_backend->password_save = G_PASSWORD_SAVE_NEVER;
   do_mount (backend, job, mount_spec, mount_source, is_automount);
 }
 



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