Comment 15 for bug 340106

Revision history for this message
In , Harald Sitter (apachelogger) wrote :

Git commit f40191a147c9643717fda1cf9d1f42c526550893 by Harald Sitter.
Committed on 06/04/2020 at 09:27.
Pushed by sitter into branch 'master'.

smb: add hack to support spaces in workgroup names

Summary:
workgroup names are as best I can tell always still netbios names which
means they can contain a bunch of characters ordinarily not found in valid
host names. e.g. spaces
this causes trouble with the IANA SMB URI draft, as used by libsmbc,
since the workgroup would be the host field of the RI when browsing
a workgroup (i.e. filtering hosts that are member of a given workgroup)
because QUrl does not allow invalid hostnames in the host field.

to bypass this problem we now put the workgroup name into the query of the
url as `kio-workgroup`, should it cause trouble in the host field. SMBUrl
takes this query into account when constructing the url for smbc.
since the latter has uniquely exciting potential for breakage this entire
dance is only done when absolutely necessary and otherwise we continue with
all the same code and behavior as without this commit.

on a side note: the awkward name flexibility seems to not extend to
computer names anymore (supposedly because of LLMNR) so this entire
use case is already very niche as we (and libsmbclient) currently only
support workgroup browsing for NT1 networks, and NT1 is by default not
supported on windows10 or samba.

FIXED-IN: 20.04

Test Plan: builds, test passes, can browse workgroup with space in name

Reviewers: ngraham

Subscribers: kde-frameworks-devel, kfm-devel, thiago

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D27804

M +35 -0 smb/autotests/smburltest.cpp
M +11 -1 smb/kio_smb_browse.cpp
M +57 -4 smb/smburl.cpp

https://commits.kde.org/kio-extras/f40191a147c9643717fda1cf9d1f42c526550893