Commit 678bc4bc authored by Thomas Guillem's avatar Thomas Guillem

libvlc: fix smb2/dsm conflicts

The smb2 module is back to higher priority again. A lot of bugs has been fixed
since the first release, notably the signing security mode. This fixes
impossible login to smb2 servers, when dsm requested first a login and smb2 was
never tried.

There is also a new patch that prevent to request 2 dialogs from both smb2 and
dsm from the same input. If smb2 login failed, it is useless to request
credentials via the dsm plugin.

PS: if the module smb2 failed because it tried to connect to a smb1 server, it
will fail without requesting any credentials, therefore the dsm module will be
able to request them.
parent e2a96329
Pipeline #9531 failed with stage
in 20 minutes and 40 seconds
From d5029395e74cc8be048da4ae9d808a82431c99aa Mon Sep 17 00:00:00 2001
Message-Id: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
From 9f981e2650b2a6707d707a974ce63d570bb87e3c Mon Sep 17 00:00:00 2001
Message-Id: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 13 Apr 2018 16:15:16 +0200
Subject: [PATCH 1/6] access: add smb2 module
Subject: [PATCH 1/7] access: add smb2 module
Using libsmb2 from Ronnie Sahlberg https://github.com/sahlberg/libsmb2
This is LGPL 2.1 fully async lib for accessing SMB2 and SMB3 shares.
......@@ -22,9 +22,9 @@ allow to use Builtin NTLMSSP authentication instead of libkrb5.
contrib/src/smb2/rules.mak | 31 +
modules/MODULES_LIST | 1 +
modules/access/Makefile.am | 11 +
modules/access/smb2.c | 731 ++++++++++++++++++
modules/access/smb2.c | 734 ++++++++++++++++++
po/POTFILES.in | 1 +
11 files changed, 1223 insertions(+), 1 deletion(-)
11 files changed, 1226 insertions(+), 1 deletion(-)
create mode 100644 contrib/src/smb2/0001-ntlmssp-add-support-for-Anonymous-logins.patch
create mode 100644 contrib/src/smb2/0002-Fix-indent-and-white-spaces.patch
create mode 100644 contrib/src/smb2/0003-Fix-getlogin-usage.patch
......@@ -34,7 +34,7 @@ allow to use Builtin NTLMSSP authentication instead of libkrb5.
create mode 100644 modules/access/smb2.c
diff --git a/configure.ac b/configure.ac
index 500fb17232..1d745affba 100644
index 304db5fabf..41aa6917ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1854,7 +1854,14 @@ AS_IF([test "${SYS}" = "mingw32" -a "${enable_winstore_app}" != "yes"], [ VLC_AD
......@@ -603,10 +603,10 @@ index 765ceec45f..2a773029e3 100644
access_LTLIBRARIES += libtcp_plugin.la
diff --git a/modules/access/smb2.c b/modules/access/smb2.c
new file mode 100644
index 0000000000..2c8a4a1b43
index 0000000000..6b56bf8706
--- /dev/null
+++ b/modules/access/smb2.c
@@ -0,0 +1,731 @@
@@ -0,0 +1,734 @@
+/*****************************************************************************
+ * smb2.c: SMB2 access plug-in
+ *****************************************************************************
......@@ -674,7 +674,7 @@ index 0000000000..2c8a4a1b43
+ set_shortname("smb2")
+ set_description(N_("SMB2 / SMB3 input"))
+ set_help(N_("Samba (Windows network shares) input via libsmb2"))
+ set_capability("access", 19)
+ set_capability("access", 21)
+ set_category(CAT_INPUT)
+ set_subcategory(SUBCAT_INPUT_ACCESS)
+ add_string("smb-user", NULL, SMB_USER_TEXT, SMB_USER_LONGTEXT, false)
......@@ -1215,6 +1215,8 @@ index 0000000000..2c8a4a1b43
+ goto error;
+ }
+
+ smb2_set_security_mode(sys->smb2, SMB2_NEGOTIATE_SIGNING_ENABLED);
+
+ if (sys->encoded_url.psz_path == NULL)
+ sys->encoded_url.psz_path = (char *) "/";
+
......@@ -1267,16 +1269,17 @@ index 0000000000..2c8a4a1b43
+ {
+ sys->error_status = 0;
+ ret = vlc_smb2_open_share(access, smb2_url, &credential);
+ if (ret == 0)
+ vlc_credential_store(&credential, access);
+ }
+ if (ret == 0)
+ vlc_credential_store(&credential, access);
+ vlc_credential_clean(&credential);
+
+ if (ret != 0)
+ {
+ vlc_dialog_display_error(access,
+ _("SMB2 operation failed"), "%s",
+ smb2_get_error(sys->smb2));
+ const char *error = smb2_get_error(sys->smb2);
+ if (error && *error)
+ vlc_dialog_display_error(access,
+ _("SMB2 operation failed"), "%s", error);
+ goto error;
+ }
+
......
From 59b1518301322884e2e9c5f3b6c63722419bc647 Mon Sep 17 00:00:00 2001
Message-Id: <59b1518301322884e2e9c5f3b6c63722419bc647.1568976855.git.thomas@gllm.fr>
In-Reply-To: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
References: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
From: Thomas Guillem <thomas@gllm.fr>
Date: Thu, 12 Sep 2019 16:06:50 +0200
Subject: [PATCH 2/7] smb2/dsm: avoid to request the dialog two times
---
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 6b56bf8706..49e4a880d7 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
From 7bf6561a375ce8c8a362c1004e8e239c8be01d41 Mon Sep 17 00:00:00 2001
Message-Id: <7bf6561a375ce8c8a362c1004e8e239c8be01d41.1565597364.git.thomas@gllm.fr>
In-Reply-To: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
References: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
From 4fc55183fffba843bb616b7f8fda92e341fbd9bd Mon Sep 17 00:00:00 2001
Message-Id: <4fc55183fffba843bb616b7f8fda92e341fbd9bd.1568976855.git.thomas@gllm.fr>
In-Reply-To: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
References: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Thu, 28 Mar 2019 15:23:48 +0100
Subject: [PATCH 2/6] compat: Workaround sendmsg bug on android
Subject: [PATCH 3/7] compat: Workaround sendmsg bug on android
This only happens on 64bits builds, see compat/sendmsg.c comments
---
......@@ -49,7 +49,7 @@ index 0f42e782f8..8d69048746 100644
#else
#error sendmsg not implemented on your platform!
diff --git a/configure.ac b/configure.ac
index 1d745affba..21f6c8fa9d 100644
index 41aa6917ea..73da8cda68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -365,6 +365,9 @@ AS_IF([test "$SYS" = linux],[
......@@ -63,7 +63,7 @@ index 1d745affba..21f6c8fa9d 100644
AC_MSG_RESULT([no])
])
diff --git a/include/vlc_network.h b/include/vlc_network.h
index 184c23acae..6a43fd7d8b 100644
index 010454a01c..1b36e3d574 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -290,6 +290,12 @@ static inline void net_SetPort (struct sockaddr *addr, uint16_t port)
......
From 3f7921570d85446cb27aa9d34703be7224013653 Mon Sep 17 00:00:00 2001
Message-Id: <3f7921570d85446cb27aa9d34703be7224013653.1565597364.git.thomas@gllm.fr>
In-Reply-To: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
References: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
From 297fc66e40620cbf5770319f46b44ebf2a70f0ed Mon Sep 17 00:00:00 2001
Message-Id: <297fc66e40620cbf5770319f46b44ebf2a70f0ed.1568976855.git.thomas@gllm.fr>
In-Reply-To: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
References: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
From: Soomin Lee <bubu@mikan.io>
Date: Thu, 27 Sep 2018 18:40:39 +0200
Subject: [PATCH 3/6] libvlc: events: Add callbacks for record
Subject: [PATCH 4/7] libvlc: events: Add callbacks for record
---
include/vlc/libvlc_events.h | 9 +++++++++
......
From 5ddcb565fb066e9437a53d1e3577ee889fe4634f Mon Sep 17 00:00:00 2001
Message-Id: <5ddcb565fb066e9437a53d1e3577ee889fe4634f.1565597364.git.thomas@gllm.fr>
In-Reply-To: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
References: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
From 94baf942264726d2a6bd702a344fd6290ad7fa04 Mon Sep 17 00:00:00 2001
Message-Id: <94baf942264726d2a6bd702a344fd6290ad7fa04.1568976855.git.thomas@gllm.fr>
In-Reply-To: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
References: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Fri, 29 Mar 2019 10:56:26 +0100
Subject: [PATCH 4/6] network: tls: Handle errors from older kernels
Subject: [PATCH 5/7] network: tls: Handle errors from older kernels
If MSG_FASTOPEN is defined, but turns out to be unimplemented by the
underlying kernel (as is the case on android where the NDK claims to
......
From 04227a406102585959981cd6e11bc347e07fedfa Mon Sep 17 00:00:00 2001
Message-Id: <04227a406102585959981cd6e11bc347e07fedfa.1565597364.git.thomas@gllm.fr>
In-Reply-To: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
References: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
From efdc52a63f702dbe5d01584005abe1c1e1d427e3 Mon Sep 17 00:00:00 2001
Message-Id: <efdc52a63f702dbe5d01584005abe1c1e1d427e3.1568976855.git.thomas@gllm.fr>
In-Reply-To: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
References: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
From: Soomin Lee <bubu@mikan.io>
Date: Mon, 1 Oct 2018 15:37:57 +0200
Subject: [PATCH 5/6] access_output: file: Add error dialog for write/open
Subject: [PATCH 6/7] access_output: file: Add error dialog for write/open
---
modules/access_output/file.c | 8 ++++++++
......
From 7bcfa93cebe9d34cad19b9eb2f4a416e9f11d931 Mon Sep 17 00:00:00 2001
Message-Id: <7bcfa93cebe9d34cad19b9eb2f4a416e9f11d931.1565597364.git.thomas@gllm.fr>
In-Reply-To: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
References: <d5029395e74cc8be048da4ae9d808a82431c99aa.1565597364.git.thomas@gllm.fr>
From 114668b6c33d47d59f0f2bed887f1510360af843 Mon Sep 17 00:00:00 2001
Message-Id: <114668b6c33d47d59f0f2bed887f1510360af843.1568976855.git.thomas@gllm.fr>
In-Reply-To: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
References: <9f981e2650b2a6707d707a974ce63d570bb87e3c.1568976855.git.thomas@gllm.fr>
From: Soomin Lee <bubu@mikan.io>
Date: Wed, 31 Oct 2018 10:08:55 +0100
Subject: [PATCH 6/6] libvlc: media_player: Add record method
Subject: [PATCH 7/7] libvlc: media_player: Add record method
---
include/vlc/libvlc_media_player.h | 13 +++++++++++++
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment