1. 27 Apr, 2020 1 commit
    • Harald Sitter's avatar
      smb: accurately attempt to resolve the correct WSD host · a4aefbbd
      Harald Sitter authored
      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
      BUG: 420578
      FIXED-IN: 20.04.1
  2. 15 Apr, 2020 1 commit
  3. 14 Apr, 2020 2 commits
    • Harald Sitter's avatar
      sftp: extra verbosity when put fails · 7bb2c797
      Harald Sitter authored
      for not entirely clear reasons certain servers will fall over after we've
      written our data. log internal sftp and ssh errors to aid in debugging
      CCBUG: 418472
    • Harald Sitter's avatar
      smb: debug the smbc debug level · 08b2a24d
      Harald Sitter authored
      sometimes I need bug reporters to set a level, but there's no actual
      indication if they did that correctly and since there is no GUI there's
      ways this can easily go wrong
  4. 09 Apr, 2020 1 commit
  5. 07 Apr, 2020 1 commit
    • Alexander Saoutkin's avatar
      Fix lifetime of slot in KIO-MTP · f4e0183a
      Alexander Saoutkin authored
      This slot was incorrectly made to last the lifetime of the slave. In fact, this
      slot should only be live for the lifetime of the event loop (one I/O operation).
      This can cause issues with the data being emitted for data from other IO
      operations. By making it live in the lifetime of the local event loop this
      scenario cannot occur as LIBMTP only allows one operation at a time.
      Test Plan:
      Via the use of KIOFuse (as this is where the bug was noticed).
      Before: Opening a file for the first time worked. Subsequent opens would fail
      due to garbage output After: Opening any number of files at any time works.
      Reviewers: akrutzler, dfaure, elvisangelaccio
      Subscribers: kde-frameworks-devel, kfm-devel, fvogt
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D28520
  6. 06 Apr, 2020 3 commits
    • Harald Sitter's avatar
      smb: add hack to support spaces in workgroup names · f40191a1
      Harald Sitter authored
      workgroup names are as best I can tell always still netbios names which
      means they can contain a bunch of characters ordinarily not found in valid
      host names. e.g. spaces
      this causes trouble with the IANA SMB URI draft, as used by libsmbc,
      since the workgroup would be the host field of the RI when browsing
      a workgroup (i.e. filtering hosts that are member of a given workgroup)
      because QUrl does not allow invalid hostnames in the host field.
      to bypass this problem we now put the workgroup name into the query of the
      url as `kio-workgroup`, should it cause trouble in the host field. SMBUrl
      takes this query into account when constructing the url for smbc.
      since the latter has uniquely exciting potential for breakage this entire
      dance is only done when absolutely necessary and otherwise we continue with
      all the same code and behavior as without this commit.
      on a side note: the awkward name flexibility seems to not extend to
      computer names anymore (supposedly because of LLMNR) so this entire
      use case is already very niche as we (and libsmbclient) currently only
      support workgroup browsing for NT1 networks, and NT1 is by default not
      supported on windows10 or samba.
      FIXED-IN: 20.04
      BUG: 204423
      Test Plan: builds, test passes, can browse workgroup with space in name
      Reviewers: ngraham
      Subscribers: kde-frameworks-devel, kfm-devel, thiago
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27804
    • Harald Sitter's avatar
      smb: use prettyname.kio-discovery-wsd for hostname of wsdiscoveries · daec307b
      Harald Sitter authored
      previously we simply used the ip address. this is fairly awkward though.
      instead try to deduce a resolvable host name from the pretty name.
      at discovery time we now mark wsdiscovieres for special handling
      at listDir time we then attempt to resolve the name.local and if that
      fails strip the .local to get the presumed LLMNR/netbios name. this means
      the (first) listDir may be slower while we try to find a working hostname
      but discovery is still as fast as possible.
      Test Plan: wsdd on linux server resolves as expected, wsd on win10 also resolves as expected
      Reviewers: ngraham, meven
      Reviewed By: ngraham, meven
      Subscribers: kossebau, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D28513
    • Harald Sitter's avatar
      import license copies via reuse · a2a8facc
      Harald Sitter authored
      for new code in smb source tree
  7. 04 Apr, 2020 1 commit
  8. 03 Apr, 2020 1 commit
  9. 29 Mar, 2020 1 commit
  10. 28 Mar, 2020 1 commit
  11. 25 Mar, 2020 3 commits
    • Harald Sitter's avatar
      sftp: fix partial transfer resuming when copying to local · 8a04e100
      Harald Sitter authored
      the previous condition checked if the final target path size was >0,
      which it would only be when the file already exists (i.e. overwrite) in
      all other scenarios it would always be false and as such resuming wouldn't
      work. what we actually want to check is whether the part file is >0 (i.e.
      there's actual pending bytes to resume from).
      this makes resuming work when copying remote->local
      CCBUG: 417645
      Test Plan:
      - create file of suitably large size (1g)
      - `split -b somesize` the file into two segments
      - copy first segment to /tmp/file.part
      - connect to /tmp over sftp and copy the file there
      - progress starts at 50% and resulting file is same as input file
      Reviewers: ngraham, feverfew, bruns
      Subscribers: bruns, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27872
    • Harald Sitter's avatar
      sftp: do not show creation time when we do not know it · b13449a1
      Harald Sitter authored
      creation time (aka birth time) is file system dependent, if the fs doesn't
      support it we seem to get createtime==0. skip over it when that is the
      BUG: 375305
      FIXED-IN: 20.04
      Test Plan: browsing a directory on btrfs over sftp doesn't show creation time as 1970
      Reviewers: ngraham, bruns, meven
      Reviewed By: ngraham, bruns, meven
      Subscribers: meven, bruns, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27873
    • Harald Sitter's avatar
      smb: add some more topical debug output on opendir failure · 6ab34e5c
      Harald Sitter authored
      the output seen in https://bugs.kde.org/show_bug.cgi?id=419038 isn't
      nearly useful enough.
      - log the actual errnum (i.e. errno) after opendir
      - if the dirfd is negative log the approximate steps to recover
      specifically we end up with errnum==0 in reportError which makes no sense
      whatsoever and from the output it's not currently obvious which call
      chain lead to that scenario. possibly should be changed to assert even,
      not doing that for now though because I want this in 20.04
  12. 24 Mar, 2020 1 commit
  13. 23 Mar, 2020 1 commit
  14. 19 Mar, 2020 2 commits
    • Harald Sitter's avatar
      sftp: fix seekPos + file resuming when part file is of size 11 · d8cf85ec
      Harald Sitter authored
      previously seekPos would loop over offset==EAGAIN. the returned off_t of
      seek is not an error, but the offset or -1. this incorrect handling
      of the return value resulted in attempting to seek a file of the size 11
      to get stuck in an infinite loop as EAGAIN==11 and so the loop would
      always be true. any other file size would have been fine, so the impact
      of this is actually super small.
      also sync up the expectation and handling a bit more between copy and put
      specifically we always seek to the size we (think) the part file has,
      instead of letting the libc determine the end. this is in part so
      we can simply do an offset==size comparison to check if the seek worked
      to the end we expected it to.
      the seekPos() helper was removed as it now serves no purpose over calling
      lseek directly.
      BUG: 417645
      FIXED-IN: 20.04
      Test Plan:
      - create file
      - `split -b 11` file to get a segment exactly EAGAIN size
      - copy first segment to some other dir as file.part
      - open sftp to other dir and copy file there
      - copy doesn't get stuck, the file.part is removed, and the resulting file is same as input
      - vice versa copy from sftp to local
      Reviewers: ngraham, feverfew
      Reviewed By: ngraham
      Subscribers: bruns, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27871
    • Harald Sitter's avatar
      smb: guard against duplicated service discoveries · ba96d3b9
      Harald Sitter authored
      if both dnssd and wsdiscovery have the same server on offer we'd create
      duplicated entries. instead keep track of the discovered names and only
      use the first discovery. notably happens when using wsdd on linux where
      samba would also register itself on dnssd.
      for ease of access and to not have to roundtrip through udsentry, discovery
      objects now have a udsName function that is meant to be the exact name
      used for the udsentry.
      Test Plan:
      - have samba
      - run wsdd.py from https://github.com/christgau/wsdd
      - server only shows up once
      Reviewers: ngraham
      Reviewed By: ngraham
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D28078
  15. 18 Mar, 2020 4 commits
  16. 16 Mar, 2020 5 commits
    • Harald Sitter's avatar
      fix readdirplus ifdef coverage · 8f45f13d
      Harald Sitter authored
      when using readdirplus we do not need to iter SMBC_FILE|DIR so we can
      skip the entire else if. previously this was off by one line, breaking
      the logic
    • Harald Sitter's avatar
      style++ · 7cc854ae
      Harald Sitter authored
    • Harald Sitter's avatar
      add readdirplus2 support for samba>=4.12 · ec40cd6e
      Harald Sitter authored
      unlike the dirent itering we do not need a separate stat call with this
      new api by instead itering on what are effectively stat-like objects.
      this simply runs before the regular itering which we still use to list
      shares and workgroups. browse_stat_path has been split into stat and
      udsentry-construction-from-stat so it can be used across both code
      fun fact on the side: if there actually was a stat() api that returned
      libsmb_file_info, we could use that as well and forget about the stats
      structs in general :S
      BUG: 402988
      FIXED-IN: 20.04.0
      Test Plan:
      - build samba 4.12 rc
      - list server
      - list share
      - list dir in share
      - on 4.7
      - all of the above
      Reviewers: ngraham, asn
      Reviewed By: ngraham
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27520
      # Conflicts:
      #	smb/CMakeLists.txt
      #	smb/kio_smb.h
      #	smb/kio_smb_browse.cpp
    • Harald Sitter's avatar
      smb: do not double finish · 82528611
      Harald Sitter authored
      finish() must not be called twice yet previously the case branches
      would call it but then there'd also be a global finished after the switch.
      remove the cases' finished().
      this code is, I think, actually not used anywhere so it matters little.
      Test Plan: hoping for the best!
      Reviewers: ngraham
      Reviewed By: ngraham
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D28014
    • Script Kiddy's avatar
      SVN_SILENT made messages (.desktop file) - always resolve ours · 4107f48c
      Script Kiddy authored
      In case of conflict in i18n, keep the version of the branch "ours"
      To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
  17. 15 Mar, 2020 1 commit
  18. 11 Mar, 2020 1 commit
  19. 06 Mar, 2020 7 commits
    • Harald Sitter's avatar
      smb: fix wsdiscovery unknown device fallback string · 6557c6b4
      Harald Sitter authored
      wasn't using xi18n so <resource> wasn't parsed as markup but rather used
      verbatim. also was missing the argument for %1 so the host address wasn't
      Test Plan: computer.clear() just prior now results in expected "Unknown device @ "::1"" names for the entries
      Reviewers: ngraham
      Reviewed By: ngraham
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27900
    • Harald Sitter's avatar
      smb: do not leak pbsd resolvers · 1eacae52
      Harald Sitter authored
      parent them to the discoverer. discoverer lives on the stack and is unwound
      once discovery is complete (or the eventloop timeout hit)
      Test Plan: made a dtor that qdebugged, dtor is now executed as expected
      Reviewers: ngraham
      Reviewed By: ngraham
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27901
    • Harald Sitter's avatar
      smb: fix ipv6 support · bb83a071
      Harald Sitter authored
      libsmbc doesn't presently support smb://[ABCD::DCBA]/ uris because it
      has very opinionated colon parsing. as a workaround we convert hosts
      that are ipv6 addresses to their windows ipv6 literal representation.
      that is basically s/:/-/g and s/%/s/g and appending .ipv6-literal.net.
      BUG: 417682
      FIXED-IN: 20.04
      Test Plan: builds, test passes, `'smb://[::1]/foo'` works as expected
      Reviewers: ngraham
      Reviewed By: ngraham
      Subscribers: cfeck, thiago, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27802
    • Harald Sitter's avatar
      smb: add a unit test for smburl · d8d92670
      Harald Sitter authored
      only tests some of the obvious scenarios I can see right now.
      ::cd() has been changed to only support going up one path element. it's
      all we need it for and the previous code was almost certainly incorrect
      by calling setUrl with input that is definitely not anywhere near a valid
      Test Plan: builds and test passes
      Reviewers: ngraham
      Reviewed By: ngraham
      Subscribers: apol, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27801
    • Harald Sitter's avatar
      smb: split module into two targets of which one is a static lib · d101d916
      Harald Sitter authored
      this allows us to use the intermediate static target for unit testing
      (which we'll want for smburl at the very least).
      the effective output remains unchanged, we simply have a fake library
      now before we turn it into a proper plugin .so.
      kdemain as a result was moved to its own file and only gets built into the
      final plugin but not the static library as it'd not have any use there
      Test Plan: builds and works still
      Reviewers: ngraham, apol
      Reviewed By: apol
      Subscribers: apol, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27800
    • Harald Sitter's avatar
      sftp: fix free space query for urls with empty path · 5cfd852a
      Harald Sitter authored
      e.g. `sftp://localhost` has an empty path
      fall back to assume it means '/'
      Test Plan: free space correctly listed on sftp://localhost
      Reviewers: ngraham, meven
      Reviewed By: meven
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27835
    • Harald Sitter's avatar
  20. 05 Mar, 2020 1 commit
  21. 04 Mar, 2020 1 commit