[vlc-commits] smb2/dsm: avoid to request the dialog two times

Thomas Guillem git at videolan.org
Mon Sep 16 11:46:36 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 12 16:06:50 2019 +0200| [40035be6ba784321997dfc8fe076471c958c5206] | committer: Thomas Guillem

smb2/dsm: avoid to request the dialog two times

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

 modules/access/dsm/access.c | 6 ++++++
 modules/access/smb2.c       | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index a7252350d0..976765399c 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -334,6 +334,12 @@ static int login( stream_t *p_access )
     if( smb_connect( p_access, psz_login, psz_password, psz_domain )
                      != VLC_SUCCESS )
     {
+        if (var_Type(p_access, "smb-dialog-failed") != 0)
+        {
+            /* A higher priority smb module (likely smb2) already requested
+             * credentials to the users. It is useless to request it again. */
+            goto error;
+        }
         while( vlc_credential_get( &credential, p_access, "smb-user", "smb-pwd",
                                    SMB_LOGIN_DIALOG_TITLE,
                                    SMB_LOGIN_DIALOG_TEXT, p_sys->netbios_name ) )
diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index c85aa54e56..d6d55c5ffc 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -673,6 +673,13 @@ Open(vlc_object_t *p_obj)
         if (error && *error)
             vlc_dialog_display_error(access,
                                      _("SMB2 operation failed"), "%s", error);
+        if (credential.i_get_order == GET_FROM_DIALOG)
+        {
+            /* Tell other smb modules (likely dsm) that we already requested
+             * credential to the users and that it it useless to try again.
+             * This avoid to show 2 login dialogs for the same access. */
+            var_Create(access, "smb-dialog-failed", VLC_VAR_VOID);
+        }
         goto error;
     }
 



More information about the vlc-commits mailing list