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

Thomas Guillem git at videolan.org
Fri Oct 18 10:52:04 CEST 2019


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Sep 12 16:06:50 2019 +0200| [17f43b73741f181040fc7fa40929f5e417764bc5] | committer: Thomas Guillem

smb2/dsm: avoid to request the dialog two times

(cherry picked from commit 40035be6ba784321997dfc8fe076471c958c5206)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=17f43b73741f181040fc7fa40929f5e417764bc5
---

 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 be1447d1a8..1a93dc97ea 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;
     }
 



More information about the vlc-commits mailing list