diff options
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/securityoptions.cxx | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/unotools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index 2271219747f9..c31e131afdf4 100644 --- a/unotools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -21,6 +21,7 @@ #include <unotools/securityoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> +#include <unotools/ucbhelper.hxx> #include <tools/debug.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -1041,29 +1042,27 @@ bool SvtSecurityOptions::isSecureMacroUri( } // fall through case INET_PROT_SLOT: - if (referer.equalsIgnoreAsciiCase("private:user")) { - return true; - } - { - MutexGuard g(GetInitMutex()); - for (sal_Int32 i = 0; - i != m_pDataContainer->m_seqSecureURLs.getLength(); ++i) - { - OUString pref(m_pDataContainer->m_seqSecureURLs[i]); - pref.endsWith("/", &pref); - if (referer.equalsIgnoreAsciiCase(pref) - || referer.startsWithIgnoreAsciiCase(pref + "/")) - { - return true; - } - } - return false; - } + return referer.equalsIgnoreAsciiCase("private:user") + || isTrustedLocationUri(referer); default: return true; } } +bool SvtSecurityOptions::isTrustedLocationUri(OUString const & uri) const { + MutexGuard g(GetInitMutex()); + for (sal_Int32 i = 0; i != m_pDataContainer->m_seqSecureURLs.getLength(); + ++i) + { + if (UCBContentHelper::IsSubPath( + m_pDataContainer->m_seqSecureURLs[i], uri)) + { + return true; + } + } + return false; +} + sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const { MutexGuard aGuard( GetInitMutex() ); |