curl: Backport certificate reuse fix from 7.50.2
Backport curl upstream commit curl-7_50_2~32 (nss: refuse previously loaded certificate from file, 2016-08-22).
This commit is contained in:
parent
0fd54137ae
commit
4b53a693bd
|
@ -1004,10 +1004,10 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
|
||||||
struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg;
|
struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg;
|
||||||
struct Curl_easy *data = connssl->data;
|
struct Curl_easy *data = connssl->data;
|
||||||
const char *nickname = connssl->client_nickname;
|
const char *nickname = connssl->client_nickname;
|
||||||
|
static const char pem_slotname[] = "PEM Token #1";
|
||||||
|
|
||||||
if(connssl->obj_clicert) {
|
if(connssl->obj_clicert) {
|
||||||
/* use the cert/key provided by PEM reader */
|
/* use the cert/key provided by PEM reader */
|
||||||
static const char pem_slotname[] = "PEM Token #1";
|
|
||||||
SECItem cert_der = { 0, NULL, 0 };
|
SECItem cert_der = { 0, NULL, 0 };
|
||||||
void *proto_win = SSL_RevealPinArg(sock);
|
void *proto_win = SSL_RevealPinArg(sock);
|
||||||
struct CERTCertificateStr *cert;
|
struct CERTCertificateStr *cert;
|
||||||
|
@ -1069,6 +1069,12 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock,
|
||||||
if(NULL == nickname)
|
if(NULL == nickname)
|
||||||
nickname = "[unknown]";
|
nickname = "[unknown]";
|
||||||
|
|
||||||
|
if(!strncmp(nickname, pem_slotname, sizeof(pem_slotname) - 1U)) {
|
||||||
|
failf(data, "NSS: refusing previously loaded certificate from file: %s",
|
||||||
|
nickname);
|
||||||
|
return SECFailure;
|
||||||
|
}
|
||||||
|
|
||||||
if(NULL == *pRetKey) {
|
if(NULL == *pRetKey) {
|
||||||
failf(data, "NSS: private key not found for certificate: %s", nickname);
|
failf(data, "NSS: private key not found for certificate: %s", nickname);
|
||||||
return SECFailure;
|
return SECFailure;
|
||||||
|
|
Loading…
Reference in New Issue