Skip to content

Commit

Permalink
nss: load CA certificates even with --insecure
Browse files Browse the repository at this point in the history
... because they may include an intermediate certificate for a client
certificate and the intermediate certificate needs to be presented to
the server, no matter if we verify the peer or not.

Reported-by: thraidh
Closes #851
  • Loading branch information
kdudka committed Apr 10, 2017
1 parent 764ad34 commit d29e9de
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/vtls/nss.c
Expand Up @@ -1770,9 +1770,12 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
if(SSL_HandshakeCallback(model, HandshakeCallback, conn) != SECSuccess)
goto error;

if(SSL_CONN_CONFIG(verifypeer)) {
{
const CURLcode rv = nss_load_ca_certificates(conn, sockindex);
if(rv) {
if((rv == CURLE_SSL_CACERT_BADFILE) && !SSL_CONN_CONFIG(verifypeer))
/* not a fatal error because we are not going to verify the peer */
infof(data, "warning: CA certificates failed to load\n");
else if(rv) {
result = rv;
goto error;
}
Expand Down

0 comments on commit d29e9de

Please sign in to comment.