Merge pull request #1820 from chewitt/stuff

kodi: update PR12111 patch
This commit is contained in:
MilhouseVH 2017-07-22 18:29:54 +01:00 committed by GitHub
commit c8328b27da
3 changed files with 103 additions and 29 deletions

View File

@ -42,6 +42,14 @@
</setting> </setting>
</group> </group>
</category> </category>
<category id="smb">
<group id="2">
<setting id="smb.maxprotocol">
<default>0</default>
</setting>
</group>
</category>
</section> </section>
<section id="pvr"> <section id="pvr">

View File

@ -1,22 +1,22 @@
From 84eccc9a16867d1e06ca2b65da1cc41f050ca06b Mon Sep 17 00:00:00 2001 From 5c7b7960036917338e0830ba2986b62c36bb5589 Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net> From: chewitt <github@chrishewitt.net>
Date: Tue, 16 May 2017 12:51:32 +0100 Date: Tue, 16 May 2017 12:51:32 +0100
Subject: [PATCH] smbclient: cleanup smbclient configuration Subject: [PATCH] smbclient: cleanup smbclient configuration
--- ---
.../resource.language.en_gb/resources/strings.po | 38 +++++++++++++++++++- .../resource.language.en_gb/resources/strings.po | 44 ++++++++++++++++++++-
system/settings/settings.xml | 20 +++++++++-- system/settings/settings.xml | 21 ++++++++--
xbmc/filesystem/SMBFile.cpp | 40 ++++++++++++++-------- xbmc/filesystem/SMBFile.cpp | 45 ++++++++++++++--------
xbmc/network/NetworkServices.cpp | 3 +- xbmc/network/NetworkServices.cpp | 3 +-
xbmc/settings/Settings.cpp | 2 ++ xbmc/settings/Settings.cpp | 2 +
xbmc/settings/Settings.h | 1 + xbmc/settings/Settings.h | 1 +
6 files changed, 84 insertions(+), 20 deletions(-) 6 files changed, 95 insertions(+), 21 deletions(-)
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index e0060d1fae55..eb47be8cc723 100644 index e0060d1fae55..e8e3f2c169ec 100644
--- a/addons/resource.language.en_gb/resources/strings.po --- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po
@@ -19063,7 +19063,43 @@ msgctxt "#36620" @@ -19063,7 +19063,49 @@ msgctxt "#36620"
msgid "Enable high quality downscaling of pictures (uses more memory and has moderate performance impact)." msgid "Enable high quality downscaling of pictures (uses more memory and has moderate performance impact)."
msgstr "" msgstr ""
@ -30,42 +30,48 @@ index e0060d1fae55..eb47be8cc723 100644
+#. Description of setting with label #36621 "Maximum protocol version" +#. Description of setting with label #36621 "Maximum protocol version"
+#: system/settings/settings.xml +#: system/settings/settings.xml
+msgctxt "#36622" +msgctxt "#36622"
+msgid "Set the maximum SMB protocol version that can be negotiated (default SMBv3). Reduce to SMBv2 or SMBv1 for compatibility with older NAS and Windows shares if required." +msgid "Set the maximum SMB protocol version to negotiate when making connections. Forcing SMBv2 or SMBv1 compatibility may be required with older NAS and Windows shares."
+msgstr "" +msgstr ""
+ +
+#. Values for setting with label #36621 "Maximum protocol version" +#. Values for setting with label #36621 "Maximum protocol version" - none means "no protocol version is forced"
+#: system/settings/settings.xml +#: system/settings/settings.xml
+msgctxt "#36623" +msgctxt "#36623"
+msgid "SMBv1" +msgid "None"
+msgstr "" +msgstr ""
+ +
+#. Values for setting with label #36621 "Maximum protocol version" +#. Values for setting with label #36621 "Maximum protocol version"
+#: system/settings/settings.xml +#: system/settings/settings.xml
+msgctxt "#36624" +msgctxt "#36624"
+msgid "SMBv2" +msgid "SMBv1"
+msgstr "" +msgstr ""
+ +
+#. Values for setting with label #36621 "Maximum protocol version" +#. Values for setting with label #36621 "Maximum protocol version"
+#: system/settings/settings.xml +#: system/settings/settings.xml
+msgctxt "#36625" +msgctxt "#36625"
+msgid "SMBv2"
+msgstr ""
+
+#. Values for setting with label #36621 "Maximum protocol version"
+#: system/settings/settings.xml
+msgctxt "#36626"
+msgid "SMBv3" +msgid "SMBv3"
+msgstr "" +msgstr ""
+ +
+#. Label of a group, that allows configuration of the system SMB client +#. Label of a group, that allows configuration of the system SMB client
+#: system/settings/settings.xml +#: system/settings/settings.xml
+msgctxt "#36626" +msgctxt "#36627"
+msgid "Client" +msgid "Client"
+msgstr "" +msgstr ""
+ +
+#empty strings from id 36627 to 36899 +#empty strings from id 36628 to 36899
#: xbmc/media/MediaType.cpp #: xbmc/media/MediaType.cpp
msgctxt "#36900" msgctxt "#36900"
diff --git a/system/settings/settings.xml b/system/settings/settings.xml diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index 301e7276e5b7..de6f6055afb8 100644 index 301e7276e5b7..f453ed0ad296 100644
--- a/system/settings/settings.xml --- a/system/settings/settings.xml
+++ b/system/settings/settings.xml +++ b/system/settings/settings.xml
@@ -1944,15 +1944,29 @@ @@ -1944,15 +1944,30 @@
<category id="smb" label="1200" help="36346"> <category id="smb" label="1200" help="36346">
<requirement>HAS_FILESYSTEM_SMB</requirement> <requirement>HAS_FILESYSTEM_SMB</requirement>
<group id="1" label="16000"> <group id="1" label="16000">
@ -75,7 +81,7 @@ index 301e7276e5b7..de6f6055afb8 100644
+ <control type="edit" format="string" /> + <control type="edit" format="string" />
+ </setting> + </setting>
+ </group> + </group>
+ <group id="2" label="36626"> + <group id="2" label="36627">
<setting id="smb.winsserver" type="string" label="1207" help="36347"> <setting id="smb.winsserver" type="string" label="1207" help="36347">
<level>2</level> <level>2</level>
<default>0.0.0.0</default> <default>0.0.0.0</default>
@ -89,9 +95,10 @@ index 301e7276e5b7..de6f6055afb8 100644
+ <default>3</default> + <default>3</default>
+ <constraints> + <constraints>
+ <options> + <options>
+ <option label="36623">1</option> + <option label="36623">0</option>
+ <option label="36624">2</option> + <option label="36624">1</option>
+ <option label="36625">3</option> + <option label="36625">2</option>
+ <option label="36626">3</option>
+ </options> + </options>
+ </constraints> + </constraints>
+ <control type="list" format="integer" /> + <control type="list" format="integer" />
@ -99,7 +106,7 @@ index 301e7276e5b7..de6f6055afb8 100644
</group> </group>
</category> </category>
diff --git a/xbmc/filesystem/SMBFile.cpp b/xbmc/filesystem/SMBFile.cpp diff --git a/xbmc/filesystem/SMBFile.cpp b/xbmc/filesystem/SMBFile.cpp
index e53d5552cf10..a51d1d383cb0 100644 index e53d5552cf10..e5301b0452f9 100644
--- a/xbmc/filesystem/SMBFile.cpp --- a/xbmc/filesystem/SMBFile.cpp
+++ b/xbmc/filesystem/SMBFile.cpp +++ b/xbmc/filesystem/SMBFile.cpp
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
@ -110,18 +117,19 @@ index e53d5552cf10..a51d1d383cb0 100644
#include "settings/AdvancedSettings.h" #include "settings/AdvancedSettings.h"
#include "settings/Settings.h" #include "settings/Settings.h"
#include "threads/SingleLock.h" #include "threads/SingleLock.h"
@@ -91,34 +92,36 @@ void CSMB::Deinit() @@ -91,34 +92,39 @@ void CSMB::Deinit()
void CSMB::Init() void CSMB::Init()
{ {
CSingleLock lock(*this); CSingleLock lock(*this);
+ +
if (!m_context) if (!m_context)
{ {
- // Create ~/.smb/smb.conf. This file is used by libsmbclient.
+ // force libsmbclient to use our own smb.conf by overriding HOME + // force libsmbclient to use our own smb.conf by overriding HOME
+ std::string truehome(getenv("HOME")); + std::string truehome(getenv("HOME"));
+ setenv("HOME", CSpecialProtocol::TranslatePath("special://home").c_str(), 1); + setenv("HOME", CSpecialProtocol::TranslatePath("special://home").c_str(), 1);
+ +
// Create ~/.smb/smb.conf. This file is used by libsmbclient. + // Create ~/.kodi/.smb/smb.conf. This file is used by libsmbclient.
// http://us1.samba.org/samba/docs/man/manpages-3/libsmbclient.7.html // http://us1.samba.org/samba/docs/man/manpages-3/libsmbclient.7.html
// http://us1.samba.org/samba/docs/man/manpages-3/smb.conf.5.html // http://us1.samba.org/samba/docs/man/manpages-3/smb.conf.5.html
- char smb_conf[MAX_PATH]; - char smb_conf[MAX_PATH];
@ -155,14 +163,17 @@ index e53d5552cf10..a51d1d383cb0 100644
- fprintf(f, "\tsocket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536\n"); - fprintf(f, "\tsocket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536\n");
- fprintf(f, "\tlock directory = %s/.smb/\n", getenv("HOME")); - fprintf(f, "\tlock directory = %s/.smb/\n", getenv("HOME"));
+ // set maximum smbclient protocol version + // set maximum smbclient protocol version
+ if (CSettings::GetInstance().GetInt(CSettings::SETTING_SMB_MAXPROTOCOL) == 1) + if (CSettings::GetInstance().GetInt(CSettings::SETTING_SMB_MAXPROTOCOL) > 0)
+ fprintf(f, "\tclient max protocol = NT1\n"); + {
+ else + if (CSettings::GetInstance().GetInt(CSettings::SETTING_SMB_MAXPROTOCOL) == 1)
+ fprintf(f, "\tclient max protocol = SMB%d\n", CSettings::GetInstance().GetInt(CSettings::SETTING_SMB_MAXPROTOCOL)); + fprintf(f, "\tclient max protocol = NT1\n");
+ else
+ fprintf(f, "\tclient max protocol = SMB%d\n", CSettings::GetInstance().GetInt(CSettings::SETTING_SMB_MAXPROTOCOL));
+ }
// set wins server if there's one. name resolve order defaults to 'lmhosts host wins bcast'. // set wins server if there's one. name resolve order defaults to 'lmhosts host wins bcast'.
// if no WINS server has been specified the wins method will be ignored. // if no WINS server has been specified the wins method will be ignored.
@@ -135,6 +138,9 @@ void CSMB::Init() @@ -135,6 +141,9 @@ void CSMB::Init()
if (g_advancedSettings.m_sambadoscodepage.length() > 0) if (g_advancedSettings.m_sambadoscodepage.length() > 0)
fprintf(f, "\tdos charset = %s\n", g_advancedSettings.m_sambadoscodepage.c_str()); fprintf(f, "\tdos charset = %s\n", g_advancedSettings.m_sambadoscodepage.c_str());
@ -172,7 +183,7 @@ index e53d5552cf10..a51d1d383cb0 100644
fclose(f); fclose(f);
} }
} }
@@ -151,6 +157,10 @@ void CSMB::Init() @@ -151,6 +160,10 @@ void CSMB::Init()
// setup our context // setup our context
m_context = smbc_new_context(); m_context = smbc_new_context();

View File

@ -0,0 +1,55 @@
From 1199907cbe2f003a7df6f56e6cf3878d0732344d Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze@samba.org>
Date: Mon, 26 Jun 2017 10:00:53 +0200
Subject: [PATCH] param: change the effective default for "client max protocol"
to the latest supported protocol
Currently it's SMB3_11.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
---
docs-xml/smbdotconf/protocol/clientmaxprotocol.xml | 2 +-
lib/param/loadparm.c | 2 +-
source3/param/loadparm.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs-xml/smbdotconf/protocol/clientmaxprotocol.xml b/docs-xml/smbdotconf/protocol/clientmaxprotocol.xml
index 0131331b876..eba18bfb80a 100644
--- a/docs-xml/smbdotconf/protocol/clientmaxprotocol.xml
+++ b/docs-xml/smbdotconf/protocol/clientmaxprotocol.xml
@@ -79,7 +79,7 @@
negotiation phase in the SMB protocol takes care of choosing
the appropriate protocol.</para>
- <para>The value <constant>default</constant> refers to <constant>NT1</constant>.</para>
+ <para>The value <constant>default</constant> refers to <constant>SMB3_11</constant>.</para>
<para>IPC$ connections for DCERPC e.g. in winbindd, are handled by the
<smbconfoption name="client ipc max protocol"/> option.</para>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 9f32d7b27b0..3ceea50b279 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -3401,7 +3401,7 @@ int lpcfg_client_max_protocol(struct loadparm_context *lp_ctx)
{
int client_max_protocol = lpcfg__client_max_protocol(lp_ctx);
if (client_max_protocol == PROTOCOL_DEFAULT) {
- return PROTOCOL_NT1;
+ return PROTOCOL_LATEST;
}
return client_max_protocol;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 91fa85ea7b0..8f0cf5e6e03 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -4543,7 +4543,7 @@ int lp_client_max_protocol(void)
{
int client_max_protocol = lp__client_max_protocol();
if (client_max_protocol == PROTOCOL_DEFAULT) {
- return PROTOCOL_NT1;
+ return PROTOCOL_LATEST;
}
return client_max_protocol;
}