Commit 6f4454b3 authored by Thomas Guillem's avatar Thomas Guillem

dsm: factor set_creds and login

parent 1ba5920a
...@@ -382,6 +382,15 @@ static void login_dialog( access_t *p_access ) ...@@ -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 /* Performs login with existing credentials and ask the user for new ones on
failure */ failure */
static int login( access_t *p_access ) static int login( access_t *p_access )
...@@ -396,16 +405,12 @@ static int login( access_t *p_access ) ...@@ -396,16 +405,12 @@ static int login( access_t *p_access )
p_sys->creds.domain = strdup( "WORKGROUP" ); p_sys->creds.domain = strdup( "WORKGROUP" );
/* Try to authenticate on the remote machine */ /* Try to authenticate on the remote machine */
smb_session_set_creds( p_sys->p_session, p_sys->creds.domain, if( smb_connect( p_access ) != VLC_SUCCESS )
p_sys->creds.login, p_sys->creds.password );
if( !smb_session_login( p_sys->p_session ) )
{ {
for( int i = 0; i < BDSM_LOGIN_DIALOG_RETRY; i++ ) for( int i = 0; i < BDSM_LOGIN_DIALOG_RETRY; i++ )
{ {
login_dialog( p_access ); login_dialog( p_access );
smb_session_set_creds( p_sys->p_session, p_sys->creds.domain, if( smb_connect( p_access ) == VLC_SUCCESS )
p_sys->creds.login, p_sys->creds.password );
if( smb_session_login( p_sys->p_session ) )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
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