Commit 1ec4edf0 authored by Thomas Guillem's avatar Thomas Guillem

dsm: don't store domain when it doesn't come from the user

parent e39d63e0
......@@ -323,7 +323,7 @@ static int login( access_t *p_access )
vlc_UrlParse( &url, p_access->psz_url );
vlc_credential_init( &credential, &url );
psz_var_domain = var_InheritString( p_access, "smb-domain" );
credential.psz_realm = psz_var_domain ? psz_var_domain : p_sys->netbios_name;
credential.psz_realm = psz_var_domain ? psz_var_domain : NULL;
vlc_credential_get( &credential, p_access, "smb-user", "smb-pwd",
NULL, NULL );
......@@ -339,7 +339,7 @@ static int login( access_t *p_access )
psz_login = credential.psz_username;
psz_password = credential.psz_password;
}
psz_domain = credential.psz_realm;
psz_domain = credential.psz_realm ? credential.psz_realm : p_sys->netbios_name;
/* Try to authenticate on the remote machine */
if( smb_connect( p_access, psz_login, psz_password, psz_domain )
......@@ -352,7 +352,8 @@ static int login( access_t *p_access )
b_guest = false;
psz_login = credential.psz_username;
psz_password = credential.psz_password;
psz_domain = credential.psz_realm;
psz_domain = credential.psz_realm ? credential.psz_realm
: p_sys->netbios_name;
if( smb_connect( p_access, psz_login, psz_password, psz_domain )
== VLC_SUCCESS )
goto success;
......@@ -375,7 +376,9 @@ success:
{
if( asprintf( &p_sys->psz_user_opt, "smb-user=%s", psz_login ) == -1 )
p_sys->psz_user_opt = NULL;
if( asprintf( &p_sys->psz_domain_opt, "smb-domain=%s", psz_domain ) == -1 )
if( credential.psz_realm != NULL
&& asprintf( &p_sys->psz_domain_opt, "smb-domain=%s",
credential.psz_realm ) == -1 )
p_sys->psz_domain_opt = NULL;
if( !vlc_credential_store( &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