Commit 3825a7f6 authored by Brian Carlstrom's avatar Brian Carlstrom
Browse files

Propagate pending exception from cert_client_cb

There can be a pending exception in the cert_client_cb if the server
certificate failed verification and the server requested a client
certificate. Since the handshake is going to be terminated, just
return from client_cert_cb immediately indicating no client cert will be
provided, allowing the existing exception to propagate.

Bug: 3149826
git cherry-pick 30a77f31

Bug: 3184701
Change-Id: I58b038267f66d6b5f80e9f3d81ff1c0f8052ef27
parent 2e9a4db4
......@@ -275,22 +275,24 @@ public final class HttpConnection {
}
@Override public boolean equals(Object other) {
if (other instanceof Address) {
Address that = (Address) other;
return Objects.equal(this.proxy, that.proxy)
&& this.uri.equals(that.uri)
&& this.requiresTunnel == that.requiresTunnel;
}
return false;
}
if (other instanceof Address) {
Address that = (Address) other;
return Objects.equal(this.proxy, that.proxy)
&& this.uri.getHost().equals(that.uri.getHost())
&& this.uri.getEffectivePort() == that.uri.getEffectivePort()
&& this.requiresTunnel == that.requiresTunnel;
}
return false;
}
@Override public int hashCode() {
int result = 17;
result = 31 * result + uri.hashCode();
result = 31 * result + (proxy != null ? proxy.hashCode() : 0);
result = 31 * result + (requiresTunnel ? 1 : 0);
return result;
}
@Override public int hashCode() {
int result = 17;
result = 31 * result + uri.getHost().hashCode();
result = 31 * result + uri.getEffectivePort();
result = 31 * result + (proxy != null ? proxy.hashCode() : 0);
result = 31 * result + (requiresTunnel ? 1 : 0);
return result;
}
public HttpConnection connect(int connectTimeout) throws IOException {
return new HttpConnection(this, connectTimeout);
......
......@@ -1634,6 +1634,10 @@ static int client_cert_cb(SSL* ssl, X509** x509Out, EVP_PKEY** pkeyOut) {
JNI_TRACE("ssl=%p client_cert_cb env error => 0", ssl);
return 0;
}
if (env->ExceptionCheck()) {
JNI_TRACE("ssl=%p client_cert_cb already pending exception", ssl);
return 0;
}
jobject sslHandshakeCallbacks = appData->sslHandshakeCallbacks;
jclass cls = env->GetObjectClass(sslHandshakeCallbacks);
......
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