Mercurial > pidgin
comparison libpurple/plugins/ssl/ssl-nss.c @ 27567:199cf148cdf8
Continue verification when we can't find a *cached* peer. Fixes #9664.
This should be a fatal condition and not finding a cached certificate
is *not* the same as "the certificate changed".
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 16 Jul 2009 02:46:36 +0000 |
parents | 0491bd8a2a60 |
children | 31905a0d1c9d |
comparison
equal
deleted
inserted
replaced
27566:d677981cf97e | 27567:199cf148cdf8 |
---|---|
544 gchar *rawcert; | 544 gchar *rawcert; |
545 gsize len = 0; | 545 gsize len = 0; |
546 CERTCertificate *crt_dat; | 546 CERTCertificate *crt_dat; |
547 PurpleCertificate *crt; | 547 PurpleCertificate *crt; |
548 | 548 |
549 g_return_val_if_fail(filename, NULL); | 549 g_return_val_if_fail(filename != NULL, NULL); |
550 | 550 |
551 purple_debug_info("nss/x509", | 551 purple_debug_info("nss/x509", |
552 "Loading certificate from %s\n", | 552 "Loading certificate from %s\n", |
553 filename); | 553 filename); |
554 | 554 |
555 /* Load the raw data up */ | 555 /* Load the raw data up */ |
556 if (!g_file_get_contents(filename, | 556 if (!g_file_get_contents(filename, |
557 &rawcert, &len, | 557 &rawcert, &len, |
558 NULL)) { | 558 NULL)) { |
559 purple_debug_error("nss/x509", "Unable to read certificate file.\n"); | 559 purple_debug_error("nss/x509", "Unable to read certificate file.\n"); |
560 return NULL; | 560 return NULL; |
561 } | 561 } |
562 | 562 |
563 if (len == 0) { | |
564 purple_debug_error("nss/x509", | |
565 "Certificate file has no contents!\n"); | |
566 if (rawcert) | |
567 g_free(rawcert); | |
568 return NULL; | |
569 } | |
570 | |
563 /* Decode the certificate */ | 571 /* Decode the certificate */ |
564 crt_dat = CERT_DecodeCertFromPackage(rawcert, len); | 572 crt_dat = CERT_DecodeCertFromPackage(rawcert, len); |
565 g_free(rawcert); | 573 g_free(rawcert); |
566 | 574 |
567 g_return_val_if_fail(crt_dat, NULL); | 575 g_return_val_if_fail(crt_dat != NULL, NULL); |
568 | 576 |
569 crt = g_new0(PurpleCertificate, 1); | 577 crt = g_new0(PurpleCertificate, 1); |
570 crt->scheme = &x509_nss; | 578 crt->scheme = &x509_nss; |
571 crt->data = crt_dat; | 579 crt->data = crt_dat; |
572 | 580 |
573 return crt; | 581 return crt; |