summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorDaniel Boelzle <dbo@openoffice.org>2001-12-14 12:19:51 +0000
committerDaniel Boelzle <dbo@openoffice.org>2001-12-14 12:19:51 +0000
commitb33cf704ef9f340a3c5a68be5115f682148d3086 (patch)
treef76159164645c09d890fcfa9d2f1b617383406a6 /cppuhelper/source
parent31a3fcc0c11f681942c00da311247b8bb6fea753 (diff)
#88919# access control
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/access_control.cxx361
-rw-r--r--cppuhelper/source/component_context.cxx127
-rw-r--r--cppuhelper/source/interfacecontainer.cxx12
-rw-r--r--cppuhelper/source/makefile.mk11
-rw-r--r--cppuhelper/source/servicefactory.cxx15
5 files changed, 478 insertions, 48 deletions
diff --git a/cppuhelper/source/access_control.cxx b/cppuhelper/source/access_control.cxx
new file mode 100644
index 000000000000..3ce67ff060f0
--- /dev/null
+++ b/cppuhelper/source/access_control.cxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * $RCSfile: access_control.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: dbo $ $Date: 2001-12-14 13:19:51 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <osl/diagnose.h>
+#include <osl/interlck.h>
+#include <uno/current_context.h>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/uno/XCurrentContext.hpp>
+#include <com/sun/star/security/XAccessController.hpp>
+
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+#define AC_RESTRICTION "ac-restriction"
+#define AC_SERVICE "com.sun.star.security.AccessController"
+
+
+using namespace ::rtl;
+using namespace ::osl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+namespace cppu
+{
+
+static OUString str_envType = OUSTR(CPPU_CURRENT_LANGUAGE_BINDING_NAME);
+static OUString str_acRestriction = OUSTR(AC_RESTRICTION);
+
+//==================================================================================================
+class acc_Combiner
+ : public WeakImplHelper1< security::XAccessControlContext >
+{
+ Reference< security::XAccessControlContext > m_x1, m_x2;
+
+public:
+ inline acc_Combiner(
+ Reference< security::XAccessControlContext > const & x1,
+ Reference< security::XAccessControlContext > const & x2 )
+ SAL_THROW( () )
+ : m_x1( x1 )
+ , m_x2( x2 )
+ {}
+
+ // XAccessControlContext impl
+ virtual void SAL_CALL checkPermission(
+ security::Permission const & perm )
+ throw (RuntimeException);
+};
+//__________________________________________________________________________________________________
+void acc_Combiner::checkPermission(
+ security::Permission const & perm )
+ throw (RuntimeException)
+{
+ m_x1->checkPermission( perm );
+ m_x2->checkPermission( perm );
+}
+//==================================================================================================
+class acc_CurrentContext
+ : public ImplHelper1< XCurrentContext >
+{
+ oslInterlockedCount m_refcount;
+
+ Reference< XCurrentContext > m_xDelegate;
+ Any m_restriction;
+
+public:
+ inline acc_CurrentContext(
+ Reference< XCurrentContext > const & xDelegate,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ SAL_THROW( () );
+
+ // XInterface impl
+ virtual void SAL_CALL acquire()
+ throw ();
+ virtual void SAL_CALL release()
+ throw ();
+
+ // XCurrentContext
+ virtual Any SAL_CALL getValueByName( OUString const & name )
+ throw (RuntimeException);
+};
+//__________________________________________________________________________________________________
+inline acc_CurrentContext::acc_CurrentContext(
+ Reference< XCurrentContext > const & xDelegate,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ SAL_THROW( () )
+ : m_refcount( 0 )
+ , m_xDelegate( xDelegate )
+{
+ if (xRestriction.is())
+ {
+ m_restriction = makeAny( xRestriction );
+ }
+ // return empty any otherwise on getValueByName(), not null interface
+}
+//__________________________________________________________________________________________________
+void acc_CurrentContext::acquire()
+ throw ()
+{
+ ::osl_incrementInterlockedCount( &m_refcount );
+}
+//__________________________________________________________________________________________________
+void acc_CurrentContext::release()
+ throw ()
+{
+ if (! ::osl_decrementInterlockedCount( &m_refcount ))
+ {
+ delete this;
+ }
+}
+//__________________________________________________________________________________________________
+Any acc_CurrentContext::getValueByName( OUString const & name )
+ throw (RuntimeException)
+{
+ if (name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(AC_RESTRICTION) ))
+ {
+ return m_restriction;
+ }
+ else
+ {
+ return m_xDelegate->getValueByName( name );
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+static inline Reference< security::XAccessControlContext > getCurrentRestriction(
+ Reference< XCurrentContext > const & xContext )
+ SAL_THROW( (RuntimeException) )
+{
+ if (xContext.is())
+ {
+ Any acc( xContext->getValueByName( str_acRestriction ) );
+ if (typelib_TypeClass_INTERFACE == acc.pType->eTypeClass)
+ {
+ OUString const & typeName =
+ * reinterpret_cast< OUString const * >( &acc.pType->pTypeName );
+ if (typeName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.security.XAccessControlContext") ))
+ {
+ return Reference< security::XAccessControlContext >(
+ * reinterpret_cast< security::XAccessControlContext * * const >( acc.pData ) );
+ }
+ else // try to query
+ {
+ return Reference< security::XAccessControlContext >::query(
+ * reinterpret_cast< XInterface * * const >( acc.pData ) );
+ }
+ }
+ }
+ return Reference< security::XAccessControlContext >();
+}
+//==================================================================================================
+Reference< security::XAccessControlContext > SAL_CALL ac_defimpl_getCurrentRestriction()
+ SAL_THROW( () )
+{
+ Reference< XCurrentContext > xContext;
+ ::uno_getCurrentContext( (void **)&xContext, str_envType.pData, 0 );
+ return getCurrentRestriction( xContext );
+}
+//==================================================================================================
+struct __cc_reset
+{
+ void * m_cc;
+ inline __cc_reset( void * cc ) SAL_THROW( () )
+ : m_cc( cc ) {}
+ inline ~__cc_reset() SAL_THROW( () )
+ { ::uno_setCurrentContext( m_cc, str_envType.pData, 0 ); }
+};
+//==================================================================================================
+Any SAL_CALL ac_defimpl_doRestricted(
+ Reference< security::XAction > const & xAction,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ SAL_THROW( (Exception) )
+{
+ if (xRestriction.is())
+ {
+ Reference< XCurrentContext > xOldContext;
+ ::uno_getCurrentContext( (void **)&xOldContext, str_envType.pData, 0 );
+ Reference< security::XAccessControlContext > xOldRestr(
+ getCurrentRestriction( xOldContext ) );
+
+ if (xOldRestr.is())
+ {
+ Reference< XCurrentContext > xNewContext( new acc_CurrentContext(
+ xOldContext, new acc_Combiner( xRestriction, xOldRestr ) ) );
+ ::uno_setCurrentContext( xNewContext.get(), str_envType.pData, 0 );
+ }
+ else
+ {
+ Reference< XCurrentContext > xNewContext( new acc_CurrentContext(
+ xOldContext, xRestriction ) );
+ ::uno_setCurrentContext( xNewContext.get(), str_envType.pData, 0 );
+ }
+
+ __cc_reset reset( xOldContext.get() );
+ return xAction->run();
+ }
+ else
+ {
+ return xAction->run();
+ }
+}
+//==================================================================================================
+Any SAL_CALL ac_defimpl_doPrivileged(
+ Reference< security::XAction > const & xAction,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ SAL_THROW( (Exception) )
+{
+ Reference< XCurrentContext > xOldContext;
+ ::uno_getCurrentContext( (void **)&xOldContext, str_envType.pData, 0 );
+
+ // override AC_RESTRICTION
+ Reference< XCurrentContext > xContext( new acc_CurrentContext(
+ xOldContext, xRestriction ) );
+ ::uno_setCurrentContext( xContext.get(), str_envType.pData, 0 );
+
+ __cc_reset reset( xOldContext.get() );
+ return xAction->run();
+}
+
+
+//##################################################################################################
+//### default service impl #########################################################################
+//##################################################################################################
+
+//==================================================================================================
+class DefaultAccessController
+ : public WeakImplHelper1< security::XAccessController >
+{
+public:
+ // XAccessController impl
+ virtual void SAL_CALL checkPermission(
+ security::Permission const & perm )
+ throw (RuntimeException);
+ virtual Any SAL_CALL doRestricted(
+ Reference< security::XAction > const & xAction,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ throw (Exception);
+ virtual Any SAL_CALL doPrivileged(
+ Reference< security::XAction > const & xAction,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ throw (Exception);
+ virtual Reference< security::XAccessControlContext > SAL_CALL getContext()
+ throw (RuntimeException);
+};
+//__________________________________________________________________________________________________
+void DefaultAccessController::checkPermission(
+ security::Permission const & perm )
+ throw (RuntimeException)
+{
+ // only dynamic checks of ac contexts, no static checks concerning credentials
+ Reference< security::XAccessControlContext > xACC( ac_defimpl_getCurrentRestriction() );
+ if (xACC.is())
+ {
+ xACC->checkPermission( perm );
+ }
+}
+//__________________________________________________________________________________________________
+Any DefaultAccessController::doRestricted(
+ Reference< security::XAction > const & xAction,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ throw (Exception)
+{
+ return ac_defimpl_doRestricted( xAction, xRestriction );
+}
+//__________________________________________________________________________________________________
+Any DefaultAccessController::doPrivileged(
+ Reference< security::XAction > const & xAction,
+ Reference< security::XAccessControlContext > const & xRestriction )
+ throw (Exception)
+{
+ return ac_defimpl_doPrivileged( xAction, xRestriction );
+}
+//__________________________________________________________________________________________________
+Reference< security::XAccessControlContext > DefaultAccessController::getContext()
+ throw (RuntimeException)
+{
+ return ac_defimpl_getCurrentRestriction();
+}
+
+//--------------------------------------------------------------------------------------------------
+static Reference< XInterface > SAL_CALL create_default_ac(
+ Reference< XComponentContext > const & )
+ SAL_THROW( (Exception) )
+{
+ return (OWeakObject *)new DefaultAccessController();
+}
+//=== run on bootstrapping =========================================================================
+Reference< lang::XSingleComponentFactory > createDefaultAccessController()
+ SAL_THROW( () )
+{
+ OUString serviceName( RTL_CONSTASCII_USTRINGPARAM(AC_SERVICE) );
+ return createSingleComponentFactory(
+ create_default_ac,
+ OUSTR("com.sun.star.comp.security.DummyAccessController"),
+ Sequence< OUString >( &serviceName, 1 ) );
+}
+
+}
+
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx
index d7f4d9932e93..863e0f534cc7 100644
--- a/cppuhelper/source/component_context.cxx
+++ b/cppuhelper/source/component_context.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: component_context.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: dbo $ $Date: 2001-10-11 14:40:43 $
+ * last change: $Author: dbo $ $Date: 2001-12-14 13:19:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,7 @@
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/compbase1.hxx>
#include <cppuhelper/component_context.hxx>
+#include <cppuhelper/access_control.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -87,8 +88,8 @@
#include <hash_map>
-#define SMGR_NAME "/singletons/com.sun.star.lang.theServiceManager"
-#define TDMGR_NAME "/singletons/com.sun.star.reflection.theTypeDescriptionManager"
+#define SMGR_SINGLETON "/singletons/com.sun.star.lang.theServiceManager"
+#define TDMGR_SINGLETON "/singletons/com.sun.star.reflection.theTypeDescriptionManager"
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
@@ -107,7 +108,7 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
{
OSL_ASSERT( pVal );
if (pTypeRef->eTypeClass == typelib_TypeClass_VOID)
- return OUString( RTL_CONSTASCII_USTRINGPARAM("void") );
+ return OUSTR("void");
OUStringBuffer buf( 64 );
buf.append( (sal_Unicode)'(' );
@@ -146,11 +147,11 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
for ( sal_Int32 nPos = 0; nPos < nDescr; ++nPos )
{
- buf.append( ppMemberNames[nPos] );
+ buf.append( ppMemberNames[ nPos ] );
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" = ") );
typelib_TypeDescription * pMemberType = 0;
- TYPELIB_DANGER_GET( &pMemberType, ppTypeRefs[nPos] );
- buf.append( val2str( (char *)pVal + pMemberOffsets[nPos], pMemberType->pWeakRef ) );
+ TYPELIB_DANGER_GET( &pMemberType, ppTypeRefs[ nPos ] );
+ buf.append( val2str( (char *)pVal + pMemberOffsets[ nPos ], pMemberType->pWeakRef ) );
TYPELIB_DANGER_RELEASE( pMemberType );
if (nPos < (nDescr -1))
buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") );
@@ -219,11 +220,11 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
sal_Int32 nPos = ((typelib_EnumTypeDescription *)pTypeDescr)->nEnumValues;
while (nPos--)
{
- if (pValues[nPos] == *(int *)pVal)
+ if (pValues[ nPos ] == *(sal_Int32 *)pVal)
break;
}
if (nPos >= 0)
- buf.append( ((typelib_EnumTypeDescription *)pTypeDescr)->ppEnumNames[nPos] );
+ buf.append( ((typelib_EnumTypeDescription *)pTypeDescr)->ppEnumNames[ nPos ] );
else
buf.append( (sal_Unicode)'?' );
@@ -316,22 +317,38 @@ static inline void __dispose( Reference< XInterface > const & xInstance )
}
//==================================================================================================
-class Disposer_Impl
+class DisposingForwarder
: public WeakImplHelper1< lang::XEventListener >
{
Reference< lang::XComponent > m_xTarget;
-public:
- inline Disposer_Impl( Reference< lang::XComponent > const & xTarget )
+ inline DisposingForwarder( Reference< lang::XComponent > const & xTarget )
SAL_THROW( () )
: m_xTarget( xTarget )
{ OSL_ASSERT( m_xTarget.is() ); }
+public:
+ // listens at source for disposing, then disposes target
+ static inline void listen(
+ Reference< lang::XComponent > const & xSource,
+ Reference< lang::XComponent > const & xTarget )
+ SAL_THROW( (RuntimeException) );
virtual void SAL_CALL disposing( lang::EventObject const & rSource )
throw (RuntimeException);
};
//__________________________________________________________________________________________________
-void Disposer_Impl::disposing( lang::EventObject const & rSource )
+inline void DisposingForwarder::listen(
+ Reference< lang::XComponent > const & xSource,
+ Reference< lang::XComponent > const & xTarget )
+ SAL_THROW( (RuntimeException) )
+{
+ if (xSource.is())
+ {
+ xSource->addEventListener( new DisposingForwarder( xTarget ) );
+ }
+}
+//__________________________________________________________________________________________________
+void DisposingForwarder::disposing( lang::EventObject const & rSource )
throw (RuntimeException)
{
m_xTarget->dispose();
@@ -584,7 +601,7 @@ void ComponentContext::disposing()
::fprintf( stderr, "> disposing context %p\n", this );
#endif
- Reference< lang::XComponent > xTDMgr; // to be disposed separately
+ Reference< lang::XComponent > xTDMgr, xAC; // to be disposed separately
// first dispose all context objects
t_map::const_iterator iPos( m_map.begin() );
@@ -593,7 +610,8 @@ void ComponentContext::disposing()
ContextEntry * pEntry = iPos->second;
// service manager disposed separately
- if (!m_xSMgr.is() || !iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_NAME) ))
+ if (!m_xSMgr.is() ||
+ !iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_SINGLETON) ))
{
Reference< lang::XComponent > xComp;
@@ -612,11 +630,16 @@ void ComponentContext::disposing()
if (xComp.is())
{
- if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(TDMGR_NAME) ))
+ if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(TDMGR_SINGLETON) ))
{
// disposed separately
xTDMgr = xComp;
}
+ else if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(AC_SINGLETON) ))
+ {
+ // disposed separately
+ xAC = xComp;
+ }
else
{
xComp->dispose();
@@ -631,6 +654,12 @@ void ComponentContext::disposing()
__dispose( m_xSMgr );
}
+ // third dispose of ac
+ if (xAC.is())
+ {
+ xAC->dispose();
+ }
+
// last dispose of tdmgr: revoke callback from cppu runtime
if (xTDMgr.is())
{
@@ -657,7 +686,7 @@ ComponentContext::ComponentContext(
{
ContextEntry_Init const & rEntry = pEntries[ nEntries ];
- if (rEntry.name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_NAME) ))
+ if (rEntry.name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_SINGLETON) ))
{
rEntry.value >>= m_xSMgr;
}
@@ -679,19 +708,10 @@ ComponentContext::ComponentContext(
m_bDisposeSMgr = (m_xSMgr.is() != sal_False);
- if (m_xDelegate.is())
+ if (m_xDelegate.is() && !m_xSMgr.is())
{
- Reference< lang::XComponent > xComp( m_xDelegate, UNO_QUERY );
- OSL_ENSURE( xComp.is(), "### component context should export lang::XComponent!" );
- if (xComp.is())
- {
- xComp->addEventListener( new Disposer_Impl( this ) );
- }
- if (! m_xSMgr.is())
- {
- m_xSMgr = m_xDelegate->getServiceManager();
- m_bDisposeSMgr = false;
- }
+ m_xSMgr = m_xDelegate->getServiceManager();
+ m_bDisposeSMgr = false;
}
}
@@ -886,10 +906,13 @@ Any ConfigurationComponentContext::getValueByName( OUString const & rName )
::fprintf( stderr, ">>> dumping out ConfigurationComponentContext %p m_singletons:\n", this );
typedef ::std::map< OUString, Any > t_sorted; // sorted map
t_sorted sorted;
+ {
+ MutexGuard guard( m_mutex );
for ( t_singletons::const_iterator iPos( m_singletons.begin() ); iPos != m_singletons.end(); ++iPos )
{
sorted[ iPos->first ] = makeAny( iPos->second );
}
+ }
{
for ( t_sorted::const_iterator iPos( sorted.begin() ); iPos != sorted.end(); ++iPos )
{
@@ -928,13 +951,15 @@ Any ConfigurationComponentContext::getValueByName( OUString const & rName )
t_singletons::const_iterator const iFind( m_singletons.find( rName ) );
if (iFind == m_singletons.end())
{
- m_singletons[ rName ] = xInstance;
+ ::std::pair< t_singletons::iterator, bool > insertion(
+ m_singletons.insert( t_singletons::value_type( rName, xInstance ) ) );
+ OSL_ENSURE( insertion.second, "### inserting new singleton failed?!" );
return makeAny( xInstance );
}
else // inited in the meantime
{
guard.clear();
- // => try to dispose this object
+ // => try to dispose created object
__dispose( xInstance );
return makeAny( iFind->second );
}
@@ -978,14 +1003,37 @@ void ConfigurationComponentContext::disposing()
::fprintf( stderr, "> disposing cfg context %p\n", this );
#endif
+ Reference< XInterface > xSMgr, xTDMgr, xAC;
+
// first dispose all context objects
t_singletons::const_iterator iPos( m_singletons.begin() );
for ( ; iPos != m_singletons.end(); ++iPos )
{
- __dispose( iPos->second );
+ // to be disposed separately
+ if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_SINGLETON) ))
+ {
+ xSMgr = iPos->second;
+ }
+ else if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(TDMGR_SINGLETON) ))
+ {
+ xTDMgr = iPos->second;
+ }
+ else if (iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(AC_SINGLETON) ))
+ {
+ xAC = iPos->second;
+ }
+
+ else
+ {
+ __dispose( iPos->second );
+ }
}
m_singletons.clear();
+ __dispose( xSMgr );
+ __dispose( xAC );
+ __dispose( xTDMgr );
+
// dispose context values map
ComponentContext::disposing();
}
@@ -996,7 +1044,12 @@ Reference< XComponentContext > SAL_CALL createInitialCfgComponentContext(
Reference< XComponentContext > const & xDelegate )
SAL_THROW( () )
{
- return new ConfigurationComponentContext( pEntries, nEntries, xDelegate );
+ ConfigurationComponentContext * p = new ConfigurationComponentContext(
+ pEntries, nEntries, xDelegate );
+ Reference< XComponentContext > xContext( p );
+ // listen delegate for disposing, to dispose this (wrapping) context first.
+ DisposingForwarder::listen( Reference< lang::XComponent >::query( xDelegate ), p );
+ return xContext;
}
//##################################################################################################
@@ -1007,7 +1060,11 @@ Reference< XComponentContext > SAL_CALL createComponentContext(
{
if (nEntries > 0)
{
- return new ComponentContext( pEntries, nEntries, xDelegate );
+ ComponentContext * p = new ComponentContext( pEntries, nEntries, xDelegate );
+ Reference< XComponentContext > xContext( p );
+ // listen delegate for disposing, to dispose this (wrapping) context first.
+ DisposingForwarder::listen( Reference< lang::XComponent >::query( xDelegate ), p );
+ return xContext;
}
else
{
diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
index d6cbb1aa0f06..276e64fb215b 100644
--- a/cppuhelper/source/interfacecontainer.cxx
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: interfacecontainer.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: dbo $ $Date: 2001-06-07 11:11:29 $
+ * last change: $Author: dbo $ $Date: 2001-12-14 13:19:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -458,9 +458,9 @@ Sequence< Type > OMultiTypeInterfaceContainerHelper::getContainedTypes() const
if( ((OInterfaceContainerHelper*)(*iter).second)->getLength() )
// yes, put the type in the array
pArray[i++] = (*iter).first;
- iter++;
+ ++iter;
}
- if( i != nSize ) {
+ if( (t_type2ptr::size_type)i != nSize ) {
// may be empty container, reduce the sequence to the right size
aInterfaceTypes = ::com::sun::star::uno::Sequence< Type >( pArray, i );
}
@@ -614,9 +614,9 @@ Sequence< sal_Int32 > OMultiTypeInterfaceContainerHelperInt32::getContainedTypes
if( ((OInterfaceContainerHelper*)(*iter).second)->getLength() )
// yes, put the type in the array
pArray[i++] = (*iter).first;
- iter++;
+ ++iter;
}
- if( i != nSize ) {
+ if( (t_long2ptr::size_type)i != nSize ) {
// may be empty container, reduce the sequence to the right size
aInterfaceTypes = ::com::sun::star::uno::Sequence< sal_Int32 >( pArray, i );
}
diff --git a/cppuhelper/source/makefile.mk b/cppuhelper/source/makefile.mk
index d7bc70faafb9..0c1b4cf117bd 100644
--- a/cppuhelper/source/makefile.mk
+++ b/cppuhelper/source/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.20 $
+# $Revision: 1.21 $
#
-# last change: $Author: hr $ $Date: 2001-11-14 13:17:37 $
+# last change: $Author: dbo $ $Date: 2001-12-14 13:19:51 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -88,7 +88,8 @@ UNOTYPES= \
com.sun.star.uno.XWeak \
com.sun.star.uno.XAggregation \
com.sun.star.uno.XComponentContext \
- com.sun.star.uno.XUnloadingPreference \
+ com.sun.star.uno.XUnloadingPreference \
+ com.sun.star.uno.XCurrentContext \
com.sun.star.lang.XMultiServiceFactory \
com.sun.star.lang.XSingleServiceFactory \
com.sun.star.lang.XMultiComponentFactory \
@@ -96,6 +97,7 @@ UNOTYPES= \
com.sun.star.lang.XServiceInfo \
com.sun.star.lang.XInitialization \
com.sun.star.lang.XEventListener \
+ com.sun.star.security.XAccessController \
com.sun.star.reflection.XIdlReflection \
com.sun.star.reflection.XIdlClass \
com.sun.star.reflection.XIdlClassProvider \
@@ -144,7 +146,8 @@ SLOFILES= \
$(SLO)$/component.obj \
$(SLO)$/shlib.obj \
$(SLO)$/tdmgr.obj \
- $(SLO)$/implementationentry.obj
+ $(SLO)$/implementationentry.obj \
+ $(SLO)$/access_control.obj
SHL1TARGET=$(TARGET)$(UDK_MAJOR)$(COMID)
diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx
index 1ea1c97bfe19..352679b70db7 100644
--- a/cppuhelper/source/servicefactory.cxx
+++ b/cppuhelper/source/servicefactory.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: servicefactory.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: dbo $ $Date: 2001-10-11 14:40:43 $
+ * last change: $Author: dbo $ $Date: 2001-12-14 13:19:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -117,6 +117,9 @@ void addFactories(
Reference< lang::XMultiComponentFactory > const & xMgr,
Reference< registry::XRegistryKey > const & xKey )
SAL_THROW( (Exception) );
+//--------------------------------------------------------------------------------------------------
+Reference< lang::XSingleComponentFactory > createDefaultAccessController()
+ SAL_THROW( () );
//==================================================================================================
static Reference< XInterface > SAL_CALL createInstance(
@@ -227,7 +230,7 @@ Reference< XComponentContext > bootstrapInitialContext(
// basic context values
ContextEntry_Init entry;
::std::vector< ContextEntry_Init > context_values;
- context_values.reserve( 5 );
+ context_values.reserve( 6 );
// read out singleton infos from registry
if (services_xRegistry.is())
@@ -276,6 +279,12 @@ Reference< XComponentContext > bootstrapInitialContext(
entry.value <<= xSF;
context_values.push_back( entry );
+ // ac
+ entry.bLateInitService = true;
+ entry.name = OUSTR("/singletons/com.sun.star.security.theAccessController");
+ entry.value <<= createDefaultAccessController();
+ context_values.push_back( entry );
+
// tdmgr
entry.bLateInitService = true;
entry.name = OUSTR("/singletons/com.sun.star.reflection.theTypeDescriptionManager");