GNOME Bugzilla – Bug 772849
webdav backend crashes attempting to access share
Last modified: 2016-12-12 13:48:29 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
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...
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.
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.
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.
Created attachment 341161 [details] [review] test: Add test case for Bug 772849
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