Commit 498972e4 authored by Thomas Guillem's avatar Thomas Guillem

update SMB2 patches from 4.0/master

parent d2e58e55
From b4d0f49473c29d09060528c64d130ff9543a289a Mon Sep 17 00:00:00 2001
From 582275c70b3441d1b8e8eaf6a196c719254efdfe Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 13 Apr 2018 16:15:16 +0200
Subject: [PATCH] access: add smb2 module
......@@ -12,20 +12,22 @@ mechanism, therefore every network requests are cancellable almost immediately.
The 2.0.0 version is required since this version drop OpenSSL dependency and
allow to use Builtin NTLMSSP authentication instead of libkrb5.
---
configure.ac | 14 +-
contrib/src/smb2/SHA512SUMS | 1 +
contrib/src/smb2/rules.mak | 27 ++
modules/MODULES_LIST | 1 +
modules/access/Makefile.am | 11 +
modules/access/smb2.c | 721 ++++++++++++++++++++++++++++++++++++
po/POTFILES.in | 1 +
7 files changed, 775 insertions(+), 1 deletion(-)
configure.ac | 14 +-
contrib/src/smb2/0001-master-backport.patch | 330 +++++++++
contrib/src/smb2/SHA512SUMS | 1 +
contrib/src/smb2/rules.mak | 28 +
modules/MODULES_LIST | 1 +
modules/access/Makefile.am | 11 +
modules/access/smb2.c | 717 ++++++++++++++++++++
po/POTFILES.in | 1 +
8 files changed, 1102 insertions(+), 1 deletion(-)
create mode 100644 contrib/src/smb2/0001-master-backport.patch
create mode 100644 contrib/src/smb2/SHA512SUMS
create mode 100644 contrib/src/smb2/rules.mak
create mode 100644 modules/access/smb2.c
diff --git a/configure.ac b/configure.ac
index fbc92f952d..5700403019 100644
index 49b1166742..7bcdb44c9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1854,7 +1854,14 @@ AS_IF([test "${SYS}" = "mingw32" -a "${enable_winstore_app}" != "yes"], [ VLC_AD
......@@ -56,6 +58,342 @@ index fbc92f952d..5700403019 100644
dnl
dnl Video4Linux 2
dnl
diff --git a/contrib/src/smb2/0001-master-backport.patch b/contrib/src/smb2/0001-master-backport.patch
new file mode 100644
index 0000000000..0f9cf7cf62
--- /dev/null
+++ b/contrib/src/smb2/0001-master-backport.patch
@@ -0,0 +1,330 @@
+From 49525025f8c91ae14e5fe3cfea0dc7948b7f5480 Mon Sep 17 00:00:00 2001
+From: Thomas Guillem <thomas@gllm.fr>
+Date: Tue, 12 Feb 2019 12:42:37 +0100
+Subject: [PATCH] master-backport
+
+Waiting for a new release, including the following patches:
+
+libsmb_error patch
+Delete libsmb2_error.latest.patch
+Allow passing NULL to smb2_set_password
+Add more error status
+Map more EACCESS error status
+---
+ include/smb2/smb2-errors.h | 50 +++++++++++
+ lib/errors.c | 178 +++++++++++++++++++++++++++++++++++--
+ lib/init.c | 4 +
+ 3 files changed, 223 insertions(+), 9 deletions(-)
+
+diff --git a/include/smb2/smb2-errors.h b/include/smb2/smb2-errors.h
+index 49c5d5c..3b741e7 100644
+--- a/include/smb2/smb2-errors.h
++++ b/include/smb2/smb2-errors.h
+@@ -35,13 +35,63 @@
+ /* Error codes */
+ #define SMB2_STATUS_SUCCESS 0x00000000
+ #define SMB2_STATUS_PENDING 0x00000103
++#define SMB2_STATUS_SMB_BAD_FID 0x00060001
+ #define SMB2_STATUS_NO_MORE_FILES 0x80000006
++#define SMB2_STATUS_NOT_IMPLEMENTED 0xC0000002
++#define SMB2_STATUS_INVALID_HANDLE 0xC0000008
+ #define SMB2_STATUS_INVALID_PARAMETER 0xC000000d
++#define SMB2_STATUS_NO_SUCH_DEVICE 0xC000000E
++#define SMB2_STATUS_NO_SUCH_FILE 0xC000000F
++#define SMB2_STATUS_INVALID_DEVICE_REQUEST 0xC0000010
+ #define SMB2_STATUS_END_OF_FILE 0xC0000011
++#define SMB2_STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
+ #define SMB2_STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
++#define SMB2_STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
++#define SMB2_STATUS_INVALID_VIEW_SIZE 0xC000001F
++#define SMB2_STATUS_ALREADY_COMMITTED 0xC0000021
+ #define SMB2_STATUS_ACCESS_DENIED 0xC0000022
++#define SMB2_STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
+ #define SMB2_STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
++#define SMB2_STATUS_OBJECT_NAME_COLLISION 0xC0000035
++#define SMB2_STATUS_PORT_DISCONNECTED 0xC0000037
++#define SMB2_STATUS_OBJECT_PATH_INVALID 0xC0000039
++#define SMB2_STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
++#define SMB2_STATUS_OBJECT_PATH_SYNTAX_BAD 0xC000003B
++#define SMB2_STATUS_DATA_ERROR 0xC000003E
++#define SMB2_STATUS_CRC_ERROR 0xC000003F
++#define SMB2_STATUS_SECTION_TOO_BIG 0xC0000040
++#define SMB2_STATUS_PORT_CONNECTION_REFUSED 0xC0000041
++#define SMB2_STATUS_INVALID_PORT_HANDLE 0xC0000042
++#define SMB2_STATUS_SHARING_VIOLATION 0xC0000043
++#define SMB2_STATUS_THREAD_IS_TERMINATING 0xC000004B
++#define SMB2_STATUS_FILE_LOCK_CONFLICT 0xC0000054
++#define SMB2_STATUS_LOCK_NOT_GRANTED 0xC0000055
++#define SMB2_STATUS_DELETE_PENDING 0xC0000056
++#define SMB2_STATUS_PRIVILEGE_NOT_HELD 0xC0000061
+ #define SMB2_STATUS_LOGON_FAILURE 0xC000006d
++#define SMB2_STATUS_ACCOUNT_RESTRICTION 0xC000006E
++#define SMB2_STATUS_INVALID_LOGON_HOURS 0xC000006F
++#define SMB2_STATUS_PASSWORD_EXPIRED 0xC0000071
++#define SMB2_STATUS_ACCOUNT_DISABLED 0xC0000072
++#define SMB2_STATUS_DISK_FULL 0xC000007F
++#define SMB2_STATUS_TOO_MANY_PAGING_FILES 0xC0000097
++#define SMB2_STATUS_DFS_EXIT_PATH_FOUND 0xC000009B
++#define SMB2_STATUS_DEVICE_DATA_ERROR 0xC000009C
++#define SMB2_STATUS_MEDIA_WRITE_PROTECTED 0xC00000A2
++#define SMB2_STATUS_ILLEGAL_FUNCTION 0xC00000AF
++#define SMB2_STATUS_PIPE_DISCONNECTED 0xC00000B0
++#define SMB2_STATUS_FILE_IS_A_DIRECTORY 0xC00000BA
++#define SMB2_STATUS_NETWORK_ACCESS_DENIED 0xC00000CA
+ #define SMB2_STATUS_BAD_NETWORK_NAME 0xC00000CC
++#define SMB2_STATUS_NOT_SAME_DEVICE 0xC00000D4
++#define SMB2_STATUS_FILE_RENAMED 0xC00000D5
++#define SMB2_STATUS_REDIRECTOR_NOT_STARTED 0xC00000FB
++#define SMB2_STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
+ #define SMB2_STATUS_NOT_A_DIRECTORY 0xC0000103
++#define SMB2_STATUS_PROCESS_IS_TERMINATING 0xC000010A
++#define SMB2_STATUS_TOO_MANY_OPENED_FILES 0xC000011F
++#define SMB2_STATUS_CANNOT_DELETE 0xC0000121
++#define SMB2_STATUS_FILE_DELETED 0xC0000123
+ #define SMB2_STATUS_FILE_CLOSED 0xC0000128
++#define SMB2_STATUS_INSUFF_SERVER_RESOURCES 0xC0000205
++#define SMB2_STATUS_HANDLE_NOT_CLOSABLE 0xC0000235
+diff --git a/lib/errors.c b/lib/errors.c
+index 68150a0..2e1648d 100644
+--- a/lib/errors.c
++++ b/lib/errors.c
+@@ -30,26 +30,124 @@ const char *nterror_to_str(uint32_t status) {
+ return "STATUS_PENDING";
+ case SMB2_STATUS_NO_MORE_FILES:
+ return "STATUS_NO_MORE_FILES";
++ case SMB2_STATUS_NOT_IMPLEMENTED:
++ return "STATUS_NOT_IMPLEMENTED";
++ case SMB2_STATUS_INVALID_HANDLE:
++ return "STATUS_INVALID_HANDLE";
++ case SMB2_STATUS_INVALID_PARAMETER:
++ return "STATUS_INVALID_PARAMETER";
++ case SMB2_STATUS_NO_SUCH_DEVICE:
++ return "STATUS_NO_SUCH_DEVICE";
++ case SMB2_STATUS_NO_SUCH_FILE:
++ return "STATUS_NO_SUCH_FILE";
++ case SMB2_STATUS_INVALID_DEVICE_REQUEST:
++ return "STATUS_INVALID_DEVICE_REQUEST";
++ case SMB2_STATUS_END_OF_FILE:
++ return "STATUS_END_OF_FILE";
++ case SMB2_STATUS_NO_MEDIA_IN_DEVICE:
++ return "STATUS_NO_MEDIA_IN_DEVICE";
+ case SMB2_STATUS_MORE_PROCESSING_REQUIRED:
+ return "STATUS_MORE_PROCESSING_REQUIRED";
++ case SMB2_STATUS_INVALID_LOCK_SEQUENCE:
++ return "STATUS_INVALID_LOCK_SEQUENCE";
++ case SMB2_STATUS_INVALID_VIEW_SIZE:
++ return "STATUS_INVALID_VIEW_SIZE";
++ case SMB2_STATUS_ALREADY_COMMITTED:
++ return "STATUS_ALREADY_COMMITTED";
+ case SMB2_STATUS_ACCESS_DENIED:
+ return "STATUS_ACCESS_DENIED";
++ case SMB2_STATUS_OBJECT_TYPE_MISMATCH:
++ return "STATUS_OBJECT_TYPE_MISMATCH";
++ case SMB2_STATUS_OBJECT_NAME_NOT_FOUND:
++ return "STATUS_OBJECT_NAME_NOT_FOUND";
++ case SMB2_STATUS_OBJECT_NAME_COLLISION:
++ return "STATUS_OBJECT_NAME_COLLISION";
++ case SMB2_STATUS_PORT_DISCONNECTED:
++ return "STATUS_PORT_DISCONNECTED";
++ case SMB2_STATUS_OBJECT_PATH_INVALID:
++ return "STATUS_OBJECT_PATH_INVALID";
++ case SMB2_STATUS_OBJECT_PATH_NOT_FOUND:
++ return "STATUS_OBJECT_PATH_NOT_FOUND";
++ case SMB2_STATUS_OBJECT_PATH_SYNTAX_BAD:
++ return "STATUS_OBJECT_PATH_SYNTAX_BAD";
++ case SMB2_STATUS_DATA_ERROR:
++ return "STATUS_DATA_ERROR";
++ case SMB2_STATUS_CRC_ERROR:
++ return "STATUS_CRC_ERROR";
++ case SMB2_STATUS_SECTION_TOO_BIG:
++ return "STATUS_SECTION_TOO_BIG";
++ case SMB2_STATUS_PORT_CONNECTION_REFUSED:
++ return "STATUS_PORT_CONNECTION_REFUSED";
++ case SMB2_STATUS_INVALID_PORT_HANDLE:
++ return "STATUS_INVALID_PORT_HANDLE";
++ case SMB2_STATUS_SHARING_VIOLATION:
++ return "STATUS_SHARING_VIOLATION";
++ case SMB2_STATUS_THREAD_IS_TERMINATING:
++ return "STATUS_THREAD_IS_TERMINATING";
++ case SMB2_STATUS_FILE_LOCK_CONFLICT:
++ return "STATUS_FILE_LOCK_CONFLICT";
++ case SMB2_STATUS_LOCK_NOT_GRANTED:
++ return "STATUS_LOCK_NOT_GRANTED";
++ case SMB2_STATUS_DELETE_PENDING:
++ return "STATUS_DELETE_PENDING";
++ case SMB2_STATUS_PRIVILEGE_NOT_HELD:
++ return "STATUS_PRIVILEGE_NOT_HELD";
+ case SMB2_STATUS_LOGON_FAILURE:
+ return "STATUS_LOGON_FAILURE";
++ case SMB2_STATUS_ACCOUNT_RESTRICTION:
++ return "STATUS_ACCOUNT_RESTRICTION";
++ case SMB2_STATUS_INVALID_LOGON_HOURS:
++ return "STATUS_INVALID_LOGON_HOURS";
++ case SMB2_STATUS_PASSWORD_EXPIRED:
++ return "STATUS_PASSWORD_EXPIRED";
++ case SMB2_STATUS_ACCOUNT_DISABLED:
++ return "STATUS_ACCOUNT_DISABLED";
++ case SMB2_STATUS_DISK_FULL:
++ return "STATUS_DISK_FULL";
++ case SMB2_STATUS_TOO_MANY_PAGING_FILES:
++ return "STATUS_TOO_MANY_PAGING_FILES";
++ case SMB2_STATUS_DFS_EXIT_PATH_FOUND:
++ return "STATUS_DFS_EXIT_PATH_FOUND";
++ case SMB2_STATUS_DEVICE_DATA_ERROR:
++ return "STATUS_DEVICE_DATA_ERROR";
++ case SMB2_STATUS_MEDIA_WRITE_PROTECTED:
++ return "STATUS_MEDIA_WRITE_PROTECTED";
++ case SMB2_STATUS_ILLEGAL_FUNCTION:
++ return "STATUS_ILLEGAL_FUNCTION";
++ case SMB2_STATUS_PIPE_DISCONNECTED:
++ return "STATUS_PIPE_DISCONNECTED";
++ case SMB2_STATUS_FILE_IS_A_DIRECTORY:
++ return "STATUS_FILE_IS_A_DIRECTORY";
++ case SMB2_STATUS_NETWORK_ACCESS_DENIED:
++ return "STATUS_NETWORK_ACCESS_DENIED";
+ case SMB2_STATUS_BAD_NETWORK_NAME:
+ return "STATUS_BAD_NETWORK_NAME";
++ case SMB2_STATUS_NOT_SAME_DEVICE:
++ return "STATUS_NOT_SAME_DEVICE";
++ case SMB2_STATUS_FILE_RENAMED:
++ return "STATUS_FILE_RENAMED";
++ case SMB2_STATUS_REDIRECTOR_NOT_STARTED:
++ return "STATUS_REDIRECTOR_NOT_STARTED";
++ case SMB2_STATUS_DIRECTORY_NOT_EMPTY:
++ return "STATUS_DIRECTORY_NOT_EMPTY";
+ case SMB2_STATUS_NOT_A_DIRECTORY:
+ return "STATUS_NOT_A_DIRECTORY";
+- case SMB2_STATUS_INVALID_PARAMETER:
+- return "STATUS_INVALID_PARAMETER";
+- case SMB2_STATUS_END_OF_FILE:
+- return "STATUS_END_OF_FILE";
++ case SMB2_STATUS_PROCESS_IS_TERMINATING:
++ return "STATUS_PROCESS_IS_TERMINATING";
++ case SMB2_STATUS_TOO_MANY_OPENED_FILES:
++ return "STATUS_TOO_MANY_OPENED_FILES";
++ case SMB2_STATUS_CANNOT_DELETE:
++ return "STATUS_CANNOT_DELETE";
++ case SMB2_STATUS_FILE_DELETED:
++ return "STATUS_FILE_DELETED";
+ case SMB2_STATUS_FILE_CLOSED:
+ return "STATUS_FILE_CLOSED";
+- case SMB2_STATUS_OBJECT_NAME_NOT_FOUND:
+- return "STATUS_OBJECT_NAME_NOT_FOUND";
++ case SMB2_STATUS_INSUFF_SERVER_RESOURCES:
++ return "STATUS_INSUFF_SERVER_RESOURCES";
++ case SMB2_STATUS_HANDLE_NOT_CLOSABLE:
++ return "STATUS_HANDLE_NOT_CLOSABLE";
+ default:
+- return "Unknown";
++ return "Unknown";
+ }
+ }
+
+@@ -58,25 +156,87 @@ int nterror_to_errno(uint32_t status) {
+ case SMB2_STATUS_SUCCESS:
+ case SMB2_STATUS_END_OF_FILE:
+ return 0;
++ case SMB2_STATUS_PENDING:
++ return EAGAIN;
++ case SMB2_STATUS_NO_SUCH_FILE:
++ case SMB2_STATUS_NO_SUCH_DEVICE:
+ case SMB2_STATUS_BAD_NETWORK_NAME:
+ case SMB2_STATUS_OBJECT_NAME_NOT_FOUND:
++ case SMB2_STATUS_OBJECT_PATH_INVALID:
++ case SMB2_STATUS_OBJECT_PATH_NOT_FOUND:
++ case SMB2_STATUS_OBJECT_PATH_SYNTAX_BAD:
++ case SMB2_STATUS_DFS_EXIT_PATH_FOUND:
++ case SMB2_STATUS_REDIRECTOR_NOT_STARTED:
+ return ENOENT;
+ case SMB2_STATUS_FILE_CLOSED:
++ case SMB2_STATUS_SMB_BAD_FID:
++ case SMB2_STATUS_INVALID_HANDLE:
++ case SMB2_STATUS_OBJECT_TYPE_MISMATCH:
++ case SMB2_STATUS_PORT_DISCONNECTED:
++ case SMB2_STATUS_INVALID_PORT_HANDLE:
++ case SMB2_STATUS_HANDLE_NOT_CLOSABLE:
+ return EBADF;
+ case SMB2_STATUS_MORE_PROCESSING_REQUIRED:
+ return EAGAIN;
+ case SMB2_STATUS_ACCESS_DENIED:
++ case SMB2_STATUS_NETWORK_ACCESS_DENIED:
++ case SMB2_STATUS_ACCOUNT_RESTRICTION:
++ case SMB2_STATUS_INVALID_LOGON_HOURS:
++ case SMB2_STATUS_PASSWORD_EXPIRED:
++ case SMB2_STATUS_ACCOUNT_DISABLED:
+ return EACCES;
+- case SMB2_STATUS_PENDING:
+- return EAGAIN;
++ case SMB2_STATUS_INVALID_LOCK_SEQUENCE:
++ case SMB2_STATUS_INVALID_VIEW_SIZE:
++ case SMB2_STATUS_ALREADY_COMMITTED:
++ case SMB2_STATUS_PORT_CONNECTION_REFUSED:
++ case SMB2_STATUS_THREAD_IS_TERMINATING:
++ case SMB2_STATUS_DELETE_PENDING:
++ case SMB2_STATUS_PRIVILEGE_NOT_HELD:
++ case SMB2_STATUS_FILE_IS_A_DIRECTORY:
++ case SMB2_STATUS_FILE_RENAMED:
++ case SMB2_STATUS_PROCESS_IS_TERMINATING:
++ case SMB2_STATUS_DIRECTORY_NOT_EMPTY:
++ case SMB2_STATUS_CANNOT_DELETE:
++ case SMB2_STATUS_FILE_DELETED:
++ return EPERM;
+ case SMB2_STATUS_NO_MORE_FILES:
+ return ENODATA;
+ case SMB2_STATUS_LOGON_FAILURE:
+ return ECONNREFUSED;
+ case SMB2_STATUS_NOT_A_DIRECTORY:
+ return ENOTDIR;
++ case SMB2_STATUS_NOT_IMPLEMENTED:
++ case SMB2_STATUS_INVALID_DEVICE_REQUEST:
++ case SMB2_STATUS_ILLEGAL_FUNCTION:
+ case SMB2_STATUS_INVALID_PARAMETER:
+ return EINVAL;
++ case SMB2_STATUS_TOO_MANY_OPENED_FILES:
++ return EMFILE;
++ case SMB2_STATUS_SECTION_TOO_BIG:
++ case SMB2_STATUS_TOO_MANY_PAGING_FILES:
++ case SMB2_STATUS_INSUFF_SERVER_RESOURCES:
++ return ENOMEM;
++ case SMB2_STATUS_NOT_SAME_DEVICE:
++ return EXDEV;
++ case SMB2_STATUS_SHARING_VIOLATION:
++ return ETXTBSY;
++ case SMB2_STATUS_FILE_LOCK_CONFLICT:
++ case SMB2_STATUS_LOCK_NOT_GRANTED:
++ return EDEADLK;
++ case SMB2_STATUS_OBJECT_NAME_COLLISION:
++ return EEXIST;
++ case SMB2_STATUS_PIPE_DISCONNECTED:
++ return EPIPE;
++ case SMB2_STATUS_MEDIA_WRITE_PROTECTED:
++ return EROFS;
++ case SMB2_STATUS_NO_MEDIA_IN_DEVICE:
++ return ENOMEDIUM;
++ case SMB2_STATUS_DATA_ERROR:
++ case SMB2_STATUS_CRC_ERROR:
++ case SMB2_STATUS_DEVICE_DATA_ERROR:
++ return EIO;
++ case SMB2_STATUS_DISK_FULL:
++ return ENOSPC;
+ default:
+ return EIO;
+ }
+diff --git a/lib/init.c b/lib/init.c
+index 3720a1c..6c95cd2 100644
+--- a/lib/init.c
++++ b/lib/init.c
+@@ -412,6 +412,10 @@ void smb2_set_password(struct smb2_context *smb2, const char *password)
+ {
+ if (smb2->password) {
+ free(discard_const(smb2->password));
++ smb2->password = NULL;
++ }
++ if (password == NULL) {
++ return;
+ }
+ smb2->password = strdup(password);
+ }
+--
+2.20.1
+
diff --git a/contrib/src/smb2/SHA512SUMS b/contrib/src/smb2/SHA512SUMS
new file mode 100644
index 0000000000..eae3dd89c5
......@@ -65,10 +403,10 @@ index 0000000000..eae3dd89c5
+5e7101e54a4a95eae2ed5b05dfb51a33e9d4ce19275a405fbb1e86f9e9fe197de53b41c301ca992f19a03e5117ccc90d0acb174eb9c000c71674a0dbacf57614 libsmb2-2.0.0.tar.gz
diff --git a/contrib/src/smb2/rules.mak b/contrib/src/smb2/rules.mak
new file mode 100644
index 0000000000..81937b95a7
index 0000000000..62c000a1d7
--- /dev/null
+++ b/contrib/src/smb2/rules.mak
@@ -0,0 +1,27 @@
@@ -0,0 +1,28 @@
+# SMB2
+SMB2_VERSION := 2.0.0
+SMB2_URL := https://github.com/sahlberg/libsmb2/archive/v$(SMB2_VERSION).tar.gz
......@@ -89,6 +427,7 @@ index 0000000000..81937b95a7
+
+smb2: libsmb2-$(SMB2_VERSION).tar.gz .sum-smb2
+ $(UNPACK)
+ $(APPLY) $(SRC)/smb2/0001-master-backport.patch
+ $(MOVE)
+
+.smb2: smb2
......@@ -132,10 +471,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..713e0ab0b9
index 0000000000..90cd0d327f
--- /dev/null
+++ b/modules/access/smb2.c
@@ -0,0 +1,721 @@
@@ -0,0 +1,717 @@
+/*****************************************************************************
+ * smb2.c: SMB2 access plug-in
+ *****************************************************************************
......@@ -243,17 +582,8 @@ index 0000000000..713e0ab0b9
+
+ if (status < 0)
+ {
+ if (status != -EINTR)
+ {
+ const char *psz_error = vlc_strerror_c(-status);
+ msg_Err(access, "%s failed: %d, '%s'", psz_func, status, psz_error);
+ if (sys->error_status == 0)
+ vlc_dialog_display_error(access,
+ _("SMB2 operation failed"), "%s",
+ psz_error);
+ }
+ else
+ msg_Warn(access, "%s interrupted", psz_func);
+ const char *psz_error = smb2_get_error(sys->smb2);
+ msg_Warn(access, "%s failed: %d, '%s'", psz_func, status, psz_error);
+ sys->error_status = status;
+ return -1;
+ }
......@@ -797,7 +1127,12 @@ index 0000000000..713e0ab0b9
+ vlc_credential_clean(&credential);
+
+ if (ret != 0)
+ {
+ vlc_dialog_display_error(access,
+ _("SMB2 operation failed"), "%s",
+ smb2_get_error(sys->smb2));
+ goto error;
+ }
+
+ if (sys->smb2fh != NULL)
+ {
......
From 7daadc49d786987a0edcc75652cccf02e6f8ae76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Thu, 17 Jan 2019 10:01:34 +0100
Subject: [PATCH] smb2: Fix potential NULL dereference
---
modules/access/smb2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index 280c544174..f3bb23a358 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -476,7 +476,7 @@ vlc_smb2_open_share(stream_t *access, const struct smb2_url *smb2_url,
password = "";
}
- smb2_set_password(sys->smb2, password);
+ smb2_set_password(sys->smb2, password ? password : "");
smb2_set_domain(sys->smb2, domain ? domain : "");
if (smb2_connect_share_async(sys->smb2, smb2_url->server, share,
--
2.20.1
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