Bug 14297 - ipv6 URI support
Summary: ipv6 URI support
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.12.0rc4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2020-02-26 13:41 UTC by Harald Sitter
Modified: 2020-12-23 17:10 UTC (History)
1 user (show)

See Also:

tiny test app (2.66 KB, application/gzip)
2020-02-26 13:41 UTC, Harald Sitter
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Harald Sitter 2020-02-26 13:41:15 UTC
Created attachment 15824 [details]
tiny test app

The standardized way to express non-legacy IP addresses is putting them in square brackets.

e.g. smb://[::1]/ would be localhost

libsmbclient doesn't properly support this, yet does know how to handle non-legacy IP addresses. See the attached example app. It's trying to stat smb://[::1]/foo but gets EINVAL back. I've added a whole bunch of permutations and the only one that actually will parse correctly is smb://::1/foo with the colons percent encoded (i.e. smb://%3A%3A1/foo). That is of course not standard conform and needs a workaround in every application built on top of libsmbc. Not ideal.

At a glance the parsing primarily stumbles over the very opinionated colon check in libsmb_path.c. If that colon check got extended to skip over colons inside square brackets and then afterwards strip the square brackets pp_server would end up being '::1' which then should work as expected.

GVFS has a workaround for this:

And I guess KIO will also need one:

It'd be grand if nothing needed a workaround ;)
Comment 1 Stefan Metzmacher 2020-02-27 12:56:31 UTC
The already working solution is the usage of the "ipv6-literal.net" domain,
e.g. fd00-0000-0000-0000-0000-0000-5357-5f03.ipv6-literal.net.

See also
Comment 2 Björn Jacke 2020-12-23 17:10:08 UTC
closing as WONTFIX, because ipv6-literal.net is the way to go and this is subject of an nss module, for example nss_resolve from systemd. The [::1] notation is asking for trouble at many places. With SMB you should anyway prefer to use resolvable host names, so that for example krb5 works properly.