From 76ebc9007567c8326217dd94844540e1e27d8468 Mon Sep 17 00:00:00 2001 From: Konstantin Kolinko Date: Thu, 21 Jan 2016 12:47:19 +0000 Subject: [PATCH] Protect initialization of ResourceLinkFactory when running with a SecurityManager. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1725926 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/naming/factory/ResourceLinkFactory.java | 5 +++++ webapps/docs/changelog.xml | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/java/org/apache/naming/factory/ResourceLinkFactory.java b/java/org/apache/naming/factory/ResourceLinkFactory.java index 808192cfc072..8a43e7414167 100644 --- a/java/org/apache/naming/factory/ResourceLinkFactory.java +++ b/java/org/apache/naming/factory/ResourceLinkFactory.java @@ -60,6 +60,11 @@ public class ResourceLinkFactory * @param newGlobalContext new global context value */ public static void setGlobalContext(Context newGlobalContext) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + sm.checkPermission(new RuntimePermission( + ResourceLinkFactory.class.getName() + ".setGlobalContext")); + } globalContext = newGlobalContext; } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index c53854e39d59..df5a8cd2f4c5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -45,6 +45,14 @@ issues do not "pop up" wrt. others). -->
+ + + + Protect initialization of ResourceLinkFactory when + running with a SecurityManager. (kkolinko) + + +