Skip to content
  • Harald Sitter's avatar
    smb: add hack to support spaces in workgroup names · f40191a1
    Harald Sitter authored
    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
    BUG: 204423
    
    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
    f40191a1