mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-06 15:29:22 +00:00
Merge pull request #3445 from libgit2/cmn/ssl-null
openssl: don't try to teardown an unconnected SSL context
This commit is contained in:
commit
e8ccdd6bdf
@ -302,6 +302,7 @@ cert_fail_name:
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
git_stream parent;
|
git_stream parent;
|
||||||
git_stream *io;
|
git_stream *io;
|
||||||
|
bool connected;
|
||||||
char *host;
|
char *host;
|
||||||
SSL *ssl;
|
SSL *ssl;
|
||||||
git_cert_x509 cert_info;
|
git_cert_x509 cert_info;
|
||||||
@ -318,6 +319,8 @@ int openssl_connect(git_stream *stream)
|
|||||||
if ((ret = git_stream_connect(st->io)) < 0)
|
if ((ret = git_stream_connect(st->io)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
st->connected = true;
|
||||||
|
|
||||||
bio = BIO_new(&git_stream_bio_method);
|
bio = BIO_new(&git_stream_bio_method);
|
||||||
GITERR_CHECK_ALLOC(bio);
|
GITERR_CHECK_ALLOC(bio);
|
||||||
bio->ptr = st->io;
|
bio->ptr = st->io;
|
||||||
@ -406,9 +409,11 @@ int openssl_close(git_stream *stream)
|
|||||||
openssl_stream *st = (openssl_stream *) stream;
|
openssl_stream *st = (openssl_stream *) stream;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if ((ret = ssl_teardown(st->ssl)) < 0)
|
if (st->connected && (ret = ssl_teardown(st->ssl)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
st->connected = false;
|
||||||
|
|
||||||
return git_stream_close(st->io);
|
return git_stream_close(st->io);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user