[vlc-commits] dsm: add "smb-force-v1" option

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


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Oct 17 10:10:20 2019 +0200| [62dc0bb729d4a1b556d7582ffb99dc5361e2c174] | committer: Thomas Guillem

dsm: add "smb-force-v1" option

If this option is enabled, libdsm will be probed before libsmb2. Use at your
own risk, this option should be always disabled by default and specifically
requested by the user.

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

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

 modules/access/dsm/access.c | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)

diff --git a/modules/access/dsm/access.c b/modules/access/dsm/access.c
index 10dec0710f..fb8b7f516d 100644
--- a/modules/access/dsm/access.c
+++ b/modules/access/dsm/access.c
@@ -56,7 +56,16 @@ int bdsm_SdOpen( vlc_object_t * );
 void bdsm_SdClose( vlc_object_t * );
 int bdsm_sd_probe_Open( vlc_object_t * );
 
-static int Open( vlc_object_t * );
+/* Not translated since added after the VLC 3.0 release */
+#define SMB_FORCE_V1_TEXT "Force the SMBv1 protocol (At your own risk)"
+#define SMB_FORCE_V1_LONGTEXT \
+    "Enable it, at your own risk, if you can't connect to Windows shares. " \
+    "If this option is needed, you should consider updating your Windows / " \
+    "Samba server and disabling the SMBv1 protocol as using this protocol " \
+    "has security implications."
+
+static int OpenNotForced( vlc_object_t * );
+static int OpenForced( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 VLC_SD_PROBE_HELPER( "dsm", N_("Windows networks"), SD_CAT_LAN )
@@ -67,14 +76,21 @@ vlc_module_begin ()
     set_shortname( "dsm" )
     set_description( N_("libdsm SMB input") )
     set_help(BDSM_HELP)
-    set_capability( "access", 20 )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_ACCESS )
     add_string( "smb-user", NULL, SMB_USER_TEXT, SMB_USER_LONGTEXT, false )
     add_password( "smb-pwd", NULL, SMB_PASS_TEXT, SMB_PASS_LONGTEXT, false )
     add_string( "smb-domain", NULL, SMB_DOMAIN_TEXT, SMB_DOMAIN_LONGTEXT, false )
+    add_bool( "smb-force-v1", false, SMB_FORCE_V1_TEXT, SMB_FORCE_V1_LONGTEXT, false )
     add_shortcut( "smb", "cifs" )
-    set_callbacks( Open, Close )
+
+    set_capability( "access", 22 )
+    set_callbacks( OpenForced, Close )
+
+    add_submodule()
+        set_capability( "access", 20 )
+        set_callbacks( OpenNotForced, Close )
+        add_shortcut( "smb", "cifs" )
 
     add_submodule()
         add_shortcut( "dsm-sd" )
@@ -194,6 +210,23 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 }
 
+static int OpenForced( vlc_object_t *p_this )
+{
+    if( !var_InheritBool( p_this , "smb-force-v1" ) )
+        return VLC_EGENERIC;
+
+    msg_Warn( p_this, "SMB 2/3 disabled by the user, using *unsafe* SMB 1" );
+    return Open( p_this );
+}
+
+static int OpenNotForced( vlc_object_t *p_this )
+{
+    if( var_InheritBool( p_this , "smb-force-v1" ) )
+        return VLC_EGENERIC; /* OpenForced should have breen probed first */
+
+    return Open( p_this );
+}
+
 /*****************************************************************************
  * Close: free unused data structures
  *****************************************************************************/



More information about the vlc-commits mailing list