gskit: various compile errors in OS400

Various compile failures in gskit.c;

- pipe_ssloverssl() needs Curl_easy data parameter for
  Curl_conn_cf_get_socket(cf, data)
- key_passwd is in ssl_config, not conn_config
- close_on() has 2 parameters, not 4
- getsockopt() needs to call Curl_conn_cf_get_socket(), not
  cxn->sock[FIRSTSOCKET]

Fixes #10799
Closes #10800
This commit is contained in:
jonrumsey 2023-03-20 10:17:09 +00:00 committed by Daniel Stenberg
parent c0a9f905e6
commit 8a83bda0a2
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -511,7 +511,8 @@ static void close_async_handshake(struct ssl_connect_data *connssl)
BACKEND->iocport = -1;
}
static int pipe_ssloverssl(struct Curl_cfilter *cf, int directions)
static int pipe_ssloverssl(struct Curl_cfilter *cf, struct Curl_easy *data,
int directions)
{
struct ssl_connect_data *connssl = cf->ctx;
struct Curl_cfilter *cf_ssl_next = Curl_ssl_cf_get_ssl(cf->next);
@ -594,7 +595,7 @@ static void close_one(struct Curl_cfilter *cf, struct Curl_easy *data)
gskit_status(data, gsk_secure_soc_close(&BACKEND->handle),
"gsk_secure_soc_close()", 0);
/* Last chance to drain output. */
while(pipe_ssloverssl(cf, SOS_WRITE) > 0)
while(pipe_ssloverssl(cf, data, SOS_WRITE) > 0)
;
BACKEND->handle = (gsk_handle) NULL;
if(BACKEND->localfd >= 0) {
@ -621,13 +622,13 @@ static ssize_t gskit_send(struct Curl_cfilter *cf, struct Curl_easy *data,
DEBUGASSERT(BACKEND);
if(pipe_ssloverssl(cf, SOS_WRITE) >= 0) {
if(pipe_ssloverssl(cf, data, SOS_WRITE) >= 0) {
cc = gskit_status(data,
gsk_secure_soc_write(BACKEND->handle,
(char *) mem, (int) len, &written),
"gsk_secure_soc_write()", CURLE_SEND_ERROR);
if(cc == CURLE_OK)
if(pipe_ssloverssl(cf, SOS_WRITE) < 0)
if(pipe_ssloverssl(cf, data, SOS_WRITE) < 0)
cc = CURLE_SEND_ERROR;
}
if(cc != CURLE_OK) {
@ -649,7 +650,7 @@ static ssize_t gskit_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
(void)data;
DEBUGASSERT(BACKEND);
if(pipe_ssloverssl(cf, SOS_READ) >= 0) {
if(pipe_ssloverssl(cf, data, SOS_READ) >= 0) {
int buffsize = buffersize > (size_t) INT_MAX? INT_MAX: (int) buffersize;
cc = gskit_status(data, gsk_secure_soc_read(BACKEND->handle,
buf, buffsize, &nread),
@ -716,7 +717,7 @@ static CURLcode gskit_connect_step1(struct Curl_cfilter *cf,
gsk_handle envir;
CURLcode result;
const char * const keyringfile = conn_config->CAfile;
const char * const keyringpwd = conn_config->key_passwd;
const char * const keyringpwd = ssl_config->key_passwd;
const char * const keyringlabel = ssl_config->primary.clientcert;
const long int ssl_version = conn_config->version;
const bool verifypeer = conn_config->verifypeer;
@ -932,7 +933,7 @@ static CURLcode gskit_connect_step1(struct Curl_cfilter *cf,
}
/* Error: rollback. */
close_one(connssl, data, conn, sockindex);
close_one(cf, data);
return result;
}
@ -1111,7 +1112,7 @@ static CURLcode gskit_connect_common(struct Curl_cfilter *cf,
/* Handle handshake pipelining. */
if(!result)
if(pipe_ssloverssl(cf, SOS_READ | SOS_WRITE) < 0)
if(pipe_ssloverssl(cf, data, SOS_READ | SOS_WRITE) < 0)
result = CURLE_SSL_CONNECT_ERROR;
/* Step 2: check if handshake is over. */
@ -1130,7 +1131,7 @@ static CURLcode gskit_connect_common(struct Curl_cfilter *cf,
/* Handle handshake pipelining. */
if(!result)
if(pipe_ssloverssl(cf, SOS_READ | SOS_WRITE) < 0)
if(pipe_ssloverssl(cf, data, SOS_READ | SOS_WRITE) < 0)
result = CURLE_SSL_CONNECT_ERROR;
/* Step 3: gather certificate info, verify host. */
@ -1138,7 +1139,7 @@ static CURLcode gskit_connect_common(struct Curl_cfilter *cf,
result = gskit_connect_step3(cf, data);
if(result)
close_one(connssl, data, conn, sockindex);
close_one(cf, data);
else if(connssl->connecting_state == ssl_connect_done) {
connssl->state = ssl_connection_complete;
connssl->connecting_state = ssl_connect_1;
@ -1271,7 +1272,7 @@ static int gskit_check_cxn(struct Curl_cfilter *cf,
err = 0;
errlen = sizeof(err);
if(getsockopt(cxn->sock[FIRSTSOCKET], SOL_SOCKET, SO_ERROR,
if(getsockopt(Curl_conn_cf_get_socket(cf, data), SOL_SOCKET, SO_ERROR,
(unsigned char *) &err, &errlen) ||
errlen != sizeof(err) || err)
return 0; /* connection has been closed */