Bug 417682

Summary: ipv6 not working
Product: [Frameworks and Libraries] kio-extras Reporter: Harald Sitter <sitter>
Component: SambaAssignee: Harald Sitter <sitter>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 20.04

Description Harald Sitter 2020-02-15 01:52:38 UTC
smb://[ff::1] which should be a valid ipv6 uri errors internally with error code 8216. Needs investigation
Comment 1 Harald Sitter 2020-02-18 10:35:59 UTC
Looks like uri parsing is busted vis a vis ipv6. Up to smbclient 4.11.1 at least It's a bit of a problem considering ipv4 is considered legacy :|

Trivial example that should stat localhost but instead comes back EINVAL.

    // https://tools.ietf.org/html/rfc3986#section-3.2.2
    if (smbc_stat("smb://[::1]", &st) == 0) {
        printf("success\n");
    } else {
        perror("smb://[::1]");
    }

I've also found https://bugzilla.gnome.org/show_bug.cgi?id=604116 which doesn't actually mention an upstream report, so I am guessing this wasn't forwarded? Also it looks like that workaround they pulled may not be nearly as easy for us. smb://::1 only works if the colons are percent encoded (otherwise that's an outright wrong uri), QUrl however is fairly strict about what it accepts for hosts and percent encoded random stuff is not part of it. We'd have to construct the smb url manually.
Comment 2 Harald Sitter 2020-02-26 14:03:00 UTC
upstream report https://bugzilla.samba.org/show_bug.cgi?id=14297

To implement a workaround I think I'll first want our smburl class grow some tests. There's an uncomfortable amount of hacks without tests in there. Also, bug #204423 adds further complexity to our url handling needs.
Comment 3 Harald Sitter 2020-03-06 16:14:50 UTC
Git commit bb83a071e0da384e464c5a79cca6359b84d27491 by Harald Sitter.
Committed on 06/03/2020 at 16:13.
Pushed by sitter into branch 'master'.

smb: fix ipv6 support

Summary:
libsmbc doesn't presently support smb://[ABCD::DCBA]/ uris because it
has very opinionated colon parsing. as a workaround we convert hosts
that are ipv6 addresses to their windows ipv6 literal representation.
that is basically s/:/-/g and s/%/s/g and appending .ipv6-literal.net.
FIXED-IN: 20.04

Test Plan: builds, test passes, `'smb://[::1]/foo'` works as expected

Reviewers: ngraham

Reviewed By: ngraham

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

Tags: #dolphin, #frameworks

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

M  +27   -0    smb/autotests/smburltest.cpp
M  +37   -2    smb/smburl.cpp

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