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

Thomas Guillem thomas at gllm.fr
Thu Sep 12 16:11:55 CEST 2019


---
 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 e5496a6a31..f4f8d0abbc 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -671,6 +671,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