Bug 13782 - [backport request] Allow setting min/max protocol via libsmbclient API
Summary: [backport request] Allow setting min/max protocol via libsmbclient API
Status: RESOLVED WONTFIX
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.9.4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-09 15:31 UTC by Mikhail Novosyolov
Modified: 2020-07-10 12:21 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Novosyolov 2019-02-09 15:31:26 UTC
Samba 4.7 listed workgroups in smb:// correctly, but Samba 4.8 and 4.9.4 don't do it without setting 'client max protocol = NT1' manually.

To fix restore this functionality, I have cherry-picked commits 0dae4e2f5c65 (https://abf.io/import/samba/blob/rosa2016.1/0001-s3-libsmbclient-Add-function-to-set-protocol-levels.patch) and 50f89bcdc9 (https://abf.io/import/samba/blob/rosa2016.1/0002-s3-libsmbclient-Do-not-call-cli_RNetShareEnum-if-SMB.patch) from Samba 4.10 to Samba 4.9.4, 

then patched KDE's kio-extras (https://github.com/mikhailnov/kio-extras/commit/cfa32d4d7d51a7b78aa8d419efd5175cf45baecd, https://phabricator.kde.org/D18878 to make KIO list smb shares similary to how GVFS does it starting with commit https://gitlab.gnome.org/GNOME/gvfs/commit/6c8bc39f570ea82cf14e83ce7d1dbdbe569d09d1

Now it seems to work:
user@pay2 ~ $ kioclient5 ls 'smb://'
kio_smb: Using libsmbclient library version 4.9.4
kio_smb: auth_initialize_smbc 
kio_smb: smbc_init call
kio_smb: QUrl("smb://")
kio_smb: checkURL  QUrl("smb://")
kio_smb: Setting client max protocol = NT1 for browsing SMB network
kio_smb: updateCache  ""
kio_smb: we don't really need to authenticate for this top level url, returning
kio_smb: open  "smb://"   1   10000
kio_smb: smbc_readdir 
kio_smb: dirp->name  WORKGROUP   "WORKGROUP"  ' "OPENWRT" '   1
kio_smb: smbc_readdir 
Workgroup
.

user@pay2 ~ $ kioclient5 ls 'smb://Workgroup'
kio_smb: Using libsmbclient library version 4.9.4
kio_smb: auth_initialize_smbc 
kio_smb: smbc_init call
kio_smb: QUrl("smb://workgroup")
kio_smb: checkURL  QUrl("smb://workgroup")
kio_smb: checkURL return3  QUrl("smb://workgroup/")
kio_smb: QUrl("smb://workgroup/")
kio_smb: checkURL  QUrl("smb://workgroup/")
kio_smb: checkURL return3  QUrl("smb://workgroup/")
kio_smb: updateCache  "/"
kio_smb: auth_smbc_get_dat: set user= user , workgroup= WORKGROUP  server= workgroup , share= IPC$ 

kio_smb: libsmb-auth-callback URL: QUrl("smb://workgroup/IPC$")
kio_smb: auth_smbc_get_dat: set user= anonymous , workgroup= WORKGROUP  server= PAY2 , share= IPC$ 

kio_smb: libsmb-auth-callback URL: QUrl("smb://pay2/IPC$")
kio_smb: open  "smb://workgroup/"   2   10000
kio_smb: smbc_readdir 
kio_smb: dirp->name  OPENWRT   "OPENWRT"  ' "OpenWrt" '   2
kio_smb: list item  QUrl("smb://openwrt")
kio_smb: smbc_readdir 
kio_smb: dirp->name  PAY2   "PAY2"  ' "Samba on pay2 (ROSA GNU/Linux 2016.1)" '   2
kio_smb: list item  QUrl("smb://pay2")
kio_smb: smbc_readdir 
Openwrt (OpenWrt)
Pay2 (Samba on pay2 (ROSA GNU/Linux 2016.1))
.


ab@ asked me to make a backport request (backport to Samba 4.9.x) in case I get it working. Here is it.
Comment 1 Andreas Schneider 2019-02-10 09:10:18 UTC
Assigning to Jeremy.

I've backported them for RHEL and Fedora packages. However I'm not sure how upstream handles backport which bump the so version number.

However Samba 4.10 is already rc1 so should be released soon adding this function.
Comment 2 Björn Jacke 2020-07-10 12:21:01 UTC
too late now, this is fixed in 4.10 and later, 4.9 will not get updates any more