After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772849 - webdav backend crashes attempting to access share
webdav backend crashes attempting to access share
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: webdav backend
1.30.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2016-10-13 11:16 UTC by Jan Alexander Steffens (heftig)
Modified: 2016-12-12 13:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
dnssd: Return error instead of abort (1.16 KB, patch)
2016-12-01 15:18 UTC, Ondrej Holy
committed Details | Review
client: Escape ":[]" chars in host if it is not IPv6 (4.26 KB, patch)
2016-12-01 15:18 UTC, Ondrej Holy
committed Details | Review
test: Add test case for Bug 772849 (962 bytes, patch)
2016-12-01 15:18 UTC, Ondrej Holy
committed Details | Review

Description Jan Alexander Steffens (heftig) 2016-10-13 11:16:45 UTC
Attempting to access a certain WebDAV share in nautilus causes the spawned gvfsd-dav to crash immediately:

avahi-discover reports the share as:

Service data for service 'WebDAV Sharing: mac-base.dimpap default' of type '_webdav._tcp' in domain 'local' on 5.0:
        Host mac-basedimpap.local (192.168.50.17), port 80, TXT data: ['path=/']

gvfsd-dav reports:

Malformed construction data passed: Malformed DNS-SD encoded_triple 'WebDAV Sharing'

gvfsd-dav then crashes when trying to create a service resolver with a NULL service type.

nautilus 3.22.0.1
gvfs 1.30.1
avahi 0.6.32
Comment 1 Ondrej Holy 2016-10-13 11:35:00 UTC
Thanks for your bug report.

It can be simply reproduced by:
1/ avahi-publish-service "foo:bar" _webdav._tcp 80
2/ clicking on foo:bar in nautilus

or

2/ gvfs-mount "dav+sd://foo:bar._webdav._tcp.local"

Then you can see:
(process:11066): GVFS-WARNING **: Malformed construction data passed: Malformed DNS-SD encoded_triple “foo”
gvfsd-dav: resolver.c:199: avahi_service_resolver_new: Assertion `type' failed.

However output from:
$ gvfs-ls -a "standard::target-uri" dns-sd://local/
foo:bar._webdav._tcp	0	(shortcut)	standard::target-uri=dav+sd://foo%3Abar._webdav._tcp.local

And the following works:
gvfs-mount "dav+sd://foo%3Abar._webdav._tcp.local"

So I wonder where it is decoded... I will take a look later...
Comment 2 Ondrej Holy 2016-10-13 14:03:29 UTC
Hmm, the problem is that output from g_file_get_uri(file) is "dav+sd://foo:bar._webdav._tcp.local/" for the following:
file = g_file_new_for_uri("dav+sd://foo%3Abar._webdav._tcp.local");

It is caused by the following line:
https://git.gnome.org/browse/gvfs/tree/client/gvfsuriutils.c#n270

":[]" chars are not escaped probably because of IPv6 addresses.
Comment 3 Ondrej Holy 2016-12-01 15:18:30 UTC
Created attachment 341159 [details] [review]
dnssd: Return error instead of abort

gvfsd-dnssd aborts currently if invalid encoded triple is provided
and g_vfs_dns_sd_resolver_resolve is called. Return error instead
of abort.
Comment 4 Ondrej Holy 2016-12-01 15:18:34 UTC
Created attachment 341160 [details] [review]
client: Escape ":[]" chars in host if it is not IPv6

The "[]:" chars are omitted currently when encoding uri, because they
are valid for IPv6. This causes problems in some cases, e.g. output from
g_file_get_uri(g_file_new_for_uri("dav+sd://foo%3Abar._webdav._tcp.local"))
is "dav+sd://foo:bar._webdav._tcp.local/", which is obviously wrong. Add
gvfs_is_ipv6 in order to detect IPv6 addresses and encode also "[]:" chars
in other cases. Use gvfs_is_ipv6 to detect IPv6 also in some backends.
Comment 5 Ondrej Holy 2016-12-01 15:18:39 UTC
Created attachment 341161 [details] [review]
test: Add test case for Bug 772849
Comment 6 Ondrej Holy 2016-12-12 13:48:19 UTC
Attachment 341159 [details] pushed as 2b234a0 - dnssd: Return error instead of abort
Attachment 341160 [details] pushed as d8556a0 - client: Escape ":[]" chars in host if it is not IPv6
Attachment 341161 [details] pushed as da937bb - test: Add test case for Bug 772849