[vlc-commits] dsm: don't store domain when it doesn't come from the user

Thomas Guillem git at videolan.org
Sun Jan 24 12:18:59 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Jan 24 11:40:42 2016 +0100| [1ec4edf04a9155545e31a223e7ec76ea54300415] | committer: Thomas Guillem

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ec4edf04a9155545e31a223e7ec76ea54300415
---

 modules/access/dsm/access.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 03446b7..6aa60e7 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -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 )



More information about the vlc-commits mailing list