Commit 908a4064 authored by Thomas Guillem's avatar 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
parent 97640790
...@@ -316,6 +316,7 @@ static int login( access_t *p_access ) ...@@ -316,6 +316,7 @@ static int login( access_t *p_access )
vlc_credential credential; vlc_credential credential;
char *psz_var_domain; char *psz_var_domain;
const char *psz_login, *psz_password, *psz_domain; const char *psz_login, *psz_password, *psz_domain;
bool b_guest = false;
vlc_UrlParse( &url, p_access->psz_url ); vlc_UrlParse( &url, p_access->psz_url );
vlc_credential_init( &credential, &url ); vlc_credential_init( &credential, &url );
...@@ -329,6 +330,7 @@ static int login( access_t *p_access ) ...@@ -329,6 +330,7 @@ static int login( access_t *p_access )
{ {
psz_login = "Guest"; psz_login = "Guest";
psz_password = "Guest"; psz_password = "Guest";
b_guest = true;
} }
else else
{ {
...@@ -345,6 +347,7 @@ static int login( access_t *p_access ) ...@@ -345,6 +347,7 @@ static int login( access_t *p_access )
SMB_LOGIN_DIALOG_TITLE, SMB_LOGIN_DIALOG_TITLE,
SMB_LOGIN_DIALOG_TEXT, p_sys->netbios_name ) ) SMB_LOGIN_DIALOG_TEXT, p_sys->netbios_name ) )
{ {
b_guest = false;
psz_login = credential.psz_username; psz_login = credential.psz_username;
psz_password = credential.psz_password; psz_password = credential.psz_password;
psz_domain = credential.psz_realm; psz_domain = credential.psz_realm;
...@@ -358,23 +361,23 @@ static int login( access_t *p_access ) ...@@ -358,23 +361,23 @@ static int login( access_t *p_access )
goto error; goto error;
} }
else if( smb_session_is_guest( p_sys->p_session ) ) else if( smb_session_is_guest( p_sys->p_session ) )
{
msg_Warn( p_access, "Login failure but you were logged in as a Guest"); msg_Warn( p_access, "Login failure but you were logged in as a Guest");
b_guest = true;
}
success: success:
msg_Dbg( p_access, "Creds: username = '%s', domain = '%s'", msg_Warn( p_access, "Creds: username = '%s', domain = '%s'",
psz_login, psz_domain ); psz_login, psz_domain );
if( p_sys->psz_share != NULL && !b_guest )
{
p_sys->creds.login = strdup(psz_login); p_sys->creds.login = strdup(psz_login);
p_sys->creds.password = strdup(psz_password);
p_sys->creds.domain = strdup(psz_domain); p_sys->creds.domain = strdup(psz_domain);
if (!p_sys->creds.login || !p_sys->creds.password || !p_sys->creds.domain)
{ if( !vlc_credential_store( &credential ) )
free(p_sys->creds.login); p_sys->creds.password = strdup(psz_password);
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;
} }
vlc_credential_store( &credential );
i_ret = VLC_SUCCESS; i_ret = VLC_SUCCESS;
error: error:
vlc_credential_clean( &credential ); vlc_credential_clean( &credential );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment