1. 08 Jun, 2020 2 commits
  2. 06 Jun, 2020 1 commit
  3. 19 May, 2020 2 commits
    • Harald Sitter's avatar
      smb: reshuffle discovery systems · 4e41727c
      Harald Sitter authored
      the modern discoveries were conditional on smbc_opendir succeeding but
      that is rather silly since smbc can fail on ENOENT if (for example)
      netbios is disabled. since top level server discovery may happen through
      all or none of NB/DNSSD/WSD that made no sense as even when NB fails
      we may be able to produce service listing through one of the other two
      discovery services.
      this piece of code would actually benefit from major refactoring because
      all three discovery systems should actually run at the same time while
      currently NB holds up the entire show. alas, too invasive for 20.04...
      so, reshuffling it is:
      smbc_opendir still runs initially. after that, if the url is browsing
      smb:// we'll jump into modern discovery. any errors produced by opendir
      will be ignored! authentication errors and the like cannot happen for
      smb:// because we aren't yet talking to any one server, which leaves
      actual browsing errors which are not fatal considering we have other
      for non-top-level urls we'll otherwise jump into error handling (e.g.
      server requires auth or something)
      at the end if we haven't returned early with an error we'll inject our
      `.` entries as per usual
      test plan:
      - add `disable netbios = yes` to smb.conf
      - browse network
      - discovers dnssd/wsd servers
      - also works with the option removed again
      BUG: 421624
      FIXED-IN: 20.04.2
    • Harald Sitter's avatar
      GIT_SILENT throw out outdated howto · 12622509
      Harald Sitter authored
  4. 15 May, 2020 1 commit
    • Harald Sitter's avatar
      sftp: map sftp_open error to kio error · 07e44cb1
      Harald Sitter authored
      sftp gives out more relevant errors such as SSH_FX_PERMISSION_DENIED,
      let's forward them as KIO errors instead of using the general cannot open
      Test Plan: hoping for the best! bad permissions on the remote now actually raise suitable kio errors, functionally that seems to make little difference unfortunately
      Reviewers: feverfew
      Reviewed By: feverfew
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D29743
  5. 14 May, 2020 1 commit
    • Harald Sitter's avatar
      sftp: break large writes into multiple requests · 1df61748
      Harald Sitter authored
      servers have arbitrary limits that we should stay below. to ensure this
      happens use MAX_XFER_BUF_SIZE as maximum size per request. if we read
      data large than that, break it apart into multiple requests
      (I am mostly guessing here, the rfc doesn't seem to impose any size
       constraint on the write requests themselves, so probably packet
       constraints apply by default)
      BUG: 404890
      FIXED-IN: 20.04.2
      Test Plan:
      - fallocate -l 128M file
      - sftp to localhost
      - copy file from one dir to another
      - compare checksums match
      - open xls file (via kio-fuse)
      - change
      - save
      - close
      - open again
      - changes are still there
      Reviewers: ngraham, meven, feverfew
      Reviewed By: ngraham, meven, feverfew
      Subscribers: meven, feverfew, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D29634
  6. 11 May, 2020 1 commit
  7. 09 May, 2020 1 commit
  8. 06 May, 2020 1 commit
    • Harald Sitter's avatar
      smb: resolve potential dnssd names via kdnssd · a042130e
      Harald Sitter authored
      as it turns out this is vastly more efficient for our purposes. we already
      know that this address should only be a dnssd address, so we can ask our
      dnssd daemon directly instead of taking on the entire weight of qhostinfo
      and proper DNS resolution.
      asking avahi directly reduces successful resolution time down from ~4 s
      to ~4 ms (yes, ms!). on resolution failure the timing remains about
      the same it seems
  9. 29 Apr, 2020 1 commit
    • Harald Sitter's avatar
      sftp: successfully write files to proftpd servers · effb511c
      Harald Sitter authored
      proftpd doesn't like zero size writes and returns with an error leading us
      to assume that the write failed, when in fact it was fine eitherway because
      we didn't write anything one way or the other.
      so, instead just break out of the loop early. there's nothing lost by
      us not doing that final EOF write since we don't need it from a protocol
      the break occurs just before writing because preceding it is "spin-up" tech
      opening the file and so forth. we need to have that run even when putting
      a 0b file.
      this successfully writes 0B, 1B, and 128M files both with partial markers
      enabled and disabled to proftpd 1.3.6c
      BUG: 419999
      FIXED-IN: 20.04.1
  10. 27 Apr, 2020 2 commits
    • Harald Sitter's avatar
      smb: put unmapped errno value into error message · 457ee4d5
      Harald Sitter authored
      otherwise it's annoyingly hard to figure out which error isn't mapped.
      this is done through a nested composition so as to not disturb the
      localized string in 20.04
    • 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
  11. 15 Apr, 2020 1 commit
  12. 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
  13. 09 Apr, 2020 1 commit
  14. 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
  15. 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
  16. 04 Apr, 2020 1 commit
  17. 03 Apr, 2020 1 commit
  18. 29 Mar, 2020 1 commit
  19. 28 Mar, 2020 1 commit
  20. 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
  21. 24 Mar, 2020 1 commit
  22. 23 Mar, 2020 1 commit
  23. 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
  24. 18 Mar, 2020 4 commits
  25. 16 Mar, 2020 4 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