[vlc-commits] dsm: factor set_creds and login
Thomas Guillem
git at videolan.org
Thu May 21 17:10:50 CEST 2015
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed May 20 18:50:21 2015 +0200| [6f4454b3b4943e65f2415aaeacbfd993e83183e6] | committer: Thomas Guillem
dsm: factor set_creds and login
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f4454b3b4943e65f2415aaeacbfd993e83183e6
---
modules/access/dsm/access.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index bce5627..2c769c0 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -382,6 +382,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;
+
+ smb_session_set_creds( p_sys->p_session, p_sys->creds.domain,
+ p_sys->creds.login, p_sys->creds.password );
+ return smb_session_login( p_sys->p_session ) ? VLC_SUCCESS : VLC_EGENERIC;
+}
+
/* Performs login with existing credentials and ask the user for new ones on
failure */
static int login( access_t *p_access )
@@ -396,16 +405,12 @@ static int login( access_t *p_access )
p_sys->creds.domain = strdup( "WORKGROUP" );
/* Try to authenticate on the remote machine */
- smb_session_set_creds( p_sys->p_session, p_sys->creds.domain,
- p_sys->creds.login, p_sys->creds.password );
- if( !smb_session_login( p_sys->p_session ) )
+ if( smb_connect( p_access ) != VLC_SUCCESS )
{
for( int i = 0; i < BDSM_LOGIN_DIALOG_RETRY; i++ )
{
login_dialog( p_access );
- smb_session_set_creds( p_sys->p_session, p_sys->creds.domain,
- p_sys->creds.login, p_sys->creds.password );
- if( smb_session_login( p_sys->p_session ) )
+ if( smb_connect( p_access ) == VLC_SUCCESS )
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list