[vlc-commits] dsm: don't save Guest login/password into item options
Thomas Guillem
git at videolan.org
Thu May 21 17:10:50 CEST 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May 21 09:48:11 2015 +0200| [cd9f04fda25b92cf6389bdc3dc0819a27aff5507] | committer: Thomas Guillem
dsm: don't save Guest login/password into item options
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cd9f04fda25b92cf6389bdc3dc0819a27aff5507
---
modules/access/dsm/access.c | 54 +++++++++++++++++++++++--------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 26a3754..2e47619 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -285,11 +285,7 @@ static void get_credentials( access_t *p_access )
split_domain_login( &p_sys->creds.login, &p_sys->creds.domain );
}
else
- {
p_sys->creds.login = var_InheritString( p_access, "smb-user" );
- if( p_sys->creds.login == NULL )
- p_sys->creds.login = strdup( "Guest" );
- }
if( p_sys->creds.domain == NULL )
p_sys->creds.domain = var_InheritString( p_access, "smb-domain" );
@@ -383,11 +379,15 @@ static void login_dialog( access_t *p_access )
static int smb_connect( access_t *p_access )
{
access_sys_t *p_sys = p_access->p_sys;
+ const char *psz_login = p_sys->creds.login ?
+ p_sys->creds.login : "Guest";
+ const char *psz_password = p_sys->creds.password ?
+ p_sys->creds.password : "Guest";
const char *psz_domain = p_sys->creds.domain ?
p_sys->creds.domain : p_sys->netbios_name;
smb_session_set_creds( p_sys->p_session, psz_domain,
- p_sys->creds.login, p_sys->creds.password );
+ psz_login, psz_password );
if( smb_session_login( p_sys->p_session ) )
{
if( p_sys->psz_share )
@@ -409,11 +409,6 @@ static int login( access_t *p_access )
{
access_sys_t *p_sys = p_access->p_sys;
- if( p_sys->creds.login == NULL )
- p_sys->creds.login = strdup( "Guest" );
- if( p_sys->creds.password == NULL )
- p_sys->creds.password = strdup( "Guest" );
-
/* Try to authenticate on the remote machine */
if( smb_connect( p_access ) != VLC_SUCCESS )
{
@@ -596,23 +591,32 @@ static input_item_t *new_item( access_t *p_access, const char *psz_name,
/* Here we save on the node the credentials that allowed us to login.
* That way the user isn't prompted more than once for credentials */
- i_ret = asprintf( &psz_option, "smb-user=%s", p_sys->creds.login );
- if( i_ret == -1 )
- goto bailout;
- input_item_AddOption( p_item, psz_option, VLC_INPUT_OPTION_TRUSTED );
- free( psz_option );
+ if( p_sys->creds.login )
+ {
+ i_ret = asprintf( &psz_option, "smb-user=%s", p_sys->creds.login );
+ if( i_ret == -1 )
+ goto bailout;
+ input_item_AddOption( p_item, psz_option, VLC_INPUT_OPTION_TRUSTED );
+ free( psz_option );
+ }
- i_ret = asprintf( &psz_option, "smb-pwd=%s", p_sys->creds.password );
- if( i_ret == -1 )
- goto bailout;
- input_item_AddOption( p_item, psz_option, VLC_INPUT_OPTION_TRUSTED );
- free( psz_option );
+ if( p_sys->creds.password )
+ {
+ i_ret = asprintf( &psz_option, "smb-pwd=%s", p_sys->creds.password );
+ if( i_ret == -1 )
+ goto bailout;
+ input_item_AddOption( p_item, psz_option, VLC_INPUT_OPTION_TRUSTED );
+ free( psz_option );
+ }
- i_ret = asprintf( &psz_option, "smb-domain=%s", p_sys->creds.domain );
- if( i_ret == -1 )
- goto bailout;
- input_item_AddOption( p_item, psz_option, VLC_INPUT_OPTION_TRUSTED );
- free( psz_option );
+ if( p_sys->creds.domain )
+ {
+ i_ret = asprintf( &psz_option, "smb-domain=%s", p_sys->creds.domain );
+ if( i_ret == -1 )
+ goto bailout;
+ input_item_AddOption( p_item, psz_option, VLC_INPUT_OPTION_TRUSTED );
+ free( psz_option );
+ }
return p_item;
bailout:
More information about the vlc-commits
mailing list