mirror of
https://github.com/videolan/vlc.git
synced 2024-11-27 20:03:31 +08:00
dsm: don't store domain when it doesn't come from the user
This commit is contained in:
parent
e39d63e08e
commit
1ec4edf04a
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user