summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/app/app.cxx13
-rw-r--r--fpicker/source/office/iodlg.cxx25
-rw-r--r--fpicker/source/office/iodlg.hxx17
-rw-r--r--fpicker/source/office/iodlgimp.cxx32
-rw-r--r--include/svl/folderrestriction.hxx47
-rw-r--r--include/svl/restrictedpaths.hxx75
-rw-r--r--include/svl/urlfilter.hxx12
-rw-r--r--include/svtools/fileview.hxx3
-rw-r--r--include/svtools/inettbc.hxx2
-rw-r--r--sfx2/source/inet/inettbc.cxx1
-rw-r--r--svl/Library_svl.mk2
-rw-r--r--svl/source/misc/folderrestriction.cxx98
-rw-r--r--svl/source/misc/restrictedpaths.cxx204
-rw-r--r--svtools/inc/pch/precompiled_svt.hxx1
-rw-r--r--svtools/source/contnr/contentenumeration.cxx11
-rw-r--r--svtools/source/contnr/contentenumeration.hxx4
-rw-r--r--svtools/source/contnr/fileview.cxx12
-rw-r--r--svtools/source/contnr/templwin.cxx10
-rw-r--r--svtools/source/contnr/templwin.hxx3
-rw-r--r--svtools/source/control/inettbc.cxx17
20 files changed, 20 insertions, 569 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 2f0ecf6993cb..e9437fe5fbd8 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -85,7 +85,6 @@
#include <unotools/pathoptions.hxx>
#include <svtools/miscopt.hxx>
#include <svtools/menuoptions.hxx>
-#include <svl/folderrestriction.hxx>
#include <rtl/logfile.hxx>
#include <rtl/bootstrap.hxx>
#include <vcl/help.hxx>
@@ -1517,18 +1516,6 @@ int Desktop::Main()
SetSplashScreenProgress(40);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create SvtPathOptions and SvtLanguageOptions" );
- // Check special env variable
- std::vector< String > aUnrestrictedFolders;
- svt::getUnrestrictedFolders( aUnrestrictedFolders );
-
- if ( !aUnrestrictedFolders.empty() )
- {
- // Set different working directory. The first entry is
- // the new work path.
- String aWorkPath = aUnrestrictedFolders[0];
- SvtPathOptions().SetWorkPath( aWorkPath );
- }
-
xDesktop = css::frame::Desktop::create( xContext );
// create service for loadin SFX (still needed in startup)
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 6787f8da947b..1ed7a8c6db89 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -508,7 +508,6 @@ void SvtFileDialog::Init_Impl
_pImp->_pFtFileName = new FixedText( this, SvtResId( FT_EXPLORERFILE_FILENAME ) );
SvtURLBox* pURLBox = new SvtURLBox( this, SvtResId( ED_EXPLORERFILE_FILENAME ) );
- pURLBox->SetUrlFilter( &m_aURLFilter );
_pImp->_pEdFileName = pURLBox;
_pImp->_pEdFileName->Show();
pURLBox->SetSelectHdl( LINK( this, SvtFileDialog, EntrySelectHdl_Impl ) );
@@ -545,7 +544,6 @@ void SvtFileDialog::Init_Impl
}
_pImp->_pEdCurrentPath = new SvtURLBox( this, SvtResId(ED_EXPLORERFILE_CURRENTPATH) );
- _pImp->_pEdCurrentPath->SetUrlFilter( &m_aURLFilter );
_pImp->_pEdCurrentPath->Show();
_pImp->_pBtnFileOpen = new PushButton( this, SvtResId( BTN_EXPLORERFILE_OPEN ) );
@@ -568,7 +566,6 @@ void SvtFileDialog::Init_Impl
_pFileView = new SvtFileView( this, SvtResId( CTL_EXPLORERFILE_FILELIST ),
FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType,
_pImp->_bMultiSelection );
- _pFileView->SetUrlFilter( &m_aURLFilter );
_pFileView->EnableAutoResize();
_pFileView->SetHelpId( HID_FILEDLG_STANDARD );
@@ -1141,12 +1138,6 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
{
if ( aFileName != pThis->_pFileView->GetViewURL() )
{
- if ( !pThis->m_aURLFilter.isUrlAllowed( aFileName ) )
- {
- pThis->simulateAccessDenied( aFileName );
- return 0;
- }
-
pThis->OpenURL_Impl( aFileName );
}
else
@@ -1178,13 +1169,6 @@ IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
return 0;
}
- // if restrictions for the allowed folders are in place, we need to do a check here
- if ( !pThis->m_aURLFilter.isUrlAllowed( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- pThis->simulateAccessDenied( aFileName );
- return 0;
- }
-
switch ( pThis->_pImp->_eMode )
{
case FILEDLG_MODE_SAVE:
@@ -1669,7 +1653,7 @@ IMPL_LINK( SvtFileDialog, OpenDoneHdl_Impl, SvtFileView*, pView )
{
String sCurrentFolder( pView->GetViewURL() );
// check if we can create new folders
- EnableControl( _pImp->_pBtnNewFolder, ContentCanMakeFolder( sCurrentFolder ) && m_aURLFilter.isUrlAllowed( sCurrentFolder, false ) );
+ EnableControl( _pImp->_pBtnNewFolder, ContentCanMakeFolder( sCurrentFolder ) );
// check if we can travel one level up
bool bCanTravelUp = ContentHasParentFolder( pView->GetViewURL() );
@@ -1681,7 +1665,6 @@ IMPL_LINK( SvtFileDialog, OpenDoneHdl_Impl, SvtFileView*, pView )
"SvtFileDialog::OpenDoneHdl_Impl: invalid current URL!" );
aCurrentFolder.removeSegment();
- bCanTravelUp &= m_aURLFilter.isUrlAllowed( aCurrentFolder.GetMainURL( INetURLObject::NO_DECODE ) );
}
EnableControl( _pImp->_pBtnUp, bCanTravelUp );
@@ -2131,11 +2114,6 @@ short SvtFileDialog::PrepareExecute()
// - finally we're going to save that file, aren't we?
m_aContent.enableOwnInteractionHandler(::svt::OFilePickerInteractionHandler::E_DOESNOTEXIST);
- //.....................................................................
- // care for possible restrictions on the paths we're allowed to show
- if ( !m_aURLFilter.isUrlAllowed( _aPath ) )
- _aPath = m_aURLFilter.getFilter()[0];
-
// if applicable show filter
_pImp->InitFilterList();
@@ -2327,7 +2305,6 @@ void SvtFileDialog::OpenURL_Impl( const String& _rURL )
{
_pFileView->EndInplaceEditing( false );
- DBG_ASSERT( m_aURLFilter.isUrlAllowed( _rURL ), "SvtFileDialog::OpenURL_Impl: forbidden URL! Should have been handled by the caller!" );
executeAsync( AsyncPickerAction::eOpenURL, _rURL, getMostCurrentFilter( _pImp ) );
}
diff --git a/fpicker/source/office/iodlg.hxx b/fpicker/source/office/iodlg.hxx
index 21a2afd27ee7..208517a7b196 100644
--- a/fpicker/source/office/iodlg.hxx
+++ b/fpicker/source/office/iodlg.hxx
@@ -34,8 +34,6 @@
#include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
#include <unotools/confignode.hxx>
#include "svl/inettype.hxx"
-#include "svl/urlfilter.hxx"
-#include <svl/restrictedpaths.hxx>
#include "asyncfilepicker.hxx"
#include "OfficeControlAccess.hxx"
#include "fpsmartcontent.hxx"
@@ -105,7 +103,6 @@ private:
ImageList m_aImages;
::svt::SmartContent m_aContent;
- ::svt::RestrictedPaths m_aURLFilter;
::std::set< Control* > m_aDisabledControls;
::utl::OConfigurationNode m_aConfiguration;
@@ -262,10 +259,6 @@ public:
void RemovablePlaceSelected(bool enable = true);
void displayIOException( const String& _rURL, ::com::sun::star::ucb::IOErrorCode _eCode );
- void simulateAccessDenied( const String& _rURL )
- {
- displayIOException( _rURL, ::com::sun::star::ucb::IOErrorCode_ACCESS_DENIED );
- }
// originally from VclFileDialog
virtual sal_Bool AddControl( Window* pControl, sal_Bool bNewLine = sal_False );
@@ -298,16 +291,6 @@ public:
*/
void updateListboxLabelSizes();
- /** checks URL access permissions
-
- <p>with the "restriction" feature we have in the file dialog, it's possible that
- only certain URLs can be browsed. This method checks whether a given URL belongs
- to this set of permitted URLs.</p>
-
- <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p>
- */
- inline bool isUrlAllowed( const String& _rURL ) const { return m_aURLFilter.isUrlAllowed( _rURL ); }
-
private:
SvtFileDialogFilter_Impl* implAddFilter( const String& _rFilter, const String& _rType );
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 7848df7f9970..310f5013de92 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -182,26 +182,22 @@ void SvtUpButton_Impl::FillURLMenu( PopupMenu* _pMenu )
aObject.removeSegment();
String aParentURL(aObject.GetMainURL(INetURLObject::NO_DECODE));
- if (GetDialogParent()->isUrlAllowed(aParentURL))
+ String aTitle;
+ // 97148# --------------------------------
+ if (!GetDialogParent()->ContentGetTitle(aParentURL, aTitle) || aTitle.Len() == 0)
+ aTitle = aObject.getName();
+
+ Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
+ ? SvFileInformationManager::GetImage( aObject ) : aVolumeImage;
+
+ _pMenu->InsertItem( nItemId++, aTitle, aImage );
+ _aURLs.push_back(aParentURL);
+
+ if ( nCount == 1 )
{
- String aTitle;
- // 97148# --------------------------------
- if (!GetDialogParent()->ContentGetTitle(aParentURL, aTitle) || aTitle.Len() == 0)
- aTitle = aObject.getName();
-
- Image aImage = ( nCount > 1 ) // if nCount == 1 means workplace, which detects the wrong image
- ? SvFileInformationManager::GetImage( aObject ) : aVolumeImage;
-
- _pMenu->InsertItem( nItemId++, aTitle, aImage );
- _aURLs.push_back(aParentURL);
-
- if ( nCount == 1 )
- {
- // adjust the title of the top level entry (the workspace)
- _pMenu->SetItemText( --nItemId, SvtSimpleResId( STR_SVT_MIMETYPE_CNT_FSYSBOX ) );
- }
+ // adjust the title of the top level entry (the workspace)
+ _pMenu->SetItemText( --nItemId, SvtSimpleResId( STR_SVT_MIMETYPE_CNT_FSYSBOX ) );
}
-
--nCount;
}
}
diff --git a/include/svl/folderrestriction.hxx b/include/svl/folderrestriction.hxx
deleted file mode 100644
index 4ddb9d4be7bc..000000000000
--- a/include/svl/folderrestriction.hxx
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SVTOOLS_FOLDER_RESTRICTION_HXX
-#define SVTOOLS_FOLDER_RESTRICTION_HXX
-
-#include "svl/svldllapi.h"
-#include <tools/string.hxx>
-
-#include <vector>
-
-//........................................................................
-namespace svt
-{
-//........................................................................
-
- /** retrieves a list of folders which's access is not restricted.
-
- <p>Note that this is not meant as security feature, but only as
- method to restrict some UI presentation, such as browsing
- in the file open dialog.</p>
- */
- SVL_DLLPUBLIC void getUnrestrictedFolders( ::std::vector< String >& _rFolders );
-
-//........................................................................
-} // namespace svt
-//........................................................................
-
-#endif // SVTOOLS_FOLDER_RESTRICTION_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/restrictedpaths.hxx b/include/svl/restrictedpaths.hxx
deleted file mode 100644
index 85326a569654..000000000000
--- a/include/svl/restrictedpaths.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SVTOOLS_RESTRICTEDPATHS_HXX
-#define SVTOOLS_RESTRICTEDPATHS_HXX
-
-#include <svl/urlfilter.hxx>
-#include <svl/svldllapi.h>
-
-#include <vector>
-
-namespace svt
-{
- class SVL_DLLPUBLIC RestrictedPaths : public IUrlFilter
- {
- private:
- ::std::vector< OUString > m_aUnrestrictedURLs;
- bool m_bFilterIsEnabled;
-
- public:
- RestrictedPaths();
- virtual ~RestrictedPaths();
-
- inline bool hasFilter() const { return !m_aUnrestrictedURLs.empty(); }
- inline const ::std::vector< OUString >& getFilter() const { return m_aUnrestrictedURLs; }
-
- inline void enableFilter( bool _bEnable ) { m_bFilterIsEnabled = _bEnable; }
- inline bool isFilterEnabled() const { return m_bFilterIsEnabled; }
-
- public:
- /** checks URL access permissions
-
- <p>with the "restriction" feature we have in the file dialog, it's possible that
- only certain URLs can be browsed. This method checks whether a given URL belongs
- to this set of permitted URLs.</p>
-
- <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p>
- */
- virtual bool isUrlAllowed( const OUString& _rURL ) const;
-
- /** checks URL access permissions
-
- <p>with the "restriction" feature we have in the file dialog, it's possible that
- only certain URLs can be browsed. This method checks whether a given URL belongs
- to this set of permitted URLs.</p>
-
- <p>Default behavior allows access to parent folder of a restricted folder (but not to its siblings).
- If allowParents is set to <FALSE/> parent folders will be treated as forbidden.
-
- <p>If no "access restriction" is effective, this method always returns <TRUE/>.</p>
- */
- bool isUrlAllowed( const OUString& _rURL, bool allowParents ) const;
- };
-
-} // namespace svt
-
-#endif // SVTOOLS_RESTRICTEDPATHS_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/urlfilter.hxx b/include/svl/urlfilter.hxx
index abcf0fd07091..d685015a2e36 100644
--- a/include/svl/urlfilter.hxx
+++ b/include/svl/urlfilter.hxx
@@ -23,18 +23,6 @@
#include <tools/wldcrd.hxx>
#include <functional>
#include <vector>
-/** filters allowed URLs
-*/
-class IUrlFilter
-{
-public:
- virtual bool isUrlAllowed( const OUString& _rURL ) const = 0;
-
-protected:
- virtual inline ~IUrlFilter() = 0;
-};
-
-inline IUrlFilter::~IUrlFilter() {}
struct FilterMatch : public ::std::unary_function< bool, WildCard >
{
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index d7cb77a19a47..917cfabab462 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -41,7 +41,6 @@ class ViewTabListBox_Impl;
class SvtFileView_Impl;
class SvTreeListEntry;
class HeaderBar;
-class IUrlFilter;
/// the result of an action in the FileView
enum FileViewResult
@@ -192,8 +191,6 @@ public:
String GetConfigString() const;
void SetConfigString( const String& rCfgStr );
- void SetUrlFilter( const IUrlFilter* _pFilter );
-
void EndInplaceEditing( bool _bCancel );
protected:
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index a8e85eaf7647..3b8dbca8ff4b 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -27,7 +27,6 @@
#include <vcl/combobox.hxx>
-class IUrlFilter;
class SvtMatchContext_Impl;
class SvtURLBox_Impl;
class SVT_DLLPUBLIC SvtURLBox : public ComboBox
@@ -83,7 +82,6 @@ public:
static String ParseSmart( String aText, String aBaseURL, String aWorkDir );
void SetFilter(const String& _sFilter);
- void SetUrlFilter( const IUrlFilter* _pFilter );
inline void EnableAutocompletion( sal_Bool _bEnable = sal_True )
{ bIsAutoCompleteEnabled = _bEnable; }
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index cb9145699994..d3920d469dd5 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -27,7 +27,6 @@
#include <svl/eitem.hxx>
#include <svl/stritem.hxx>
#include <unotools/historyoptions.hxx>
-#include <svl/folderrestriction.hxx>
#include <vcl/toolbox.hxx>
#include <toolkit/unohlp.hxx>
#include <osl/thread.hxx>
diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk
index b97387d73d84..922893eba8b2 100644
--- a/svl/Library_svl.mk
+++ b/svl/Library_svl.mk
@@ -112,7 +112,6 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
$(if $(filter DESKTOP,$(BUILD_TYPE)),\
svl/source/misc/documentlockfile) \
svl/source/misc/filenotation \
- svl/source/misc/folderrestriction \
svl/source/misc/fstathelper \
svl/source/misc/getstringresource \
svl/source/misc/inethist \
@@ -120,7 +119,6 @@ $(eval $(call gb_Library_add_exception_objects,svl,\
svl/source/misc/lngmisc \
svl/source/misc/lockfilecommon \
svl/source/misc/ownlist \
- svl/source/misc/restrictedpaths \
svl/source/misc/sharecontrolfile \
svl/source/misc/strmadpt \
svl/source/misc/urihelper \
diff --git a/svl/source/misc/folderrestriction.cxx b/svl/source/misc/folderrestriction.cxx
deleted file mode 100644
index 17562510cc44..000000000000
--- a/svl/source/misc/folderrestriction.cxx
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <svl/folderrestriction.hxx>
-#include "osl/process.h"
-#include "tools/urlobj.hxx"
-#include "unotools/localfilehelper.hxx"
-
-//-----------------------------------------------------------------------------
-
-static void convertStringListToUrls (
- const OUString& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash )
-{
- const sal_Unicode cSeparator =
-#if defined(WNT)
- ';'
-#else
- ':'
-#endif
- ;
-
- sal_Int32 nIndex = 0;
- do
- {
- // the current token in the list
- OUString sCurrentToken = _rColonSeparatedList.getToken( 0, cSeparator, nIndex );
- if (!sCurrentToken.isEmpty())
- {
- INetURLObject aCurrentURL;
-
- OUString sURL;
- if ( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sCurrentToken, sURL ) )
- aCurrentURL = INetURLObject( sURL );
- else
- {
- // smart URL parsing, assuming FILE protocol
- aCurrentURL = INetURLObject( sCurrentToken, INET_PROT_FILE );
- }
-
- if ( _bFinalSlash )
- aCurrentURL.setFinalSlash( );
- else
- aCurrentURL.removeFinalSlash( );
- _rTokens.push_back( aCurrentURL.GetMainURL( INetURLObject::NO_DECODE ) );
- }
- }
- while ( nIndex >= 0 );
-}
-
-/** retrieves the value of an environment variable
- @return <TRUE/> if and only if the retrieved string value is not empty
-*/
-static bool getEnvironmentValue( const sal_Char* _pAsciiEnvName, OUString& _rValue )
-{
- _rValue = OUString();
- OUString sEnvName = OUString::createFromAscii( _pAsciiEnvName );
- osl_getEnvironment( sEnvName.pData, &_rValue.pData );
- return !_rValue.isEmpty();
-}
-
-//-----------------------------------------------------------------------------
-
-namespace svt
-{
-
- void getUnrestrictedFolders( ::std::vector< String >& _rFolders )
- {
- _rFolders.resize( 0 );
- OUString sRestrictedPathList;
- if ( getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) )
- {
- // append a final slash. This ensures that when we later on check
- // for unrestricted paths, we don't allow paths like "/home/user35" just because
- // "/home/user3" is allowed - with the final slash, we make it "/home/user3/".
- convertStringListToUrls( sRestrictedPathList, _rFolders, true );
- }
- }
-
-} // namespace svt
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx
deleted file mode 100644
index c1b7f863913f..000000000000
--- a/svl/source/misc/restrictedpaths.cxx
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <svl/restrictedpaths.hxx>
-
-#include <algorithm>
-#include <osl/process.h>
-#include <tools/urlobj.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <unotools/syslocale.hxx>
-
-namespace svt
-{
- namespace
- {
- // ----------------------------------------------------------------
- /** retrieves the value of an environment variable
- @return <TRUE/> if and only if the retrieved string value is not empty
- */
- bool lcl_getEnvironmentValue( const sal_Char* _pAsciiEnvName, OUString& _rValue )
- {
- _rValue = OUString();
- OUString sEnvName = OUString::createFromAscii( _pAsciiEnvName );
- osl_getEnvironment( sEnvName.pData, &_rValue.pData );
- return !_rValue.isEmpty();
- }
-
- //-----------------------------------------------------------------
- void lcl_convertStringListToUrls( const OUString& _rColonSeparatedList, ::std::vector< OUString >& _rTokens )
- {
- const sal_Unicode cSeparator =
- #if defined(WNT)
- ';'
- #else
- ':'
- #endif
- ;
- sal_Int32 nIndex = 0;
- do
- {
- // the current token in the list
- OUString sCurrentToken = _rColonSeparatedList.getToken( 0, cSeparator, nIndex );
- if ( !sCurrentToken.isEmpty() )
- {
- INetURLObject aCurrentURL;
-
- OUString sURL;
- if ( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sCurrentToken, sURL ) )
- aCurrentURL = INetURLObject( sURL );
- else
- {
- // smart URL parsing, assuming FILE protocol
- aCurrentURL = INetURLObject( sCurrentToken, INET_PROT_FILE );
- }
-
- aCurrentURL.setFinalSlash( );
- _rTokens.push_back( aCurrentURL.GetMainURL( INetURLObject::NO_DECODE ) );
- }
- }
- while ( nIndex >= 0 );
- }
-
- }
-
- //=====================================================================
- //= CheckURLAllowed
- //=====================================================================
- struct CheckURLAllowed
- {
- protected:
- #ifdef WNT
- SvtSysLocale m_aSysLocale;
- #endif
- OUString m_sCheckURL; // the URL to check
- bool m_bAllowParent;
- public:
- inline CheckURLAllowed( const OUString& _rCheckURL, bool bAllowParent = true )
- : m_sCheckURL( _rCheckURL )
- , m_bAllowParent( bAllowParent )
- {
- #ifdef WNT
- // on windows, assume that the relevant file systems are case insensitive,
- // thus normalize the URL
- m_sCheckURL = m_aSysLocale.GetCharClass().lowercase( m_sCheckURL, 0, m_sCheckURL.getLength() );
- #endif
- }
-
- bool operator()( const OUString& _rApprovedURL )
- {
- #ifdef WNT
- // on windows, assume that the relevant file systems are case insensitive,
- // thus normalize the URL
- OUString sApprovedURL( m_aSysLocale.GetCharClass().lowercase( _rApprovedURL, 0, _rApprovedURL.getLength() ) );
- #else
- OUString sApprovedURL( _rApprovedURL );
- #endif
-
- sal_Int32 nLenApproved = sApprovedURL.getLength();
- sal_Int32 nLenChecked = m_sCheckURL.getLength();
-
- if ( nLenApproved > nLenChecked )
- {
- if ( m_bAllowParent )
- {
- if ( sApprovedURL.indexOf( m_sCheckURL ) == 0 )
- {
- if ( ( m_sCheckURL[ nLenChecked - 1 ] == '/' )
- || ( sApprovedURL[ nLenChecked ] == '/' ) )
- return true;
- }
- }
- else
- {
- // just a difference in final slash?
- if ( ( nLenApproved == ( nLenChecked + 1 ) ) &&
- ( sApprovedURL[ nLenApproved - 1 ] == '/' ) )
- return true;
- }
- return false;
- }
- else if ( nLenApproved < nLenChecked )
- {
- if ( m_sCheckURL.indexOf( sApprovedURL ) == 0 )
- {
- if ( ( sApprovedURL[ nLenApproved - 1 ] == '/' )
- || ( m_sCheckURL[ nLenApproved ] == '/' ) )
- return true;
- }
- return false;
- }
- else
- {
- // strings have equal length
- return ( sApprovedURL == m_sCheckURL );
- }
- }
- };
-
- //=====================================================================
- //= RestrictedPaths
- //=====================================================================
- //---------------------------------------------------------------------
- RestrictedPaths::RestrictedPaths()
- :m_bFilterIsEnabled( true )
- {
- OUString sRestrictedPathList;
- if ( lcl_getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) )
- // append a final slash. This ensures that when we later on check
- // for unrestricted paths, we don't allow paths like "/home/user35" just because
- // "/home/user3" is allowed - with the final slash, we make it "/home/user3/".
- lcl_convertStringListToUrls( sRestrictedPathList, m_aUnrestrictedURLs );
- }
-
- RestrictedPaths::~RestrictedPaths() {}
-
- // --------------------------------------------------------------------
- bool RestrictedPaths::isUrlAllowed( const OUString& _rURL ) const
- {
- if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled )
- return true;
-
- ::std::vector< OUString >::const_iterator aApprovedURL = ::std::find_if(
- m_aUnrestrictedURLs.begin(),
- m_aUnrestrictedURLs.end(),
- CheckURLAllowed( _rURL, true )
- );
-
- return ( aApprovedURL != m_aUnrestrictedURLs.end() );
- }
-
- // --------------------------------------------------------------------
- bool RestrictedPaths::isUrlAllowed( const OUString& _rURL, bool allowParents ) const
- {
- if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled )
- return true;
-
- ::std::vector< OUString >::const_iterator aApprovedURL = ::std::find_if(
- m_aUnrestrictedURLs.begin(),
- m_aUnrestrictedURLs.end(),
- CheckURLAllowed( _rURL, allowParents )
- );
-
- return ( aApprovedURL != m_aUnrestrictedURLs.end() );
- }
-
-} // namespace svt
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index 04515152915b..ac4215de33fc 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -356,7 +356,6 @@
#include <svl/poolitem.hxx>
#include <svl/smplhint.hxx>
#include <svl/stritem.hxx>
-#include <svl/urlfilter.hxx>
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx
index decda28f110d..4a0db744575f 100644
--- a/svtools/source/contnr/contentenumeration.cxx
+++ b/svtools/source/contnr/contentenumeration.cxx
@@ -18,7 +18,6 @@
*/
#include "contentenumeration.hxx"
-#include <svl/urlfilter.hxx>
#include <svtools/inettbc.hxx>
#include <svtools/imagemgr.hxx>
@@ -89,7 +88,6 @@ namespace svt
,m_rContent ( _rContentToFill )
,m_rContentMutex ( _rContentMutex )
,m_xCommandEnv ( _rxCommandEnv )
- ,m_pFilter ( NULL )
,m_pTranslator ( _pTranslator )
,m_bCancelled ( false )
,m_rBlackList ( ::com::sun::star::uno::Sequence< OUString >() )
@@ -108,7 +106,6 @@ namespace svt
m_bCancelled = true;
m_pResultHandler = NULL;
m_pTranslator = NULL;
- m_pFilter = NULL;
m_aFolder.aContent = ::ucbhelper::Content();
m_aFolder.sURL = String();
}
@@ -116,13 +113,11 @@ namespace svt
//--------------------------------------------------------------------
EnumerationResult FileViewContentEnumerator::enumerateFolderContentSync(
const FolderDescriptor& _rFolder,
- const IUrlFilter* _pFilter,
const ::com::sun::star::uno::Sequence< OUString >& rBlackList )
{
{
::osl::MutexGuard aGuard( m_aMutex );
m_aFolder = _rFolder;
- m_pFilter = _pFilter;
m_pResultHandler = NULL;
m_rBlackList = rBlackList;
}
@@ -131,11 +126,10 @@ namespace svt
//--------------------------------------------------------------------
void FileViewContentEnumerator::enumerateFolderContent(
- const FolderDescriptor& _rFolder, const IUrlFilter* _pFilter, IEnumerationResultHandler* _pResultHandler )
+ const FolderDescriptor& _rFolder, IEnumerationResultHandler* _pResultHandler )
{
::osl::MutexGuard aGuard( m_aMutex );
m_aFolder = _rFolder;
- m_pFilter = _pFilter;
m_pResultHandler = _pResultHandler;
OSL_ENSURE( m_aFolder.aContent.get().is() || m_aFolder.sURL.Len(),
@@ -240,9 +234,6 @@ namespace svt
// check for restrictions
{
::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pFilter && !m_pFilter->isUrlAllowed( sRealURL ) )
- continue;
-
if ( /* m_rBlackList.hasElements() && */ URLOnBlackList ( sRealURL ) )
continue;
}
diff --git a/svtools/source/contnr/contentenumeration.hxx b/svtools/source/contnr/contentenumeration.hxx
index ab4c3442f4b1..95da38a71bfe 100644
--- a/svtools/source/contnr/contentenumeration.hxx
+++ b/svtools/source/contnr/contentenumeration.hxx
@@ -29,7 +29,6 @@
#include <tools/string.hxx>
#include <vcl/image.hxx>
-class IUrlFilter;
//........................................................................
namespace svt
{
@@ -193,7 +192,6 @@ namespace svt
FolderDescriptor m_aFolder;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >
m_xCommandEnv;
- const IUrlFilter* m_pFilter;
const IContentTitleTranslation* m_pTranslator;
IEnumerationResultHandler* m_pResultHandler;
bool m_bCancelled;
@@ -234,7 +232,6 @@ namespace svt
*/
void enumerateFolderContent(
const FolderDescriptor& _rFolder,
- const IUrlFilter* _pFilter,
IEnumerationResultHandler* _pResultHandler
);
@@ -242,7 +239,6 @@ namespace svt
*/
EnumerationResult enumerateFolderContentSync(
const FolderDescriptor& _rFolder,
- const IUrlFilter* _pFilter,
const ::com::sun::star::uno::Sequence< OUString >& rBlackList = ::com::sun::star::uno::Sequence< OUString >()
);
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 7a99e67817f0..f8104b65e2e2 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -461,7 +461,6 @@ public:
ViewTabListBox_Impl* mpView;
NameTranslator_Impl* mpNameTrans;
- const IUrlFilter* mpUrlFilter;
sal_uInt16 mnSortColumn;
sal_Bool mbAscending : 1;
sal_Bool mbOnlyFolder : 1;
@@ -1623,12 +1622,6 @@ void SvtFileView::SetConfigString( const String& rCfgStr )
}
// -----------------------------------------------------------------------
-void SvtFileView::SetUrlFilter( const IUrlFilter* _pFilter )
-{
- mpImp->mpUrlFilter = _pFilter;
-}
-
-// -----------------------------------------------------------------------
void SvtFileView::StateChanged( StateChangedType nStateChange )
{
if ( nStateChange == STATE_CHANGE_ENABLE )
@@ -1700,7 +1693,6 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand
,m_bRunningAsyncAction ( false )
,m_bAsyncActionCancelled ( false )
,mpNameTrans ( NULL )
- ,mpUrlFilter ( NULL )
,mnSortColumn ( COLUMN_TITLE )
,mbAscending ( sal_True )
,mbOnlyFolder ( bOnlyFolder )
@@ -1779,7 +1771,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
if ( !pAsyncDescriptor )
{
- ::svt::EnumerationResult eResult = m_pContentEnumerator->enumerateFolderContentSync( _rFolder, mpUrlFilter, rBlackList );
+ ::svt::EnumerationResult eResult = m_pContentEnumerator->enumerateFolderContentSync( _rFolder, rBlackList );
if ( ::svt::SUCCESS == eResult )
{
implEnumerationSuccess();
@@ -1809,7 +1801,7 @@ FileViewResult SvtFileView_Impl::GetFolderContent_Impl(
pTimeout->Seconds = nMinTimeout / 1000L;
pTimeout->Nanosec = ( nMinTimeout % 1000L ) * 1000000L;
- m_pContentEnumerator->enumerateFolderContent( _rFolder, mpUrlFilter, this );
+ m_pContentEnumerator->enumerateFolderContent( _rFolder, this );
// wait until the enumeration is finished
// for this, release our own mutex (which is used by the enumerator thread)
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index a7ff10cc2de2..3cb54c3b2890 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -529,15 +529,7 @@ void SvtFileViewWindow_Impl::OpenFolder( const String& rURL )
rParent.SetPrevLevelButtonState( rURL );
- aFileView.SetUrlFilter( &aURLFilter );
-
- INetProtocol eProt = INetURLObject( rURL ).GetProtocol();
- bIsTemplateFolder = ( eProt == INET_PROT_VND_SUN_STAR_HIER );
- bool isNewDocumentFolder = ( eProt == INET_PROT_PRIVATE );
-
- aURLFilter.enableFilter( !bIsTemplateFolder && !isNewDocumentFolder );
-
- if ( isNewDocumentFolder )
+ if ( INetURLObject( rURL ).GetProtocol() == INET_PROT_PRIVATE )
{
aFileView.EnableNameReplacing( sal_False );
aFileView.Initialize( GetNewDocContents() );
diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx
index 3d2240c32072..19cdfc1a5385 100644
--- a/svtools/source/contnr/templwin.hxx
+++ b/svtools/source/contnr/templwin.hxx
@@ -27,7 +27,6 @@
#include <svtools/fileview.hxx>
#include <svtools/ivctrl.hxx>
#include <svtools/svmedit2.hxx>
-#include <svl/restrictedpaths.hxx>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/lang/Locale.hpp>
@@ -122,8 +121,6 @@ private:
String aFolderURL;
String aMyDocumentsURL;
String aSamplesFolderURL;
- ::svt::RestrictedPaths
- aURLFilter;
sal_Bool bIsTemplateFolder;
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 2859c10b1c10..917639d1771c 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -79,13 +79,11 @@ class SvtURLBox_Impl
public:
std::vector<OUString> aURLs;
std::vector<OUString> aCompletions;
- const IUrlFilter* pUrlFilter;
::std::vector< WildCard > m_aFilters;
static sal_Bool TildeParsing( String& aText, String& aBaseUrl );
inline SvtURLBox_Impl( )
- :pUrlFilter( NULL )
{
FilterMatch::createWildCardFilterList(String(),m_aFilters);
}
@@ -242,14 +240,6 @@ IMPL_STATIC_LINK( SvtMatchContext_Impl, Select_Impl, void*, )
// note: if this doesn't work, we're not interested in: we're checking the
// untouched sCompletion then
- if ( pBox->pImp->pUrlFilter )
- {
- if ( !pBox->pImp->pUrlFilter->isUrlAllowed( sURL ) )
- { // this URL is not allowed
- bValidCompletionsFiltered = true;
- continue;
- }
- }
if ( !sURL.isEmpty() && ( sURL[sURL.getLength()-1] != '/' ))
{
String sUpperURL( sURL );
@@ -985,7 +975,7 @@ void SvtURLBox::UpdatePicklistForSmartProtocol_Impl()
String aURL( aCurObj.GetMainURL( INetURLObject::DECODE_WITH_CHARSET ) );
- if ( aURL.Len() && ( !pImp->pUrlFilter || pImp->pUrlFilter->isUrlAllowed( aURL ) ) )
+ if ( aURL.Len() )
{
sal_Bool bFound = (aURL.GetChar(aURL.Len()-1) == '/' );
if ( !bFound )
@@ -1387,11 +1377,6 @@ sal_Bool SvtURLBox_Impl::TildeParsing(
return sal_True;
}
-void SvtURLBox::SetUrlFilter( const IUrlFilter* _pFilter )
-{
- pImp->pUrlFilter = _pFilter;
-}
-
void SvtURLBox::SetFilter(const String& _sFilter)
{
pImp->m_aFilters.clear();