diff options
author | Tobias Krause <tkr@openoffice.org> | 2011-02-14 11:58:31 +0100 |
---|---|---|
committer | Tobias Krause <tkr@openoffice.org> | 2011-02-14 11:58:31 +0100 |
commit | bd9e36ca495160994d9f2cd786b3abc44c3859a1 (patch) | |
tree | a46a326d64cf8e1aa9cd8513f03775659e828d5a /xmlsecurity/source | |
parent | tkr38: fixed broken error text print out if nss init fails (PR_GetErrorText d... (diff) | |
download | core-bd9e36ca495160994d9f2cd786b3abc44c3859a1.tar.gz core-bd9e36ca495160994d9f2cd786b3abc44c3859a1.zip |
tkr38: #i112307# fix nss test run and clean up sources
Diffstat (limited to 'xmlsecurity/source')
4 files changed, 21 insertions, 36 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx index bebc933701b7..d16fee4dd289 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx @@ -114,12 +114,6 @@ sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno: case CERT_ALT_NAME_DIRECTORY_NAME : { arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME; - - Sequence< sal_Int8 > directoryName( pEntry->DirectoryName.cbData ) ; - for( unsigned int n = 0; n < pEntry->DirectoryName.cbData ; n++ ) - directoryName[n] = *( pEntry->DirectoryName.pbData + n ) ; - - arrCertAltNameEntry[i].Value <<= directoryName; break; } case CERT_ALT_NAME_URL : diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx index 14b01b69864d..2c66321121db 100644 --- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx @@ -93,20 +93,6 @@ namespace { return length; } - static SECStatus DestroyGeneralName(CERTGeneralName *name) - { - CERTGeneralName *first; - CERTGeneralName *next = NULL; - - first = name; - do { - next = CERT_GetNextGeneralName(name); - PORT_Free(name); - name = next; - } while (name != first); - return SECSuccess; - - } } //Methods from XSanExtension @@ -160,23 +146,16 @@ namespace { case certX400Address: { // unsupported arrCertAltNameEntry[i].Type = ExtAltNameType_X400_ADDRESS; - arrCertAltNameEntry[i].value <<= Any.VOID; break; } case certDirectoryName: { + // unsupported arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME; - - char * directoryName = CERT_NameToAscii(¤t->name.directoryName); - - arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(directoryName); - - PORT_Free(directoryName); break; } case certEDIPartyName: { // unsupported arrCertAltNameEntry[i].Type = ExtAltNameType_EDI_PARTY_NAME; - arrCertAltNameEntry[i].Value <<= Any.VOID; break; } case certURI: @@ -195,13 +174,13 @@ namespace { } case certRegisterID: arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID; - arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(CERT_GetOidString(¤t->name.other)); - break; - } - // break; - + rtl::OString nssOid = ::rtl::OString(CERT_GetOidString(¤t->name.other)); + rtl::OString unoOid = removeOIDFromString(nssOid); + arrCertAltNameEntry[i].Value <<= rtl::OStringToOUString( unoOid, RTL_TEXTENCODING_ASCII_US ); + break; + } current = CERT_GetNextGeneralName(current); } @@ -217,6 +196,17 @@ namespace { return m_Entries; } +::rtl::OString SanExtensionImpl :: removeOIDFromString( const ::rtl::OString &oidString) + { + ::rtl::OString objID; + ::rtl::OString oid("OID."); + if (oidString.match(oid)) + objID = oidString.copy(oid.getLength()); + else + objID = oidString; + return objID; + + } //Helper method void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) { m_critical = critical ; diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx index 153185c38c6a..88425aa8d125 100644 --- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx @@ -46,9 +46,10 @@ class SanExtensionImpl : public ::cppu::WeakImplHelper1< sal_Bool m_critical ; ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ; ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ; - ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries; + ::rtl::OString removeOIDFromString( const ::rtl::OString &oid); + public : SanExtensionImpl() ; virtual ~SanExtensionImpl() ; diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index a9fb57c39769..c8a612fae7e0 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -217,7 +217,7 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s else objID = oidString; - if ( objId.equals("2.5.29.17") ) + if ( objID.equals("2.5.29.17") ) pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ; else pExtn = new CertificateExtension_XmlSecImpl() ; @@ -226,7 +226,7 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s crit = sal_False ; else crit = ( (*extns)->critical.data[0] == 0xFF ) ? sal_True : sal_False ; - pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objId.getStr(), objId.getLength(), crit ) ; + pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objID.getStr(), objID.getLength(), crit ) ; xExtns[len] = pExtn ; } |