This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new fe7c3b6787 Add i18n support to all uses of pathCheck
fe7c3b6787 is described below
commit fe7c3b67876bf700954821e5e4af7aad2d954b80
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Jun 25 11:10:45 2026 +0100
Add i18n support to all uses of pathCheck
---
.../catalina/manager/host/HostManagerServlet.java | 30 +++++++++++++++++-----
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/catalina/manager/host/HostManagerServlet.java
b/java/org/apache/catalina/manager/host/HostManagerServlet.java
index 7487edf410..0a7bfab5af 100644
--- a/java/org/apache/catalina/manager/host/HostManagerServlet.java
+++ b/java/org/apache/catalina/manager/host/HostManagerServlet.java
@@ -374,14 +374,14 @@ public class HostManagerServlet extends HttpServlet
implements ContainerServlet
}
// Create base for config files
- File configBaseFile = getConfigBase(name);
+ File configBaseFile = getConfigBase(name, writer, smClient);
+ if (configBaseFile == null) {
+
writer.println(smClient.getString("hostManagerServlet.configBaseCreateFail",
name));
+ return;
+ }
// Copy manager.xml if requested
if (manager) {
- if (configBaseFile == null) {
-
writer.println(smClient.getString("hostManagerServlet.configBaseCreateFail",
name));
- return;
- }
try (InputStream is =
getServletContext().getResourceAsStream("/WEB-INF/manager.xml")) {
if (is == null) {
writer.println(smClient.getString("hostManagerServlet.managerXml"));
@@ -651,8 +651,26 @@ public class HostManagerServlet extends HttpServlet
implements ContainerServlet
* @param hostName The host name
*
* @return the config base for the host
+ *
+ * @deprecated Unused. Will be removed in Tomcat 12. Use {@link
#getConfigBase(String, PrintWriter, StringManager)}
*/
+ @Deprecated
protected File getConfigBase(String hostName) {
+ return getConfigBase(hostName, null, null);
+ }
+
+
+ /**
+ * Get config base.
+ *
+ * @param hostName The host name
+ * @param writer Writer to render results to
+ * @param smClient StringManager for the client's locale
+ *
+ *
+ * @return the config base for the host
+ */
+ protected File getConfigBase(String hostName, PrintWriter writer,
StringManager smClient) {
File configBase = new File(context.getCatalinaBase(), "conf");
if (!configBase.exists()) {
return null;
@@ -663,7 +681,7 @@ public class HostManagerServlet extends HttpServlet
implements ContainerServlet
if (installedHost != null) {
configBase = new File(configBase, hostName);
}
- if (!pathCheck(configBase, new File(context.getCatalinaBase(),
"conf"), null, null)) {
+ if (!pathCheck(configBase, new File(context.getCatalinaBase(),
"conf"), writer, smClient)) {
return null;
}
if (!configBase.mkdirs() && !configBase.isDirectory()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]