Bug 420578

Summary: kio-discovery-wsd suffix causes failure connecting to Windows 10 host using WS-Discovery
Product: [Frameworks and Libraries] kio-extras Reporter: Myrddin Wyllt <darknesseatsall>
Component: SambaAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: sitter
Priority: NOR    
Version First Reported In: 20.04   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 20.04.1
Sentry Crash Report:

Description Myrddin Wyllt 2020-04-25 16:01:52 UTC
SUMMARY
When attempting to connect to a windows machine using the kio-discovery-wsd method, dolphin will always fail giving the error: "Could not connect to host for smb://HOSTNAME.kio-discovery-wsd/". Typing in the hostname directly circumvents the issue.

Giving dolphin focus triggers file examination which results in nothing (a separate issue?). 

STEPS TO REPRODUCE
1. Setup a WS-Discovery enabled fileshare server (i.e., I used windows 10 in VM)

2. Use Dolphin to find the share (i.e., this will take multiple refresh attempts)

3. Attempt to connect by browsing with Dolphin.

4. Erase the suffix (i.e., change smb://HOSTNAME.kio-discovery-wsd/ to smb://HOSTNAME)

5. Instant connection

OBSERVED RESULT

Reproducible, recurring failure to connect when the kio-discovery-wsd suffix is thrown into the hostname.

EXPECTED RESULT

Browsing a share you can discover would be the ideal outcome.

SOFTWARE/OS VERSIONS
Manjaro Unstable Updated: 2/25/2020
Comment 1 Myrddin Wyllt 2020-04-25 23:39:30 UTC
I'm finding this issue isn't always reproducible.

I just tried this again & this time I refreshed after the first successful discovery.

Initial discovery always requires one refresh after waiting for smb:// to load.

Attempting to browse on initial discovery causes the error in this bug report.

Refreshing after initial discovery somehow properly converts the suffix to .local when attempting to brows which after a small eternity (20 seconds), does resolve properly.

Typing in HOSTNAME directly resolves almost immediately, so the delay is worth noting.
Comment 2 Harald Sitter 2020-04-27 09:30:55 UTC
Ugh, rather awkward. What happens is that we internally get confused over which url we work on for a brief period of time after discovery, so the suffix handling doesn't kick in. If you wait a couple seconds before trying to browse a server it'll possibly work.

BTW, if resolution is slow that suggests problems with your dnssd setup. We simply delegate resolution to your system and dnssd should be lighting fast with avahi on linux because all announcements are cached.
Comment 3 Harald Sitter 2020-04-27 09:49:18 UTC
Git commit a4aefbbd35345ba6da80c65723161b7d16d3c431 by Harald Sitter.
Committed on 27/04/2020 at 09:36.
Pushed by sitter into branch 'master'.

smb: accurately attempt to resolve the correct WSD host

this previously was the wrong variable. m_current_url is only set after
url checking while kurl would be the current url under check. this lead
to state confusion was implicit stat() calls from dolphin on host foo would
evaluate the previous host (e.g. bar) for the wsd suffix. this meant we'll
let a foo with suffix pass through the check, and that just mustn't ever
happen.
FIXED-IN: 20.04.1

M  +2    -2    smb/kio_smb_browse.cpp

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