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 ;)
The already working solution is the usage of the "ipv6-literal.net" domain,
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.