1. 08 Oct, 2021 1 commit
  2. 06 Jul, 2021 1 commit
  3. 28 May, 2021 1 commit
  4. 30 Apr, 2021 1 commit
  5. 12 Apr, 2021 1 commit
  6. 06 Nov, 2020 1 commit
    • Jurica Vukadin's avatar
      sftp: Fix build failure with old libssh versions · c973cfaa
      Jurica Vukadin authored
      Building kio-sftp fails on Ubuntu 18.04:
      kio-extras/sftp/kio_sftp.cpp:1280:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
      1 error generated.
      make[2]: *** [sftp/CMakeFiles/kio_sftp.dir/kio_sftp.cpp.o] Error 1
      make[1]: *** [sftp/CMakeFiles/kio_sftp.dir/all] Error 2
      make[1]: *** Waiting for unfinished jobs....
      make: *** [all] Error 2
      SFTPInternal::openConnection() version for libssh < 0.8.3 is missing a
      return at the end of the function. Add it.
  7. 01 Sep, 2020 1 commit
    • Adriaan de Groot's avatar
      Unify types · 8f068e2d
      Adriaan de Groot authored
      - size_t is not necessarily the same as uint64_t, use just one
        in declaration and definition.
  8. 06 Aug, 2020 6 commits
    • Harald Sitter's avatar
      sftp: fix offset handling on short reads · cfa52aed
      Harald Sitter authored
      reads that came back with less data are fairly garbage to handle.
      the offset is increased when we make requests with read_begin so the
      original offset when we enter readchunks is the offset as if all pending
      requests had returned.
      async_read reduces that offset when a request cames back short.
      since we still want the missing data we make a new request for the
      missing data both we and libssh modify the offset as part of that
      after that dance we need to restore the most original offset to restore
      that initial condition where the offset is the offset as though all
      requests had returned. it remains unchanged because we've re-queued the
      missing data
      the original code lacked this offset restoring which meant that if we
      had a short request in the middle of a file it'd break the offset,
      return, the caller would queue more chunks and those chunsk would all
      have wrong offsets now: increasing from (missingoffset + missingsize) up
      to file.size **duplicating** whatever requests may still be pending at
      that time.
    • Harald Sitter's avatar
      sftp: give better debug messages on read failures · ebaa00ec
      Harald Sitter authored
      failure to read without context is kinda useless, so print all errors we
      can get our hand on
    • Harald Sitter's avatar
      sftp: stop using an entire attr ptr in GetRequest · 18e111c6
      Harald Sitter authored
      we only need the maximum length we can read, beyond that it has no use.
      how the caller gets ahold of the maximum is entirely not a concern of
    • Harald Sitter's avatar
      sftp: style++ · 024fa38f
      Harald Sitter authored
    • Harald Sitter's avatar
      sftp: convert sftp_attributes to a scopedpointer · 3b84832e
      Harald Sitter authored
      previously attr handling was a right mess with at least one leak I think.
      attrs must be freed but doing so manually all over the place complicates
      things considerably. since all attributes were ultimately scoped to the
      functions they were used in anyway it's much cleaner to use a
      qscopedpointer with custom deleter instead.
      this also enables us to stop GetRequest taking ownership (implicitly)
      of the sftp ptrs passed in. and that in turn was a huge blocker for
      letting ::read() use GetRequest
    • Harald Sitter's avatar
      en_us++ · 43de728e
      Harald Sitter authored
  9. 05 Aug, 2020 1 commit
  10. 08 Jul, 2020 1 commit
  11. 27 May, 2020 1 commit
  12. 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
  13. 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
  14. 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
  15. 14 Apr, 2020 1 commit
  16. 03 Apr, 2020 1 commit
  17. 25 Mar, 2020 2 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
  18. 23 Mar, 2020 1 commit
  19. 19 Mar, 2020 1 commit
    • 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
  20. 06 Mar, 2020 1 commit
  21. 26 Feb, 2020 1 commit
    • Harald Sitter's avatar
      sftp: port to Result system to force serialization of error/finish condition · 74850eb2
      Harald Sitter authored
      the Result system was originally introduced to the FTP slave and now also
      makes an appearance in the SFTP slave. the system introduces a separation
      between logic and fronting API class to more tightly control when state
      changing calls (finished()/error()) are made. since these calls may only
      be made once during a given command multiple calls are at the very least
      indicative of bad code and at worst cause severe state confusion for the
      slavebase that it won't be able to recover from, rendering the slave
      instance broken.
      in the internal class Results are returned whenever an error can appear and
      these Results must be handled in some form. the only way to effectively
      produce user visible errors is to forward results up the call chain.
      Test Plan:
      - connect
      - copy remotely
      - overwrite remotely
      - copy to local
      - overwrite to local
      - copy from local to remote
      - copy form local to remote and overwrite
      Reviewers: dfaure, feverfew
      Reviewed By: dfaure, feverfew
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D27153
  22. 11 Jan, 2020 1 commit
  23. 05 Dec, 2019 1 commit
  24. 19 Nov, 2019 1 commit
  25. 18 Nov, 2019 1 commit
  26. 11 Nov, 2019 1 commit
  27. 30 Aug, 2019 1 commit
    • Alexander Saoutkin's avatar
      Fixing implementation of FileJob interface in smb/sftp slaves · 28fdc41f
      Alexander Saoutkin authored
      This patch does the following:
      1. Fixing instances of finished() being called after error() in smb slave.
      2. Changing behaviour of the sftp/smb slave to conform to  what is stated in D23194. In particular, the sftp slave should not call finished() in the open()/read()/write()/seek() methods.
      Test Plan: It compiles...
      Reviewers: chinmoyr, fvogt, sitter, dfaure
      Reviewed By: dfaure
      Subscribers: bcooksley, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D23207
  28. 06 Aug, 2019 1 commit
  29. 22 Jul, 2019 1 commit
  30. 21 Jul, 2019 2 commits
    • Piyush Aggarwal's avatar
      WIP : Fix SFTP Plugin of KIO for Windows · d6d724b9
      Piyush Aggarwal authored
      The fixed plugin works on Windows. Right now, KDE Connect uses it to establish an initial connection over SFTP, which can then be offloaded to any sftp:// handling application.
      Currently, this can be achieved seamlessly by using [WinSCP](https://winscp.net) which is a free and open source SFTP Client.
      Test Plan:
      0. Install WinSCP : https://winscp.net/eng/download.php.
      1. set Craft to use `master` for `kio-extras`
      craft --set version=master kio-extras
      2. install `kio-extras` and all deps
      craft -i kio-extras
      3. apply this patch
      4. re-build `kio-extras`
      craft --compile --install --qmerge kio-extras
      5. checkout `milestone2` branch from invent.kde.org/piyushaggarwal/kdeconnect-kde
      6. build `kdeconnect-kde` again
      craft --compile --install --qmerge kdeconnect-kde
      7. Run `kdeconnect-indicator.exe` from within `CraftRoot/bin/`
      8. Right  Click on the dark icon in sys tray, go to your phone and click on **Browse Device**.
      9. Press YES, followed by an OK on password prompt (the correct password comes pre-filled).
      10. Expect WinSCP to take point from there on.
      Reviewers: albertvaka, vonreth, sredman, sitter, dfaure
      Reviewed By: vonreth, dfaure
      Subscribers: pino, andriusr, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D22105
    • David Faure's avatar
  31. 17 Mar, 2019 1 commit
    • David Hallas's avatar
      Fix malloc/delete mismatch · a617da3b
      David Hallas authored
      Fixes pointer was allocated with malloc (by libssh) but freed with
      delete. This is not safe and causes undefined behavior.
      Test Plan: Build and run kio_sftp with address sanitizer
      Reviewers: #frameworks, dfaure, sitter, aacid
      Reviewed By: aacid
      Subscribers: aacid, kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D19767
  32. 15 Mar, 2019 1 commit
    • David Hallas's avatar
      Fixes memory leak of ssh_session · b85ec7a5
      David Hallas authored
      Fixes memory leak of ssh_session. The mSession member variable is
      allocated with a call to ssh_new in sftpOpenConnection but in the
      closeConnection a call to ssh_free was missing causing the ssh_session
      to be leaked.
      Test Plan: Build and run kio_sftp with address sanitizer
      Reviewers: #frameworks, sitter, aacid
      Reviewed By: aacid
      Subscribers: kde-frameworks-devel, kfm-devel
      Tags: #dolphin, #frameworks
      Differential Revision: https://phabricator.kde.org/D19768
  33. 23 Feb, 2019 1 commit