Repository navigation
openssl: fix misleading error message if wrong passphrase - #789
Merged
Merged
Conversation
vszakats
reviewed
Apr 9, 2023
Co-authored-by: Viktor Szakats <[email protected]>
Member
|
@libssh2/dev-team This is technically ready to merge. Any objection, opinion or review if we are good to go along with it? |
Member
|
Fixes #608 |
Merged
vszakats
pushed a commit
that referenced
this pull request
Apr 26, 2023
- openssl: fix potentially missing `ERR_*` constants by including `openssl/err.h`. This could happen with recent version of Xcode or when building against OpenSSL built with the `OPENSSL_NO_ENGINE` option. Regression from 097c8f0 (#789) - channel: fix an issue that would corrupt the data stream when attempting to initialize the agent in non-blocking mode, as it is necessary to propagate the `EAGAIN` signal upstream when the transport returns `EAGAIN`. Regression from bc4e619 (#752) - packet: the current code does not set the state machine upon reaching this point which means that if the code is suspended due to the transport returning an `EAGAIN`, this will re-initialize the structure every time. The issue is that this keeps assigning a new channel-id downstream, which does not match the initial channel-id that is initially generated, causing a lookup later to fail as there is no matching channel. Regression from bc4e619 (#752)
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
agreppin
pushed a commit
to agreppin/libssh2
that referenced
this pull request
Jul 14, 2024
- openssl: fix potentially missing `ERR_*` constants by including `openssl/err.h`. This could happen with recent version of Xcode or when building against OpenSSL built with the `OPENSSL_NO_ENGINE` option. Regression from 097c8f0 (libssh2#789) - channel: fix an issue that would corrupt the data stream when attempting to initialize the agent in non-blocking mode, as it is necessary to propagate the `EAGAIN` signal upstream when the transport returns `EAGAIN`. Regression from bc4e619 (libssh2#752) - packet: the current code does not set the state machine upon reaching this point which means that if the code is suspended due to the transport returning an `EAGAIN`, this will re-initialize the structure every time. The issue is that this keeps assigning a new channel-id downstream, which does not match the initial channel-id that is initially generated, causing a lookup later to fail as there is no matching channel. Regression from bc4e619 (libssh2#752)
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.
Hi,
if a wrong passphrase is entered by the user, libssh2_userauth_publickey_frommemory fails with:
Since this is a common error case, and errors are ultimately propagated to the end user, I believe an explicit error mentioning "wrong passphrase" should be returned instead.
Best, Zenju
PS:
But it seems, _libssh2_error() cannot handle a non-static error message at this time.
=> Ideally, libssh2 would search for OPENSSH_HEADER_BEGIN in "privatekeydata", and only then try the OpenSSH format. For a quick check, this would require something like strnstr() because "privatekeydata" is not null-terminated. e.g. https://opensource.apple.com/source/Libc/Libc-1158.30.7/string/FreeBSD/strnstr.c.auto.html