Skip to content

Commit 0399491

Browse files
committed
openssl: only say we're connected if the connection succeeded
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.
1 parent caee0a6 commit 0399491

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/streams/openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,6 @@ int openssl_connect(git_stream *stream)
586586
if ((ret = git_stream_connect(st->io)) < 0)
587587
return ret;
588588

589-
st->connected = true;
590-
591589
bio = BIO_new(git_stream_bio_method);
592590
GITERR_CHECK_ALLOC(bio);
593591

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

603+
st->connected = true;
604+
605605
return verify_server_cert(st->ssl, st->host);
606606
}
607607

0 commit comments

Comments
 (0)