summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2018-03-08 16:07:11 +0100
committerAndras Timar <andras.timar@collabora.com>2018-03-09 11:49:46 +0100
commit4547fa2c1e205e1989611b1c4493cbbd12541372 (patch)
tree2b6430fc3524e17c85516bb30602529e91852bb4 /sfx2
parent03300fba21eb5f02ebd7e6a997985d8a3fa500da (diff)
Let sysadmins disable individual file format filters
It makes sense to disable a filter, as a temporary security measure, when there is a 0-day vulnerability in it. E.g., when 0-day found in AbiWord filter, this config snippet disables it: <item oor:path="/org.openoffice.TypeDetection.Filter"> <node oor:name="Filters"> <node oor:name="AbiWord"> <prop oor:name="Enabled" oor:finalized="true"> <value>false</value> </prop> </node> </node> </item> Change-Id: I8b84250c7e4aac3555877d23f58ed13a2210ebfc Reviewed-on: https://gerrit.libreoffice.org/50961 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx10
-rw-r--r--sfx2/source/doc/docfilt.cxx9
-rw-r--r--sfx2/source/doc/objstor.cxx5
3 files changed, 20 insertions, 4 deletions
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 5bbdfed0b7eb..c4eca2d5b0d8 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -920,6 +920,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
OUString sExtension ;
OUString sPattern ;
OUString sServiceName ;
+ bool bEnabled = true ;
// first get directly available properties
sal_Int32 nFilterPropertyCount = lFilterProperties.getLength();
@@ -1014,6 +1015,11 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
}
}
}
+ else if ( lFilterProperties[nFilterProperty].Name == "Enabled" )
+ {
+ lFilterProperties[nFilterProperty].Value >>= bEnabled;
+ }
+
}
if ( sServiceName.isEmpty() )
@@ -1050,7 +1056,8 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
sType ,
sMimeType ,
sUserData ,
- sServiceName ));
+ sServiceName ,
+ bEnabled ));
rList.push_back( pFilter );
}
else
@@ -1064,6 +1071,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
pFilt->aMimeType = sMimeType;
pFilt->aUserData = sUserData;
pFilt->aServiceName = sServiceName;
+ pFilt->mbEnabled = bEnabled;
}
SfxFilter* pFilt = const_cast<SfxFilter*>(pFilter.get());
diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index 0bfefd65a59b..d4bb139993e0 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -43,7 +43,8 @@ SfxFilter::SfxFilter( const OUString& rProvider, const OUString &rFilterName ) :
maProvider(rProvider),
nFormatType(SfxFilterFlags::NONE),
nVersion(0),
- lFormat(SotClipboardFormatId::NONE)
+ lFormat(SotClipboardFormatId::NONE),
+ mbEnabled(true)
{
}
@@ -54,7 +55,8 @@ SfxFilter::SfxFilter( const OUString &rName,
const OUString &rTypNm,
const OUString &rMimeType,
const OUString &rUsrDat,
- const OUString &rServiceName ):
+ const OUString &rServiceName,
+ bool bEnabled ):
aWildCard(rWildCard, ';'),
aTypeName(rTypNm),
aUserData(rUsrDat),
@@ -64,7 +66,8 @@ SfxFilter::SfxFilter( const OUString &rName,
aUIName(maFilterName),
nFormatType(nType),
nVersion(SOFFICE_FILEFORMAT_50),
- lFormat(lFmt)
+ lFormat(lFmt),
+ mbEnabled(bEnabled)
{
OUString aExts = GetWildcard().getGlob();
OUString glob;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 5de8041192d4..feff5dfd91a1 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -646,6 +646,11 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
pImpl->nLoadedFlags = SfxLoadedFlags::NONE;
pImpl->bModelInitialized = false;
+ if (pFilter && !pFilter->IsEnabled())
+ {
+ SetError( ERRCODE_IO_FILTERDISABLED );
+ }
+
// initialize static language table so language-related extensions are learned before the document loads
(void)SvtLanguageTable::GetLanguageEntryCount();