[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - officecfg/registry sfx2/source

2022-12-29 Thread Thorsten Behrens (via logerrit)
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |  125 +
 sfx2/source/doc/docmacromode.cxx   |   56 +
 2 files changed, 180 insertions(+), 1 deletion(-)

New commits:
commit f6bcd6eea8a8b0c75193c99e806ce48c007fa58d
Author: Thorsten Behrens 
AuthorDate: Thu Dec 29 23:08:43 2022 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Dec 30 00:33:51 2022 +

Support for Windows Security Zones for macro enable/disable

In Windows, files have security zones (local, from intranet, from
internet, etc) used by MS Word to decide in which mode it is safe to
open file.

This patch implements basic support for similar feature: it is now
possible to use expert configuration options to set up default
behavior and configure for example automatic disabling of macros, if
a file is downloaded from Internet or other unsafe location.

Changed defaults: files from untrusted zones, or the internet, get
macros disabled unconditionally. Can be overridden via
officecfg::Office::Common::Security::Scripting::WindowsSecurityZone.*
in the expert config dialog.

Change-Id: I0bf1ae4e54d75dd5d07cab309124a67a85ef2d4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143750
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144871

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index fb627eba4317..8c9add931d14 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2707,6 +2707,131 @@
 List with trusted authors.
   
 
+
+  
+Contains security settings regarding Basic scripts.
+  
+  
+
+  Action needed for opening document with macro with Windows 
zone 
+  identifier URLZONE_LOCAL_MACHINE (0, local machine).
+
+
+  
+
+  Ask
+
+  
+  
+
+  Allow
+
+  
+  
+
+  Deny
+
+  
+
+0
+  
+  
+
+  Action needed for opening document with macro with Windows 
zone 
+  identifier URLZONE_INTRANET (1, local machine).
+
+
+  
+
+  Ask
+
+  
+  
+
+  Allow
+
+  
+  
+
+  Deny
+
+  
+
+0
+  
+  
+
+  Action needed for opening document with macro with Windows 
zone 
+  identifier URLZONE_TRUSTED (2, trusted).
+
+
+  
+
+  Ask
+
+  
+  
+
+  Allow
+
+  
+  
+
+  Deny
+
+  
+
+0
+  
+  
+
+  Action needed for opening document with macro with Windows 
zone 
+  identifier URLZONE_INTERNET (3, internet).
+
+
+  
+
+  Ask
+
+  
+  
+
+  Allow
+
+  
+  
+
+  Deny
+
+  
+
+2
+  
+  
+
+  Action needed for opening document with macro with Windows 
zone 
+  identifier URLZONE_UNTRUSTED (3, untrusted source).
+
+
+  
+
+  Ask
+
+  
+  
+
+  Allow
+
+  
+  
+
+  Deny
+
+  
+
+2
+  
+
   
 
 
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index ea0d46babdfa..58edfba428c9 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -38,6 +38,10 @@
 #include 
 #include 
 
+#if defined(_WIN32)
+#include 
+#include 
+#endif
 
 namespace sfx2
 {
@@ -286,7 +290,57 @@ namespace sfx2
 }
 }
 
-// conformation is required
+#if defined(_WIN32)
+// Windows specific: try to decide 

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - officecfg/registry sfx2/source

2020-12-22 Thread Samuel Mehrbrodt (via logerrit)
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |6 ++
 sfx2/source/doc/objstor.cxx|4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 5dd2945ee2ea533de229a43790ece651775a
Author: Samuel Mehrbrodt 
AuthorDate: Tue Feb 4 10:36:09 2020 +0100
Commit: Thorsten Behrens 
CommitDate: Tue Dec 22 09:17:24 2020 +0100

Allow opt-out from document events check

Commit b3edf85e0fe6ca03dc26e1bf531be82193bc9627 added a warning on load
when a document binds events to a macro.

This adds an option to restore the old behavior, so that the warning only
appears when a document actually has Macros.

Change-Id: I5ad398d3d503a0954a746f4cba150f68630b820c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108141
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 3e9590a22977..2df062a36c62 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2664,6 +2664,12 @@
   
   false
 
+
+  
+Warn on load when a document binds an event to a macro
+  
+  true
+
 
   
 List with trusted authors.
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 0b4b933318ad..43d61cf247bc 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3569,7 +3569,9 @@ void SfxObjectShell::SetMacroCallsSeenWhileLoading()
 
 bool SfxObjectShell::GetMacroCallsSeenWhileLoading() const
 {
-return pImpl->m_bMacroCallsSeenWhileLoading;
+if 
(officecfg::Office::Common::Security::Scripting::CheckDocumentEvents::get())
+return pImpl->m_bMacroCallsSeenWhileLoading;
+return false;
 }
 
 bool SfxObjectShell::QuerySaveSizeExceededModules_Impl( const uno::Reference< 
task::XInteractionHandler >& xHandler )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - officecfg/registry sfx2/source

2018-11-30 Thread Libreoffice Gerrit user
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |9 +++
 sfx2/source/doc/docfile.cxx|   15 +
 2 files changed, 24 insertions(+)

New commits:
commit 10dbbe46a4818b0fea4afbfe0fd66f75a2dd8eef
Author: Katarina Behrens 
AuthorDate: Tue Nov 27 15:30:24 2018 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Dec 1 03:17:28 2018 +0100

Option to turn off WebDAV file locking

Locking files on WebDAV shares was implemented in tdf#82744,
in particular:

commit 26e6d4b05ab444e6a7529ffcac7fbe592fc94833
tdf#82744: fix WebDAV lock/unlock behaviour - part 1
commit bc9a8ddbb7081f79e915c841e56fd1c40f0df6f9
tdf#82744: fix WebDAV lock/unlock behaviour - part 2
commit b4576f3da4d90139fc5140962d13cb91dab98797
tdf#82744: fix WebDAV lock/unlock behaviour - part 3
commit fed2984281a85a5a2f308841ec810f218c75f2ab
tdf#82744: fix WebDAV lock/unlock behaviour - part 4

Before that, files on WebDAV shares were accessed w/o locking since
the beginning of [OOo] time. This option allows to revert to
the old behaviour i.e. non-locking WebDAV access.

For concurrent read-write WebDAV access by multiple users it is
recommended to keep UseWebDAVFileLocking at default value (true)

Change-Id: Id92177631d4854d6c7bf412164acbd9740db9592
Reviewed-on: https://gerrit.libreoffice.org/64116
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 297be63c8d1dd8f802b5216048d860c5b2661edc)
Reviewed-on: https://gerrit.libreoffice.org/64371
Tested-by: Thorsten Behrens 

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 3d73cc94deb2..432958100279 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5333,6 +5333,15 @@
 
 true
   
+  
+
+  Determines if WebDAV-specific file locking is used for 
documents
+ on WebDAV shares. It is not recommended to set this option to 'false' 
in
+ scenarios where multi-user, concurrent read/write access to WebDAV 
share
+ is required
+
+true
+  
   
 
   Allows to specify whether the OOo document file locking
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 11d6fc293301..9212fabfeb6b 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -171,6 +171,11 @@ bool IsLockingUsed()
 
 #endif
 
+bool IsWebDAVLockingUsed()
+{
+return officecfg::Office::Common::Misc::UseWebDAVFileLocking::get();
+}
+
 /// Gets default attributes of a file:// URL.
 sal_uInt64 GetDefaultFileAttributes(const OUString& rURL)
 {
@@ -1103,6 +1108,10 @@ SfxMedium::LockFileResult 
SfxMedium::LockOrigFileOnDemand( bool bLoading, bool b
 
 if ( GetURLObject().isAnyKnownWebDAVScheme() )
 {
+// do nothing if WebDAV locking is disabled
+if (!IsWebDAVLockingUsed())
+return LockFileResult::Succeeded;
+
 try
 {
 bool bResult = pImpl->m_bLocked;
@@ -2895,6 +2904,12 @@ void SfxMedium::UnlockFile( bool bReleaseLockStream )
 // check if webdav
 if ( GetURLObject().isAnyKnownWebDAVScheme() )
 {
+// do nothing if WebDAV locking if disabled
+// (shouldn't happen because we already skipped locking,
+// see LockOrigFileOnDemand, but just in case ...)
+if (!IsWebDAVLockingUsed())
+return;
+
 if ( pImpl->m_bLocked )
 {
 // an interaction handler should be used for authentication, if 
needed
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits