diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-31 14:58:31 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-05 16:43:14 +0100 |
commit | 1dedb15b17a8e8bf04f248809ef48db663034254 (patch) | |
tree | e8fc086787fb7506046b8a7756a24b76e2f4bde3 /xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx | |
parent | Related: fdo#56554 fix multi-script html field export (diff) | |
download | core-1dedb15b17a8e8bf04f248809ef48db663034254.tar.gz core-1dedb15b17a8e8bf04f248809ef48db663034254.zip |
fdo#46808, Adapt xml::crypto::SEInitializer UNO service to new style
Also create an NSSInitializer service IDL and split it's interfaces
out from SEInitializer.
It looks like this was the intention all along, but someone
took a shortcut.
Change-Id: I53ac1cb5d38b78b6718fe22c9666eae1f194a3b7
Diffstat (limited to 'xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 53741dfae3eb..666e3490ba7f 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -39,6 +39,7 @@ #undef DEBUG_WAS_DEFINED #endif +#include <comphelper/processfactory.hxx> #include <sal/types.h> #include <rtl/bootstrap.hxx> #include <rtl/string.hxx> @@ -59,7 +60,6 @@ namespace css = ::com::sun::star; -namespace cssu = css::uno; namespace cssl = css::lang; namespace cssxc = css::xml::crypto; @@ -72,11 +72,9 @@ using ::rtl::OString; #define SECURITY_ENVIRONMENT "com.sun.star.xml.crypto.SecurityEnvironment" #define SECURITY_CONTEXT "com.sun.star.xml.crypto.XMLSecurityContext" - int nProduct = 4; -SEInitializer_NssImpl::SEInitializer_NssImpl( - const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF ) +SEInitializer_NssImpl::SEInitializer_NssImpl( const css::uno::Reference< css::uno::XComponentContext > &rxContext ) { - mxMSF = rxMSF; + m_xContext = rxContext; } SEInitializer_NssImpl::~SEInitializer_NssImpl() @@ -84,13 +82,13 @@ SEInitializer_NssImpl::~SEInitializer_NssImpl() } /* XSEInitializer */ -cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL +uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL SEInitializer_NssImpl::createSecurityContext( const ::rtl::OUString& ) - throw (cssu::RuntimeException) + throw (uno::RuntimeException) { CERTCertDBHandle *pCertHandle = NULL ; - if( !initNSS( mxMSF ) ) + if( !initNSS( m_xContext ) ) return NULL; pCertHandle = CERT_GetDefaultCertDB() ; @@ -99,13 +97,13 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL { /* Build XML Security Context */ const rtl::OUString sSecyrutyContext ( RTL_CONSTASCII_USTRINGPARAM( SECURITY_CONTEXT ) ); - cssu::Reference< cssxc::XXMLSecurityContext > xSecCtx( mxMSF->createInstance ( sSecyrutyContext ), cssu::UNO_QUERY ); + uno::Reference< cssxc::XXMLSecurityContext > xSecCtx( m_xContext->getServiceManager()->createInstanceWithContext(sSecyrutyContext, m_xContext), uno::UNO_QUERY ); if( !xSecCtx.is() ) return NULL; const rtl::OUString sSecyrutyEnvironment ( RTL_CONSTASCII_USTRINGPARAM( SECURITY_ENVIRONMENT ) ); - cssu::Reference< cssxc::XSecurityEnvironment > xSecEnv( mxMSF->createInstance ( sSecyrutyEnvironment ), cssu::UNO_QUERY ); - cssu::Reference< cssl::XUnoTunnel > xEnvTunnel( xSecEnv , cssu::UNO_QUERY ) ; + uno::Reference< cssxc::XSecurityEnvironment > xSecEnv( m_xContext->getServiceManager()->createInstanceWithContext(sSecyrutyEnvironment, m_xContext), uno::UNO_QUERY ); + uno::Reference< cssl::XUnoTunnel > xEnvTunnel( xSecEnv , uno::UNO_QUERY ) ; if( !xEnvTunnel.is() ) return NULL; SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>( @@ -118,7 +116,7 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL xSecCtx->setDefaultSecurityEnvironmentIndex( n ); return xSecCtx; } - catch( cssu::Exception& ) + catch( const uno::Exception& ) { //PK11_LogoutAll(); //NSS_Shutdown(); @@ -126,8 +124,8 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL } } -void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const cssu::Reference< cssxc::XXMLSecurityContext >& ) - throw (cssu::RuntimeException) +void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const uno::Reference< cssxc::XXMLSecurityContext >& ) + throw (uno::RuntimeException) { /* * because the security context will free all its content when it @@ -139,47 +137,47 @@ void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const cssu::Reference< } rtl::OUString SEInitializer_NssImpl_getImplementationName () - throw (cssu::RuntimeException) + throw (uno::RuntimeException) { return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); } sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const rtl::OUString& ServiceName ) - throw (cssu::RuntimeException) + throw (uno::RuntimeException) { return ( ServiceName == SE_SERVICE_NAME || ServiceName == NSS_SERVICE_NAME ); } -cssu::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( ) - throw (cssu::RuntimeException) +uno::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( ) + throw (uno::RuntimeException) { - cssu::Sequence < rtl::OUString > aRet(2); + uno::Sequence < rtl::OUString > aRet(2); rtl::OUString* pArray = aRet.getArray(); pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SE_SERVICE_NAME ) ); pArray[1] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( NSS_SERVICE_NAME ) ); return aRet; } -cssu::Reference< cssu::XInterface > SAL_CALL SEInitializer_NssImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr) - throw( cssu::Exception ) +uno::Reference< uno::XInterface > SAL_CALL SEInitializer_NssImpl_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rxMSF) + throw( uno::Exception ) { - return (cppu::OWeakObject*) new SEInitializer_NssImpl(rSMgr); + return (cppu::OWeakObject*) new SEInitializer_NssImpl(comphelper::getComponentContext(rxMSF)); } /* XServiceInfo */ rtl::OUString SAL_CALL SEInitializer_NssImpl::getImplementationName( ) - throw (cssu::RuntimeException) + throw (uno::RuntimeException) { return SEInitializer_NssImpl_getImplementationName(); } sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const rtl::OUString& rServiceName ) - throw (cssu::RuntimeException) + throw (uno::RuntimeException) { return SEInitializer_NssImpl_supportsService( rServiceName ); } -cssu::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( ) - throw (cssu::RuntimeException) +uno::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( ) + throw (uno::RuntimeException) { return SEInitializer_NssImpl_getSupportedServiceNames(); } |