Encapsulate the SFTP server session#4979
Draft
ricab wants to merge 23 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix-ssh-session-shutdown #4979 +/- ##
============================================================
- Coverage 87.78% 87.76% -0.01%
============================================================
Files 274 275 +1
Lines 14694 14703 +9
============================================================
+ Hits 12897 12903 +6
- Misses 1797 1800 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
87795bb to
b592988
Compare
d80c14d to
107b7d5
Compare
bd387af to
72d3f9e
Compare
107b7d5 to
8b7f44a
Compare
Aggregate an SftpServerSession in the SftpServer, delegating its initialization to the new SSHSession factory.
borrow_channel returns a non-owning channel handle and releases the session lock, with access gated to PlainSftpServerSession via PrivatePassProvider. Unlike release_channel, channel ownership stays with the process for its lifetime, closing the channel leak on reconnect.
Consume an rvalue SSHSession in order to create an SftpServerSession. Create a ghost SSHSession for the time being, using a custom, empty key provider.
Add a method to borrow a PlainSSHSession's underlying libssh session, restricting it to the PlainSftpServerSession via a private pass.
Delete copy/move operations on the PlainSftpServerSession.
Copy the function that creates a libssh sftp_session to use in PlainSftpServerSession. Mark the original for eventual deletion. (Breaks tests.)
Convert the make_sftp_session helper to a private static method, so that it can access the private typedef for the SftpSessionUptr.
Libssh uses `ssh_session` for a type name, so rename the field to avoid shadowing.
Reproduce existing code to initialize the sshfs process into the PlainSftpServerSession, with a minor tweak of dropping an unused param. Mark old versions for removal.
To ensure we remain in the "Plain plane" at compile time and let us avoid casts entirely. Mocking will be achieved later via a MockableSingleton wrap of libssh (happening elsewhere).
PlainSftpServerSession is a mouthful. There is no SftpClientSession, so just remove the Server and document the class. Then adapt variable names to avoid shadowing libssh's sftp_session, as well as ssh_session.
Rename a few more vars to avoid shadowing libssh types.
Rename SSHSession::force_shutdown to express its true intent: shutting down custom sockets, which libssh won't disconnect on its own. While we're not ssh-ing over custom sockets yet, that is planned for VSOCK.
72d3f9e to
2ac37a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue(s)
Closes # (issue number)
Testing
Unit tests
Manual testing steps:
Screenshots (if applicable)
Checklist
Additional Notes