extensions/source/update/check/download.cxx       |    5 ----
 fpicker/source/office/RemoteFilesDialog.cxx       |    2 -
 svtools/source/dialogs/PlaceEditDialog.cxx        |    6 -----
 svtools/uiconfig/ui/placeedit.ui                  |    1 
 swext/mediawiki/src/com/sun/star/wiki/Helper.java |   24 +++++++++++++++++++++-
 5 files changed, 24 insertions(+), 14 deletions(-)

New commits:
commit 8b0b453ecbf41a33a33e45756fddc7ec3fbddfc3
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Nov 7 19:55:07 2023 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Thu Nov 9 16:53:55 2023 +0100

    swext: MediaWiki: implement AllowInsecureProtocols
    
    Change-Id: I0406431f2f923db5ae0c2c6bb889e7058096ca5d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159080
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java 
b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
index 4a5ec943ad8c..e43091d2e269 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
@@ -38,6 +38,7 @@ import com.sun.star.frame.XModel;
 import com.sun.star.frame.XModuleManager;
 import com.sun.star.io.XInputStream;
 import com.sun.star.io.XOutputStream;
+import com.sun.star.lang.IllegalArgumentException;
 import com.sun.star.lang.XMultiComponentFactory;
 import com.sun.star.lang.XMultiServiceFactory;
 import com.sun.star.lang.XComponent;
@@ -54,6 +55,7 @@ import com.sun.star.util.XChangesBatch;
 import java.net.*;
 import java.io.*;
 import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLException;
 import javax.swing.text.html.HTMLEditorKit;
 
@@ -645,7 +647,27 @@ public class Helper
         } else {
             conn = (HttpURLConnection) uri.toURL().openConnection();
         }
-        if (uri.getScheme().equals("https") && AllowUnknownCert(xContext, 
uri.getHost()))
+
+        boolean isAllowedInsecure;
+        try {
+            XNameAccess xNameAccess = GetConfigNameAccess(xContext, 
"org.openoffice.Office.Security/Net");
+            isAllowedInsecure = 
AnyConverter.toBoolean(xNameAccess.getByName("AllowInsecureProtocols"));
+        } catch (Exception e) {
+            throw new RuntimeException("failed to read configuration", e);
+        }
+        if (!isAllowedInsecure) {
+            if (!uri.getScheme().equals("https")) {
+                throw new IllegalArgumentException("insecure connection not 
allowed by configuration", null, (short)0);
+            }
+            try {
+                SSLContext context = SSLContext.getInstance("TLSv1.2");
+                context.init(null, null, null); // defaults
+                ((HttpsURLConnection) 
conn).setSSLSocketFactory(context.getSocketFactory());
+            } catch (Exception e) {
+                throw new RuntimeException("failed to create SSLContext", e);
+            }
+        }
+        else if (uri.getScheme().equals("https") && AllowUnknownCert(xContext, 
uri.getHost()))
         {
             // let unknown certificates be accepted
             ((HttpsURLConnection) conn).setSSLSocketFactory(new 
WikiProtocolSocketFactory());
commit b91daea3c1a38883c06cdd63c6eababe1df9e61d
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Nov 7 13:20:21 2023 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Thu Nov 9 16:53:41 2023 +0100

    tdf#146386 fpicker,svtools: remove FTP from Remote Files dialog
    
    Change-Id: I76ba8e275033c4d0a3c04964828dc640827cb7cf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159073
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/extensions/source/update/check/download.cxx 
b/extensions/source/update/check/download.cxx
index 2124ee5a0512..9b4823777289 100644
--- a/extensions/source/update/check/download.cxx
+++ b/extensions/source/update/check/download.cxx
@@ -203,11 +203,6 @@ Download::getProxyForURL(std::u16string_view rURL, 
OString& rHost, sal_Int32& rP
             rHost = getStringValue(xNameAccess, "ooInetHTTPSProxyName");
             rPort = getInt32Value(xNameAccess, "ooInetHTTPSProxyPort");
         }
-        else if( o3tl::starts_with(rURL, u"ftp:") )
-        {
-            rHost = getStringValue(xNameAccess, "ooInetFTPProxyName");
-            rPort = getInt32Value(xNameAccess, "ooInetFTPProxyPort");
-        }
     }
 }
 
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx 
b/fpicker/source/office/RemoteFilesDialog.cxx
index ae03c2774f38..2b7dbd3d46db 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -195,8 +195,6 @@ static OUString lcl_GetServiceType( const ServicePtr& 
pService )
     INetProtocol aProtocol = pService->GetUrlObject().GetProtocol();
     switch( aProtocol )
     {
-        case INetProtocol::Ftp:
-            return "FTP";
         case INetProtocol::Cmis:
         {
             OUString sHost = pService->GetUrlObject().GetHost( 
INetURLObject::DecodeMechanism::WithCharset );
diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx 
b/svtools/source/dialogs/PlaceEditDialog.cxx
index 4119cf5f6998..7d0c7717e2f1 100644
--- a/svtools/source/dialogs/PlaceEditDialog.cxx
+++ b/svtools/source/dialogs/PlaceEditDialog.cxx
@@ -209,15 +209,11 @@ void PlaceEditDialog::InitDetails( )
         ++nPos;
     }
 
-    // Create WebDAV / FTP / SSH details control
+    // Create WebDAV / SSH details control
     std::shared_ptr<DetailsContainer> 
xDavDetails(std::make_shared<DavDetailsContainer>(this));
     xDavDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
     m_aDetailsContainers.push_back(xDavDetails);
 
-    std::shared_ptr<DetailsContainer> 
xFtpDetails(std::make_shared<HostDetailsContainer>(this, 21, "ftp"));
-    xFtpDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
-    m_aDetailsContainers.push_back(xFtpDetails);
-
     std::shared_ptr<DetailsContainer> 
xSshDetails(std::make_shared<HostDetailsContainer>(this, 22, "sftp"));
     xSshDetails->setChangeHdl( LINK( this, PlaceEditDialog, EditHdl ) );
     m_aDetailsContainers.push_back(xSshDetails);
diff --git a/svtools/uiconfig/ui/placeedit.ui b/svtools/uiconfig/ui/placeedit.ui
index 1339f1932a48..a2be88636b61 100644
--- a/svtools/uiconfig/ui/placeedit.ui
+++ b/svtools/uiconfig/ui/placeedit.ui
@@ -125,7 +125,6 @@
                 <property name="hexpand">True</property>
                 <items>
                   <item translatable="yes" 
context="placeedit|liststore1">WebDAV</item>
-                  <item translatable="yes" 
context="placeedit|liststore1">FTP</item>
                   <item translatable="yes" 
context="placeedit|liststore1">SSH</item>
                   <item translatable="yes" 
context="placeedit|liststore1">Windows Share</item>
                 </items>

Reply via email to