mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
getinfo: repair CURLINFO_TLS_SESSION
This should return a SSL_CTX pointer but it was accidentally broken.
Follow-up to 2db8ae480f
Spotted by Codex Security
This commit is contained in:
parent
a5542c23e7
commit
62ef55d64f
@ -676,14 +676,16 @@ bool Curl_conn_is_ssl(struct connectdata *conn, int sockindex)
|
||||
|
||||
bool Curl_conn_get_ssl_info(struct Curl_easy *data,
|
||||
struct connectdata *conn, int sockindex,
|
||||
int query,
|
||||
struct curl_tlssessioninfo *info)
|
||||
{
|
||||
if(!CONN_SOCK_IDX_VALID(sockindex))
|
||||
return FALSE;
|
||||
if(Curl_conn_is_ssl(conn, sockindex)) {
|
||||
struct Curl_cfilter *cf = conn->cfilter[sockindex];
|
||||
CURLcode result = cf ? cf->cft->query(cf, data, CF_QUERY_SSL_INFO,
|
||||
NULL, (void *)info) : CURLE_UNKNOWN_OPTION;
|
||||
CURLcode result = cf ?
|
||||
cf->cft->query(cf, data, query, NULL, (void *)info) :
|
||||
CURLE_UNKNOWN_OPTION;
|
||||
return !result;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
@ -400,6 +400,7 @@ bool Curl_conn_is_ssl(struct connectdata *conn, int sockindex);
|
||||
*/
|
||||
bool Curl_conn_get_ssl_info(struct Curl_easy *data,
|
||||
struct connectdata *conn, int sockindex,
|
||||
int query,
|
||||
struct curl_tlssessioninfo *info);
|
||||
|
||||
CURLcode Curl_conn_get_ip_info(struct Curl_easy *data,
|
||||
|
||||
@ -586,6 +586,8 @@ static CURLcode getinfo_slist(struct Curl_easy *data, CURLINFO info,
|
||||
break;
|
||||
case CURLINFO_TLS_SESSION:
|
||||
case CURLINFO_TLS_SSL_PTR: {
|
||||
int query = (info == CURLINFO_TLS_SSL_PTR) ?
|
||||
CF_QUERY_SSL_INFO : CF_QUERY_SSL_CTX_INFO;
|
||||
struct curl_tlssessioninfo **tsip = (struct curl_tlssessioninfo **)
|
||||
param_slistp;
|
||||
struct curl_tlssessioninfo *tsi = &data->tsi;
|
||||
@ -593,7 +595,7 @@ static CURLcode getinfo_slist(struct Curl_easy *data, CURLINFO info,
|
||||
/* we are exposing a pointer to internal memory with unknown
|
||||
* lifetime here. */
|
||||
*tsip = tsi;
|
||||
if(!Curl_conn_get_ssl_info(data, data->conn, FIRSTSOCKET, tsi)) {
|
||||
if(!Curl_conn_get_ssl_info(data, data->conn, FIRSTSOCKET, query, tsi)) {
|
||||
tsi->backend = Curl_ssl_backend();
|
||||
tsi->internals = NULL;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user