Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some OpenSSL issues #4875

Merged
merged 2 commits into from Nov 18, 2018
Merged

Some OpenSSL issues #4875

merged 2 commits into from Nov 18, 2018

Conversation

tiennou
Copy link
Contributor

@tiennou tiennou commented Nov 1, 2018

Reading #4644 was eerily familiar, so it made me start looking for "that patch I had written but now I can't find it" 馃槈.

This is extracted from #4786, I'm not sure if it is the complete story, but at least it would help downstream (and us) to pinpoint the reason for those failures.

ssl_close uses this boolean to know if SSL_shutdown should be called.
It turns out OpenSSL auto-shutdowns on failure, so if the call to
SSL_connect fails, it will complain about "shutdown while in init",
trampling the original error.
@pks-t
Copy link
Member

pks-t commented Nov 7, 2018

/rebuild

@libgit2-azure-pipelines
Copy link

Okay, @pks-t, I started to rebuild this pull request.

Copy link
Member

@pks-t pks-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks! Waiting for CI, as the first run failed

@@ -373,10 +373,10 @@ static int ssl_set_error(SSL *ssl, int error)
switch (err) {
case SSL_ERROR_WANT_CONNECT:
case SSL_ERROR_WANT_ACCEPT:
giterr_set(GITERR_NET, "SSL error: connection failure");
giterr_set(GITERR_SSL, "SSL error: connection failure");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these changes make sense. The other secure streams also use GITERR_SSL for various SSL-related failures

@@ -602,6 +600,8 @@ int openssl_connect(git_stream *stream)
if ((ret = SSL_connect(st->ssl)) <= 0)
return ssl_set_error(st->ssl, ret);

st->connected = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, too. One might wonder about whether the BIO will still get free'd if we never call SSL_shutdown. But documentation of SSL_set_bio states that BIO's ownership is transferred to the SSL handle and will get free'd with BIO_free_all as soon the SSL handle is free'd.

@ethomson ethomson merged commit 5c213e2 into libgit2:master Nov 18, 2018
@ethomson
Copy link
Member

Thanks!

@tiennou
Copy link
Contributor Author

tiennou commented Jan 10, 2019

@ethomson Though it's minor, also next-release (unless it was backported).

* Fix some issues with the error-reporting in the OpenSSL backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants