summaryrefslogtreecommitdiffstats
path: root/desktop/source/offacc/acceptor.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/offacc/acceptor.cxx')
-rw-r--r--desktop/source/offacc/acceptor.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx
index 7697c18b422f..9598466d9c5b 100644
--- a/desktop/source/offacc/acceptor.cxx
+++ b/desktop/source/offacc/acceptor.cxx
@@ -23,9 +23,11 @@
#include <com/sun/star/bridge/BridgeFactory.hpp>
#include <com/sun/star/connection/Acceptor.hpp>
#include <com/sun/star/uno/XNamingService.hpp>
+#include <officecfg/Office/Security.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <o3tl/string_view.hxx>
using namespace css::bridge;
using namespace css::connection;
@@ -62,7 +64,7 @@ Acceptor::~Acceptor()
m_rAcceptor->stopAccepting();
oslThread t;
{
- osl::MutexGuard g(m_aMutex);
+ std::unique_lock g(m_aMutex);
t = m_thread;
}
//prevent locking if the thread is still waiting
@@ -74,7 +76,7 @@ Acceptor::~Acceptor()
// Make the final state of m_bridges visible to this thread (since
// m_thread is joined, the code that follows is the only one left
// accessing m_bridges):
- osl::MutexGuard g(m_aMutex);
+ std::unique_lock g(m_aMutex);
}
for (;;) {
css::uno::Reference< css::bridge::XBridge > b(m_bridges.remove());
@@ -117,7 +119,7 @@ void Acceptor::run()
// the bridge, it will be destructed.
Reference< XBridge > rBridge = m_rBridgeFactory->createBridge(
"", m_aProtocol, rConnection, rInstanceProvider);
- osl::MutexGuard g(m_aMutex);
+ std::unique_lock g(m_aMutex);
m_bridges.add(rBridge);
} catch (const Exception&) {
TOOLS_WARN_EXCEPTION("desktop.offacc", "");
@@ -132,7 +134,7 @@ void Acceptor::run()
void Acceptor::initialize( const Sequence<Any>& aArguments )
{
// prevent multiple initialization
- osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
SAL_INFO( "desktop.offacc", "Acceptor::initialize()" );
bool bOk = false;
@@ -151,7 +153,7 @@ void Acceptor::initialize( const Sequence<Any>& aArguments )
if (nIndex1 < 0)
throw IllegalArgumentException(
"Invalid accept-string format", m_rContext, 1);
- m_aConnectString = m_aAcceptString.copy( 0 , nIndex1 ).trim();
+ m_aConnectString = o3tl::trim(m_aAcceptString.subView( 0 , nIndex1 ));
nIndex1++;
sal_Int32 nIndex2 = m_aAcceptString.indexOf( ';' , nIndex1 );
if (nIndex2 < 0) nIndex2 = m_aAcceptString.getLength();
@@ -239,6 +241,12 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
desktop_Acceptor_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
+ if (!officecfg::Office::Security::Net::AllowInsecureUNORemoteProtocol::get())
+ {
+ // this is not allowed to throw
+ SAL_WARN("desktop", "UNO Remote Protocol is disabled by configuration");
+ return nullptr;
+ }
return cppu::acquire(new desktop::Acceptor(context));
}