[vlc-devel] [PATCH 3/3] smb2/dsm: avoid to request the dialog two times

Thomas Guillem thomas at gllm.fr
Thu Oct 17 15:16:32 CEST 2019


(cherry picked from commit 40035be6ba784321997dfc8fe076471c958c5206)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
---
 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 cf84161523..7d203d735b 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -332,6 +332,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 5ac7b1ea48..98acb8a97c 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -681,6 +681,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;
     }
 
-- 
2.20.1



More information about the vlc-devel mailing list