[vlc-commits] dsm: don't always save credentials in options or 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:27:01 2016 +0100| [908a40643f6d4c4b560c1bdc42dadf3c4ad30c1b] | committer: Thomas Guillem
dsm: don't always save credentials in options or in the keystore
- Never save guest credentials
- Don't save password in options if it's in the keystore
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=908a40643f6d4c4b560c1bdc42dadf3c4ad30c1b
---
modules/access/dsm/access.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 7277b14..e81d186 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -316,6 +316,7 @@ static int login( access_t *p_access )
vlc_credential credential;
char *psz_var_domain;
const char *psz_login, *psz_password, *psz_domain;
+ bool b_guest = false;
vlc_UrlParse( &url, p_access->psz_url );
vlc_credential_init( &credential, &url );
@@ -329,6 +330,7 @@ static int login( access_t *p_access )
{
psz_login = "Guest";
psz_password = "Guest";
+ b_guest = true;
}
else
{
@@ -345,6 +347,7 @@ static int login( access_t *p_access )
SMB_LOGIN_DIALOG_TITLE,
SMB_LOGIN_DIALOG_TEXT, p_sys->netbios_name ) )
{
+ b_guest = false;
psz_login = credential.psz_username;
psz_password = credential.psz_password;
psz_domain = credential.psz_realm;
@@ -358,23 +361,23 @@ static int login( access_t *p_access )
goto error;
}
else if( smb_session_is_guest( p_sys->p_session ) )
+ {
msg_Warn( p_access, "Login failure but you were logged in as a Guest");
+ b_guest = true;
+ }
success:
- msg_Dbg( p_access, "Creds: username = '%s', domain = '%s'",
+ msg_Warn( p_access, "Creds: username = '%s', domain = '%s'",
psz_login, psz_domain );
- p_sys->creds.login = strdup(psz_login);
- p_sys->creds.password = strdup(psz_password);
- p_sys->creds.domain = strdup(psz_domain);
- if (!p_sys->creds.login || !p_sys->creds.password || !p_sys->creds.domain)
+ if( p_sys->psz_share != NULL && !b_guest )
{
- free(p_sys->creds.login);
- free(p_sys->creds.password);
- free(p_sys->creds.domain);
- p_sys->creds.login = p_sys->creds.password = p_sys->creds.domain = NULL;
- goto error;
+ p_sys->creds.login = strdup(psz_login);
+ p_sys->creds.domain = strdup(psz_domain);
+
+ if( !vlc_credential_store( &credential ) )
+ p_sys->creds.password = strdup(psz_password);
}
- vlc_credential_store( &credential );
+
i_ret = VLC_SUCCESS;
error:
vlc_credential_clean( &credential );
More information about the vlc-commits
mailing list