Bug 370136, Firefox 2.0.0.1 and later breaks automatic client certificate authentification.

Fixes a regression introduced with the fix for bug 328346.
Thanks a lot to Momtchil Momtchev for identifying the cause and providing the initial patch.
r=kengert/rrelyea
This commit is contained in:
kaie%kuix.de 2007-02-16 08:01:40 +00:00
Родитель 8d1cfb80be
Коммит bde739adfa
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -79,6 +79,7 @@
#include "secasn1.h" #include "secasn1.h"
#include "certdb.h" #include "certdb.h"
#include "cert.h" #include "cert.h"
#include "keyhi.h"
//#define DEBUG_SSL_VERBOSE //Enable this define to get minimal //#define DEBUG_SSL_VERBOSE //Enable this define to get minimal
@ -2245,6 +2246,8 @@ SECStatus nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket,
privKey = PK11_FindKeyByAnyCert(node->cert, wincx); privKey = PK11_FindKeyByAnyCert(node->cert, wincx);
if (privKey != NULL) { if (privKey != NULL) {
if (hasExplicitKeyUsageNonRepudiation(node->cert)) { if (hasExplicitKeyUsageNonRepudiation(node->cert)) {
SECKEY_DestroyPrivateKey(privKey);
privKey = NULL;
// Not a prefered cert // Not a prefered cert
if (!low_prio_nonrep_cert) // did not yet find a low prio cert if (!low_prio_nonrep_cert) // did not yet find a low prio cert
low_prio_nonrep_cert = CERT_DupCertificate(node->cert); low_prio_nonrep_cert = CERT_DupCertificate(node->cert);
@ -2267,6 +2270,7 @@ SECStatus nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket,
if (!cert && low_prio_nonrep_cert) { if (!cert && low_prio_nonrep_cert) {
cert = low_prio_nonrep_cert; cert = low_prio_nonrep_cert;
low_prio_nonrep_cert = NULL; // take it away from the cleaner low_prio_nonrep_cert = NULL; // take it away from the cleaner
privKey = PK11_FindKeyByAnyCert(cert, wincx);
} }
if (cert == NULL) { if (cert == NULL) {