diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-12 22:01:06 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-13 08:39:18 +0200 |
commit | 08ac81ccb5ef2397c0073f186fcf5bb2cc528b83 (patch) | |
tree | 7c853b207a883270473df62b0b1fa7d0a2a589bb /xmlsecurity/source | |
parent | ca2fd526160b8f69524cdcf8c57f814b0ad48029 (diff) |
xmlsecurity nss: create SEInitializer instances with a constructor
And split NSSInitializer and SEInitializer into two implementations,
they are not the same on Windows, so it simplifies things if they're
also split on other platforms.
Change-Id: Ifc0ea7e35e804232ee492b7eea9c25662c9b499e
Reviewed-on: https://gerrit.libreoffice.org/52801
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx | 54 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx | 10 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/xsec_nss.cxx | 10 |
3 files changed, 38 insertions, 36 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 19e92fc2113b..58fa45acf4b6 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -108,37 +108,57 @@ void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const uno::Reference< //NSS_Shutdown(); } -OUString SEInitializer_NssImpl_getImplementationName () +/* XServiceInfo */ +OUString SAL_CALL SEInitializer_NssImpl::getImplementationName( ) +{ + return OUString("com.sun.star.xml.crypto.SEInitializer"); +} +sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const OUString& rServiceName ) +{ + return cppu::supportsService( this, rServiceName ); +} +uno::Sequence< OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( ) { - return OUString ("com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl" ); + uno::Sequence<OUString> seqServiceNames{ "com.sun.star.xml.crypto.SEInitializer" }; + return seqServiceNames; } -uno::Sequence< OUString > SEInitializer_NssImpl_getSupportedServiceNames( ) +class NSSInitializer_NssImpl : public SEInitializer_NssImpl +{ +public: + explicit NSSInitializer_NssImpl(const uno::Reference<uno::XComponentContext>& xContext); + OUString SAL_CALL getImplementationName() override; + uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + +NSSInitializer_NssImpl::NSSInitializer_NssImpl(const uno::Reference<uno::XComponentContext>& xContext) + : SEInitializer_NssImpl(xContext) { - uno::Sequence < OUString > aRet(2); - OUString* pArray = aRet.getArray(); - pArray[0] = "com.sun.star.xml.crypto.SEInitializer"; - pArray[1] = NSS_SERVICE_NAME; - return aRet; } -uno::Reference< uno::XInterface > SEInitializer_NssImpl_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rxMSF) +OUString NSSInitializer_NssImpl::getImplementationName() { - return static_cast<cppu::OWeakObject*>(new SEInitializer_NssImpl(comphelper::getComponentContext(rxMSF))); + return OUString("com.sun.star.xml.crypto.NSSInitializer"); } -/* XServiceInfo */ -OUString SAL_CALL SEInitializer_NssImpl::getImplementationName( ) +uno::Sequence<OUString> SAL_CALL NSSInitializer_NssImpl::getSupportedServiceNames() { - return SEInitializer_NssImpl_getImplementationName(); + uno::Sequence<OUString> seqServiceNames{ "com.sun.star.xml.crypto.NSSInitializer" }; + return seqServiceNames; } -sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const OUString& rServiceName ) + +extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* +com_sun_star_xml_crypto_NSSInitializer_get_implementation( + uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) { - return cppu::supportsService( this, rServiceName ); + return cppu::acquire(new NSSInitializer_NssImpl(pCtx)); } -uno::Sequence< OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( ) + +extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* +com_sun_star_xml_crypto_SEInitializer_get_implementation( + uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) { - return SEInitializer_NssImpl_getSupportedServiceNames(); + return cppu::acquire(new SEInitializer_NssImpl(pCtx)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx index 03485e199408..7eda9a259677 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx @@ -54,16 +54,6 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; -/// @throws css::uno::RuntimeException -OUString SEInitializer_NssImpl_getImplementationName(); - -/// @throws css::uno::RuntimeException -css::uno::Sequence< OUString > SEInitializer_NssImpl_getSupportedServiceNames( ); - -/// @throws css::uno::Exception -css::uno::Reference< css::uno::XInterface > -SEInitializer_NssImpl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rxMSF); - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx index db23623aada9..5fa73e2abd3e 100644 --- a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx +++ b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx @@ -42,15 +42,7 @@ void* nss_component_getFactory( const sal_Char* pImplName , void* pServiceManage if( pImplName != nullptr && pServiceManager != nullptr ) { -#ifdef XMLSEC_CRYPTO_NSS - if( SEInitializer_NssImpl_getImplementationName().equalsAscii( pImplName ) ) - { - xFactory.set( createSingleFactory( - static_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) ); - } -#else +#ifndef XMLSEC_CRYPTO_NSS if( ONSSInitializer_getImplementationName().equalsAscii( pImplName ) ) { xFactory.set( createSingleFactory( |