Skip to content

Commit

Permalink
OpenSSL: fix yet another mistake while encapsulating SSL backend data
Browse files Browse the repository at this point in the history
Another mistake in my manual fixups of the largely mechanical
search-and-replace ("connssl->" -> "BACKEND->"), just like the previous
commit concerning HTTPS proxies (and hence not caught during my
earlier testing).

Fixes #1855
Closes #1871

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho authored and bagder committed Sep 7, 2017
1 parent dde4f5c commit f4a6238
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/vtls/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3366,10 +3366,12 @@ static bool Curl_ossl_data_pending(const struct connectdata *conn,
int connindex)
{
const struct ssl_connect_data *connssl = &conn->ssl[connindex];
const struct ssl_connect_data *proxyssl = &conn->proxy_ssl[connindex];
if(BACKEND->handle)
/* SSL is in use */
return (0 != SSL_pending(BACKEND->handle) ||
(BACKEND->handle && 0 != SSL_pending(BACKEND->handle))) ?
(proxyssl->backend->handle &&
0 != SSL_pending(proxyssl->backend->handle))) ?
TRUE : FALSE;
return FALSE;
}
Expand Down

1 comment on commit f4a6238

@jay
Copy link
Member

@jay jay commented on f4a6238 Sep 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should check the proxy SSL handle separate, isn't it possible we're going to run into situations where the proxy ssl handle exists but the destination server ssl handle does not?

if(BACKEND->handle && SSL_pending(BACKEND->handle))
return TRUE;

if(proxyssl->backend->handle && SSL_pending(proxyssl->backend->handle))
return TRUE;

return FALSE;

gtls does it this way. for comparison:

curl/lib/vtls/gtls.c

Lines 1527 to 1542 in c73ebb8

static bool Curl_gtls_data_pending(const struct connectdata *conn,
int connindex)
{
const struct ssl_connect_data *connssl = &conn->ssl[connindex];
bool res = FALSE;
if(BACKEND->session &&
0 != gnutls_record_check_pending(BACKEND->session))
res = TRUE;
connssl = &conn->proxy_ssl[connindex];
if(BACKEND->session &&
0 != gnutls_record_check_pending(BACKEND->session))
res = TRUE;
return res;
}

Please sign in to comment.