1. 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
      Summary:
      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
      scenarios.
      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
      d8cf85ec
    • Harald Sitter's avatar
      smb: guard against duplicated service discoveries · ba96d3b9
      Harald Sitter authored
      Summary:
      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
      ba96d3b9
  2. 18 Mar, 2020 4 commits
  3. 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
      8f45f13d
    • Harald Sitter's avatar
      style++ · 7cc854ae
      Harald Sitter authored
      GIT_SILENT
      7cc854ae
    • Harald Sitter's avatar
      add readdirplus2 support for samba>=4.12 · ec40cd6e
      Harald Sitter authored
      Summary:
      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
      paths.
      
      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
      ec40cd6e
    • Harald Sitter's avatar
      smb: do not double finish · 82528611
      Harald Sitter authored
      Summary:
      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
      82528611
    • 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"
      4107f48c
  4. 15 Mar, 2020 1 commit
  5. 11 Mar, 2020 1 commit
  6. 06 Mar, 2020 7 commits
    • Harald Sitter's avatar
      smb: fix wsdiscovery unknown device fallback string · 6557c6b4
      Harald Sitter authored
      Summary:
      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
      included
      
      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
      6557c6b4
    • Harald Sitter's avatar
      smb: do not leak pbsd resolvers · 1eacae52
      Harald Sitter authored
      Summary:
      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
      1eacae52
    • Harald Sitter's avatar
      smb: fix ipv6 support · bb83a071
      Harald Sitter authored
      Summary:
      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
      bb83a071
    • Harald Sitter's avatar
      smb: add a unit test for smburl · d8d92670
      Harald Sitter authored
      Summary:
      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
      url
      
      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
      d8d92670
    • Harald Sitter's avatar
      smb: split module into two targets of which one is a static lib · d101d916
      Harald Sitter authored
      Summary:
      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
      anyway
      
      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
      d101d916
    • Harald Sitter's avatar
      sftp: fix free space query for urls with empty path · 5cfd852a
      Harald Sitter authored
      Summary:
      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
      5cfd852a
    • Harald Sitter's avatar
  7. 05 Mar, 2020 1 commit
  8. 04 Mar, 2020 1 commit
  9. 03 Mar, 2020 8 commits
  10. 29 Feb, 2020 1 commit
  11. 26 Feb, 2020 4 commits
    • Harald Sitter's avatar
      sftp: port to Result system to force serialization of error/finish condition · 74850eb2
      Harald Sitter authored
      Summary:
      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
      74850eb2
    • Harald Sitter's avatar
      smb: apply a whole bunch of static analyzer improvements · 70f2dc85
      Harald Sitter authored
      Summary:
      among other things:
      
      - {} initialize the posix structs
      - =default d/ctors where appropriate
      - synced argument names between header and cpp
      - no c-style casting
      - while(true) instead of while(1)
      - initialize class members that could previously have gone uninitialized
      - no single-line-multi-variable declaration
      
      Test Plan: builds
      
      Reviewers: ngraham
      
      Reviewed By: ngraham
      
      Subscribers: kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27646
      70f2dc85
    • Harald Sitter's avatar
      smb: throw out the windows variant of the slave · 60c9ac5a
      Harald Sitter authored
      Summary:
      it hasn't been built in ages because the top level cmakelists actually only
      adds the smb dir when samba is found (which would be never I guess?).
      it is also continuously ignored when sweeping changes are made (such as
      the move to json plugin metadata or the debug category change).
      
      overall it is entirely useless as native UNC path handling seems to work
      just fine these days in for example okular and kate. so, I very much
      believe that bespoke smb handling is entirely moot on windows (as it
      should be, really)
      
      Test Plan: okular and kate still open remote UNC paths without it on windows
      
      Reviewers: ngraham, #windows, vonreth
      
      Reviewed By: ngraham, #windows, vonreth
      
      Subscribers: kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27647
      60c9ac5a
    • Harald Sitter's avatar
      smb: do not hide enum warnings via switch default label · d0e16b83
      Harald Sitter authored
      Summary:
      should we ever extend the url types the compiler will not warn us that
      the new type may need handling. instead return when we have handled
      a type so the fallback can be moved after the switch
      
      Reviewers: ngraham
      
      Reviewed By: ngraham
      
      Subscribers: kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27644
      d0e16b83
  12. 24 Feb, 2020 1 commit
    • Harald Sitter's avatar
      add initial wsdiscovery support · 41397521
      Harald Sitter authored
      Summary:
      needs kdsoap >= 1.8.50 (current master).
      builds a static variant of kdsoap-ws-discovery-client but can also
      use system's version if available.
      
      also reinvents how discovery works:
      there are now Discoverers for dnssd and wsd that get started/stopped.
      the Discoverers discover servers and emit them as Discoveries. Discoveries
      are then converted to udsentries for kio.
      
      BUG: 392447
      FIXED-IN: 20.04.0
      
      Test Plan:
      discover all the things!
      
      - windows 10 test vm with remote address
      - https://github.com/christgau/wsdd on remote host
      - avahi smb on remote host
      
      Reviewers: dfaure, #frameworks, #dolphin, ngraham
      
      Reviewed By: dfaure, ngraham
      
      Subscribers: meven, schmeisser, bcooksley, ngraham, caspermeijn, davidedmundson, kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D25682
      41397521
  13. 14 Feb, 2020 4 commits
    • Harald Sitter's avatar
      smb: map EHOSTUNREACH to ERR_CANNOT_CONNECT · a813d67c
      Harald Sitter authored
      Summary:
      same as the ftp does. in fact, also steal the error message qtcpsocket
      produces. effectively this makes smb://unavailableipaddress spit out
      exactly the same error as ftp://unavailableipaddress
      
      host unreachable being so vague, the pretty string continues to be vague
      as well unfortunately.
      
      BUG: 417166
      FIXED-IN: 20.08.0
      
      Test Plan: error upon accessing the unassigned address 192.168.1.99 is same between smb and ftp
      
      Reviewers: ngraham
      
      Reviewed By: ngraham
      
      Subscribers: kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27378
      a813d67c
    • Harald Sitter's avatar
      smb: fix horrendous indentation in auth.cpp · 233f30dc
      Harald Sitter authored
      it was all over the place.
      also reduce nesting in auth_initialize_smbc by returning early if already
      init'd. also happens to reduce the debug spam on noop calls
      233f30dc
    • Harald Sitter's avatar
      Merge branch 'release/19.12' · 101c8781
      Harald Sitter authored
      # Conflicts:
      #	smb/kio_smb_auth.cpp
      101c8781
    • Harald Sitter's avatar
      smb: enable anonymous and domain extra field in authinfo · 9d52cd9c
      Harald Sitter authored
      Summary:
      this causes kiod to query the password with the relevant functionality
      enabled. domain additionally defaults to whatever smbc_getWorkgroup returns
      
      BUG: 327484
      FIXED-IN: 19.12.3
      
      Test Plan:
      - builds
      - auth query has new functionality
      - logging in still works as expected
      
      I couldn't actually get the original problem in 327484 to appear with a samba DC I threw together, so for all I know this doesn't actually fix the bug but I have no way to test :|
      
      Reviewers: ngraham, dfaure
      
      Reviewed By: ngraham
      
      Subscribers: kde-frameworks-devel, kfm-devel
      
      Tags: #dolphin, #frameworks
      
      Differential Revision: https://phabricator.kde.org/D27320
      9d52cd9c