diff --git a/smb/CMakeLists.txt b/smb/CMakeLists.txt --- a/smb/CMakeLists.txt +++ b/smb/CMakeLists.txt @@ -6,6 +6,9 @@ include(CheckIncludeFile) set(CMAKE_AUTOMAKE ON) +# exists in Samba >= 4.10 (since commit 0dae4e2f5c65) +CHECK_FUNCTION_EXISTS(smbc_setOptionProtocols HAVE_SMBC_SETOPTIONPROTOCOLS) + if(NOT WIN32) check_include_file(utime.h HAVE_UTIME_H) diff --git a/smb/kio_smb_browse.cpp b/smb/kio_smb_browse.cpp --- a/smb/kio_smb_browse.cpp +++ b/smb/kio_smb_browse.cpp @@ -195,6 +195,16 @@ } } if (surl == QLatin1String("smb://")) { +#ifdef HAVE_SMBC_SETOPTIONPROTOCOLS + // Samba 4.8 changed default 'client max protocol' from NT1 to SMB3, + // together with fixes of Badlock, it broke browsing smb:// with + // default settings, because only NT1 (SMB1) protocol can browse network. + // Samba 4.10 made it possible to set min/max protocol version + // via libsmbclient API. + SMBCCTX *smb_context = nullptr; + qCDebug(KIO_SMB) << "Setting client max protocol = NT1 for browsing SMB network"; + smbc_option_set(smb_context, "NT1", "NT1"); +#endif return kurl; //unchanged }