Bug 150027 - workgroup-containing URLs are parsed incorrectly
Summary: workgroup-containing URLs are parsed incorrectly
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unmaintained
Component: smb (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-20 10:27 UTC by Peter Gyongyosi
Modified: 2018-06-28 18:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Gyongyosi 2007-09-20 10:27:29 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages
OS:                Linux

At the declaration of checkURL() in kio_smb.h, the comment says the following:

* Description :  correct a given URL
    *                valid URL's are
    *
    *                smb://[[domain;]user[:password]@]server[:port][/share[/path[/file]]]
    *                smb:/[[domain;]user[:password]@][group/[server[/share[/path[/file]]]]]

However, the second format is not accepted.

How to reproduce:

If you enter "smb:/" into the address bar of Konqueror, you correctly get the list of workgroups on a network. If you click on a workgroup (eg. "MSHOME"), you're correctly shown the members of the MSHOME worgroup, but the addressbar shows "smb://MSHOME" instead of the expected "smb:/MSHOME". If you go further and click on one of the computers (eg. "COMPUTER"), you're correctly shown the shares of the computer, but the addressbar shows "smb://COMPUTER" instead of the expected "smb:/MSHOME/COMPUTER". Entering a complete url like "smb:/MSHOME/COMPUTER" fails, returning an error message that says "Timeout on server: mshome" -- the kioslave interprets the MSHOME workgroup as a server name.

Expected behaviour:

It does work in the sense that you can browse the "SMB network" starting from the url "smb:/" but it achieves this incorrectly and illogically. If I "go into" a workgroup, it should display "smb:/MSHOME" (with 1 slash), if I go to see a server's shares from the workgroup view, it should display "smb:/MSHOME/COMPUTER" (which references the same as "smb://COMPUTER"). And it should definitely accept "smb:/MSHOME/COMPUTER" -style URLs entered directly into the address bar, instead of trying to resolve MSHOME as a server.

Notes:

- The last comments in bug #80323 say that this problem seems to cause the bug reported there.

- The problem seems to be in the checkURL() in kio_smb_browse.cpp. See the code below:

if (surl.startsWith("smb:/")) {
      if (surl.length() == 5) // just the above
          return kurl; // unchanged

       if (surl.at(5) != '/') {
          surl = "smb://" + surl.mid(5);
          kDebug(KIO_SMB) << "checkURL return1 " << surl << " " << KUrl(surl);
          return KUrl(surl);
      }
  }

As you can see, if an URL starts with "smb:/" but does not continue with another "/", it simply adds this "missing" slash and redirects the user to this URL. It is pretty hard to enter "smb:/MSHOME/COMPUTER" URLs in this case... :) (I suppose the code somewhere else knows how to find out in the case of an "smb://MSHOME"-type query wheter MSHOME is a workgroup or a server)
Comment 1 Nate Graham 2018-06-28 18:22:46 UTC
This has since been fixed and works for me in KDE Frameworks 5.47. It automatically adds an extra slash as needed.