Unverified Commit 5c213e29 by Edward Thomson Committed by GitHub

Merge pull request #4875 from tiennou/fix/openssl-errors

Some OpenSSL issues
parents 0310749b 03994912
......@@ -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");
break;
case SSL_ERROR_WANT_X509_LOOKUP:
giterr_set(GITERR_NET, "SSL error: x509 error");
giterr_set(GITERR_SSL, "SSL error: x509 error");
break;
case SSL_ERROR_SYSCALL:
e = ERR_get_error();
......@@ -389,7 +389,7 @@ static int ssl_set_error(SSL *ssl, int error)
giterr_set(GITERR_OS, "SSL error: syscall failure");
break;
}
giterr_set(GITERR_NET, "SSL error: received early EOF");
giterr_set(GITERR_SSL, "SSL error: received early EOF");
return GIT_EEOF;
break;
case SSL_ERROR_SSL:
......@@ -397,13 +397,13 @@ static int ssl_set_error(SSL *ssl, int error)
char errmsg[256];
e = ERR_get_error();
ERR_error_string_n(e, errmsg, sizeof(errmsg));
giterr_set(GITERR_NET, "SSL error: %s", errmsg);
giterr_set(GITERR_SSL, "SSL error: %s", errmsg);
break;
}
case SSL_ERROR_NONE:
case SSL_ERROR_ZERO_RETURN:
default:
giterr_set(GITERR_NET, "SSL error: unknown error");
giterr_set(GITERR_SSL, "SSL error: unknown error");
break;
}
return -1;
......@@ -586,8 +586,6 @@ int openssl_connect(git_stream *stream)
if ((ret = git_stream_connect(st->io)) < 0)
return ret;
st->connected = true;
bio = BIO_new(git_stream_bio_method);
GITERR_CHECK_ALLOC(bio);
......@@ -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;
return verify_server_cert(st->ssl, st->host);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment