[vlc-commits] stfp: don't save password in options if it's in the keystore

Thomas Guillem git at videolan.org
Tue Jan 12 09:58:44 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jan 12 09:51:53 2016 +0100| [bed447c74fc4d515d14118c7728d3ce4461d3d9c] | committer: Thomas Guillem

stfp: don't save password in options if it's in the keystore

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bed447c74fc4d515d14118c7728d3ce4461d3d9c
---

 modules/access/sftp.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/access/sftp.c b/modules/access/sftp.c
index 494809d..ece9e95 100644
--- a/modules/access/sftp.c
+++ b/modules/access/sftp.c
@@ -212,6 +212,7 @@ static int Open( vlc_object_t* p_this )
 
     //TODO: ask for the available auth methods
 
+    bool b_stored = false;
     while( vlc_credential_get( &credential, p_access, "sftp-user", "sftp-pwd",
                                _("SFTP authentication"),
                                _("Please enter a valid login and password for "
@@ -222,7 +223,7 @@ static int Open( vlc_object_t* p_this )
                                        credential.psz_username,
                                        credential.psz_password ) == 0 )
         {
-            vlc_credential_store( &credential );
+            b_stored = vlc_credential_store( &credential );
             break;
         }
         else
@@ -290,7 +291,7 @@ static int Open( vlc_object_t* p_this )
         {
             if( -1 == asprintf( &p_sys->psz_username_opt, "sftp-user=%s", credential.psz_username ) )
                 p_sys->psz_username_opt = NULL;
-            if( -1 == asprintf( &p_sys->psz_password_opt, "sftp-pwd=%s", credential.psz_password ) )
+            if( b_stored || -1 == asprintf( &p_sys->psz_password_opt, "sftp-pwd=%s", credential.psz_password ) )
                 p_sys->psz_password_opt = NULL;
         }
     }



More information about the vlc-commits mailing list