diff options
author | Kamil Dudka <kdudka@redhat.com> | 2016-08-22 10:24:35 +0200 |
---|---|---|
committer | Kamil Dudka <kdudka@redhat.com> | 2016-08-26 13:30:27 +0200 |
commit | 7700fcba64bf5806de28f6c1c7da3b4f0b38567d (patch) | |
tree | 553071c3a97daa2dad1a88b656b4c7c9e28c8add /lib/vtls | |
parent | 822082d8327a41aafa4c6b7696bfcb8b56037cbf (diff) |
nss: refuse previously loaded certificate from file
... when we are not asked to use a certificate from file
Diffstat (limited to 'lib/vtls')
-rw-r--r-- | lib/vtls/nss.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index 20c4277ce..cfb226328 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -1002,10 +1002,10 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg; struct Curl_easy *data = connssl->data; const char *nickname = connssl->client_nickname; + static const char pem_slotname[] = "PEM Token #1"; if(connssl->obj_clicert) { /* use the cert/key provided by PEM reader */ - static const char pem_slotname[] = "PEM Token #1"; SECItem cert_der = { 0, NULL, 0 }; void *proto_win = SSL_RevealPinArg(sock); struct CERTCertificateStr *cert; @@ -1067,6 +1067,12 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, if(NULL == nickname) 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) { failf(data, "NSS: private key not found for certificate: %s", nickname); return SECFailure; |