Skip to content

Some OpenSSL issues - #4875

Merged
ethomson merged 2 commits into
libgit2:masterfrom
tiennou:fix/openssl-errors
Nov 18, 2018
Merged

Some OpenSSL issues#4875
ethomson merged 2 commits into
libgit2:masterfrom
tiennou:fix/openssl-errors

Conversation

@tiennou

@tiennou tiennou commented Nov 1, 2018

Copy link
Copy Markdown
Contributor

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

pks-t commented Nov 7, 2018

Copy link
Copy Markdown
Member

/rebuild

@libgit2-azure-pipelines

Copy link
Copy Markdown

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

@pks-t pks-t left a comment

Copy link
Copy Markdown
Member

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

Comment thread src/streams/openssl.c
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
Copy Markdown
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

Comment thread src/streams/openssl.c
if ((ret = SSL_connect(st->ssl)) <= 0)
return ssl_set_error(st->ssl, ret);

st->connected = true;

Copy link
Copy Markdown
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
Copy Markdown
Member

Thanks!

@tiennou

tiennou commented Jan 10, 2019

Copy link
Copy Markdown
Contributor Author

@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.

3 participants