schannel.c: Improve code path and readability
This commit is contained in:
parent
d93619ca5d
commit
ae8387b91c
@ -993,17 +993,10 @@ schannel_recv(struct connectdata *conn, int sockindex,
|
|||||||
/* reset encrypted buffer offset, because there is no data remaining */
|
/* reset encrypted buffer offset, because there is no data remaining */
|
||||||
connssl->encdata_offset = 0;
|
connssl->encdata_offset = 0;
|
||||||
}
|
}
|
||||||
} /* check if something went wrong and we need to return an error */
|
|
||||||
else {
|
|
||||||
infof(data, "schannel: failed to read data from server: %s\n",
|
|
||||||
Curl_sspi_strerror(conn, sspi_status));
|
|
||||||
*err = CURLE_RECV_ERROR;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check if server wants to renegotiate the connection context */
|
/* check if server wants to renegotiate the connection context */
|
||||||
if(sspi_status == SEC_I_RENEGOTIATE) {
|
if(sspi_status == SEC_I_RENEGOTIATE) {
|
||||||
infof(data, "schannel: remote party requests SSL/TLS renegotiation\n");
|
infof(data, "schannel: remote party requests renegotiation\n");
|
||||||
|
|
||||||
/* begin renegotiation */
|
/* begin renegotiation */
|
||||||
infof(data, "schannel: renegotiating SSL/TLS connection\n");
|
infof(data, "schannel: renegotiating SSL/TLS connection\n");
|
||||||
@ -1019,6 +1012,14 @@ schannel_recv(struct connectdata *conn, int sockindex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
/* something went wrong and we need to return an error */
|
||||||
|
infof(data, "schannel: failed to read data from server: %s\n",
|
||||||
|
Curl_sspi_strerror(conn, sspi_status));
|
||||||
|
*err = CURLE_RECV_ERROR;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
infof(data, "schannel: decrypted data buffer: offset %zu length %zu\n",
|
infof(data, "schannel: decrypted data buffer: offset %zu length %zu\n",
|
||||||
connssl->decdata_offset, connssl->decdata_length);
|
connssl->decdata_offset, connssl->decdata_length);
|
||||||
@ -1036,12 +1037,12 @@ schannel_recv(struct connectdata *conn, int sockindex,
|
|||||||
infof(data, "schannel: decrypted data returned %zd\n", size);
|
infof(data, "schannel: decrypted data returned %zd\n", size);
|
||||||
infof(data, "schannel: decrypted data buffer: offset %zu length %zu\n",
|
infof(data, "schannel: decrypted data buffer: offset %zu length %zu\n",
|
||||||
connssl->decdata_offset, connssl->decdata_length);
|
connssl->decdata_offset, connssl->decdata_length);
|
||||||
} /* check if the server closed the connection */
|
}
|
||||||
else if(sspi_status == SEC_I_CONTEXT_EXPIRED ||
|
/* check if the server closed the connection, */
|
||||||
/* special check for Windows 2000 Professional */
|
/* including special check for Windows 2000 Professional */
|
||||||
(sspi_status == SEC_E_OK && connssl->encdata_offset > 0 &&
|
else if(sspi_status == SEC_I_CONTEXT_EXPIRED || (sspi_status == SEC_E_OK &&
|
||||||
connssl->encdata_buffer[0] == 0x15)) {
|
connssl->encdata_offset && connssl->encdata_buffer[0] == 0x15)) {
|
||||||
infof(data, "schannel: server closed the conunection\n");
|
infof(data, "schannel: server closed the connection\n");
|
||||||
*err = CURLE_OK;
|
*err = CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user