You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/06/23 14:36:58 UTC

[tomcat] branch 9.0.x updated: Align with 10.0.x.

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new db9618a  Align with 10.0.x.
db9618a is described below

commit db9618af2ff256942c5c200983a93c4ee24e6a5d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jun 23 15:36:35 2021 +0100

    Align with 10.0.x.
    
    Apply same UDS path perm approach in the AprEndpoint as in the
    NioEndpoint
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 44d2101..d845630 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -24,6 +24,7 @@ import java.nio.ByteBuffer;
 import java.nio.channels.CompletionHandler;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.attribute.FileAttribute;
 import java.nio.file.attribute.PosixFilePermission;
@@ -299,6 +300,16 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB
     }
 
 
+    @Override
+    public String getId() {
+        if (getUnixDomainSocketPath() != null) {
+            return getUnixDomainSocketPath();
+        } else {
+            return null;
+        }
+    }
+
+
     // ----------------------------------------------- Public Lifecycle Methods
 
 
@@ -381,13 +392,8 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB
                 FileAttribute<Set<PosixFilePermission>> attrs =
                          PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString(
                                  getUnixDomainSocketPathPermissions()));
-                Files.setAttribute(Paths.get(getUnixDomainSocketPath()), attrs.name(), attrs.value());
-            }
-            else {
-                java.io.File file = Paths.get(getUnixDomainSocketPath()).toFile();
-                file.setReadable(true, false);
-                file.setWritable(true, false);
-                file.setExecutable(false, false);
+                Path path = Paths.get(getUnixDomainSocketPath());
+                Files.setAttribute(path, attrs.name(), attrs.value());
             }
         } else {
             if (OS.IS_WIN32 || OS.IS_WIN64) {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org