Commit 874245a2 authored by Thomas Guillem's avatar Thomas Guillem
Browse files

dsm: try to connect to the share to check if login is valid

If the host accepts guests, the login will be valid but we won't be able to
connect to the share.
parent 9acd0bb3
......@@ -180,23 +180,21 @@ static int Open( vlc_object_t *p_this )
goto error;
}
get_path( p_access );
if( login( p_access ) != VLC_SUCCESS )
{
msg_Err( p_access, "Unable to connect to share %s", p_sys->psz_share );
goto error;
}
if( !get_path( p_access ) )
/* If there is no shares, browse them */
if( !p_sys->psz_share )
return BrowserInit( p_access );
msg_Dbg( p_access, "Path: Share name = %s, path = %s", p_sys->psz_share,
p_sys->psz_path );
/* Connect to the share */
p_sys->i_tid = smb_tree_connect( p_sys->p_session, p_sys->psz_share );
if( !p_sys->i_tid )
{
msg_Err( p_access, "Unable to connect to share %s", p_sys->psz_share );
goto error;
}
/* Let's finally ask a handle to the file we wanna read ! */
p_sys->i_fd = smb_fopen( p_sys->p_session, p_sys->i_tid, p_sys->psz_path,
SMB_MOD_RO );
......@@ -390,7 +388,19 @@ static int smb_connect( access_t *p_access )
smb_session_set_creds( p_sys->p_session, psz_domain,
p_sys->creds.login, p_sys->creds.password );
return smb_session_login( p_sys->p_session ) ? VLC_SUCCESS : VLC_EGENERIC;
if( smb_session_login( p_sys->p_session ) )
{
if( p_sys->psz_share )
{
/* Connect to the share */
p_sys->i_tid = smb_tree_connect( p_sys->p_session, p_sys->psz_share );
if( !p_sys->i_tid )
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
else
return VLC_EGENERIC;
}
/* Performs login with existing credentials and ask the user for new ones on
......
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