diff options
author | Michael Mi <mmi@openoffice.org> | 2004-07-25 06:29:01 +0000 |
---|---|---|
committer | Michael Mi <mmi@openoffice.org> | 2004-07-25 06:29:01 +0000 |
commit | 0bf1fb5a8c6e73fa8959450eced60e323e48b93b (patch) | |
tree | 54a83c47e3f877401c5ae5a5d722ba5a4bdad0e4 /xmlsecurity/source | |
parent | bbba52fc255e702d64f7830fe838eeee3dfa8287 (diff) |
Issue number:
Submitted by: Andrew Fan
Reviewed by:
Fix the buf that NSS cannot initialize twice.
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 2bfcbed12e7c..976a69254aae 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: securityenvironment_nssimpl.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mmi $ $Date: 2004-07-19 11:35:46 $ + * last change: $Author: mmi $ $Date: 2004-07-25 07:29:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -820,7 +820,7 @@ sal_Int32 SecurityEnvironment_NssImpl :: getCertificateCharacters( const ::com:: SECKEYPrivateKey* priKey ; priKey = PK11_FindPrivateKeyFromCert( cert->slot, ( CERTCertificate* )cert, NULL ) ; - if( priKey == NULL || m_pSlot != NULL ) + if( priKey == NULL && m_pSlot != NULL ) priKey = PK11_FindPrivateKeyFromCert( m_pSlot, ( CERTCertificate* )cert, NULL ) ; if( priKey != NULL ) { @@ -833,6 +833,7 @@ sal_Int32 SecurityEnvironment_NssImpl :: getCertificateCharacters( const ::com:: } //Thirdly, make sentence whether or not the cert is trusted. + /* { CERTCertificate* tempCert ; CERTIssuerAndSN issuerAndSN ; @@ -846,16 +847,33 @@ sal_Int32 SecurityEnvironment_NssImpl :: getCertificateCharacters( const ::com:: issuerAndSN.serialNumber.len = cert->serialNumber.len; if( m_pSlot != NULL ) - tempCert = PK11_FindCertByIssuerAndSN( &m_pSlot, &issuerAndSN, NULL ) ; + tempCert = PK11_FindCertByIssuerAndSN( NULL, &issuerAndSN, NULL ) ; else tempCert = NULL ; if( tempCert != NULL ) { - characters |= ::com::sun::star::security::CertificateCharacters::CERT_CHARACTER_TRUSTED ; - CERT_DestroyCertificate( tempCert ) ; - } else { - characters &= ~ ::com::sun::star::security::CertificateCharacters::CERT_CHARACTER_TRUSTED ; - } + characters |= ::com::sun::star::security::CertificateCharacters::CERT_CHARACTER_TRUSTED ; + CERT_DestroyCertificate( tempCert ) ; + } else { + characters &= ~ ::com::sun::star::security::CertificateCharacters::CERT_CHARACTER_TRUSTED ; + } + } + */ + + { + CERTCertificate* tempCert ; + + if( m_pSlot != NULL ) + tempCert = PK11_FindCertFromDERCert( m_pSlot, ( CERTCertificate* )cert, NULL ) ; + else + tempCert = NULL ; + + if( tempCert != NULL ) { + characters |= ::com::sun::star::security::CertificateCharacters::CERT_CHARACTER_TRUSTED ; + CERT_DestroyCertificate( tempCert ) ; + } else { + characters &= ~ ::com::sun::star::security::CertificateCharacters::CERT_CHARACTER_TRUSTED ; + } } return characters ; |