]> git.pld-linux.org Git - packages/tomcat.git/blame - tomcat-CVE-2009-0783.patch
- rel 1
[packages/tomcat.git] / tomcat-CVE-2009-0783.patch
CommitLineData
32e14b4a 1Index: container/catalina/src/share/org/apache/catalina/core/StandardContext.java
2===================================================================
3--- container/catalina/src/share/org/apache/catalina/core/StandardContext.java (wersja 781541)
4+++ container/catalina/src/share/org/apache/catalina/core/StandardContext.java (wersja 781542)
5@@ -4140,10 +4140,6 @@
6 ((Lifecycle) pipeline).start();
7 }
8
9- if(getProcessTlds()) {
10- processTlds();
11- }
12-
13 // Notify our interested LifecycleListeners
14 lifecycle.fireLifecycleEvent(START_EVENT, null);
15
16@@ -4278,40 +4274,6 @@
17 }
18
19 /**
20- * Processes TLDs.
21- *
22- * @throws LifecycleException If an error occurs
23- */
24- protected void processTlds() throws LifecycleException {
25- TldConfig tldConfig = new TldConfig();
26- tldConfig.setContext(this);
27-
28- // (1) check if the attribute has been defined
29- // on the context element.
30- tldConfig.setTldValidation(tldValidation);
31- tldConfig.setTldNamespaceAware(tldNamespaceAware);
32-
33- // (2) if the attribute wasn't defined on the context
34- // try the host.
35- if (!tldValidation) {
36- tldConfig.setTldValidation
37- (((StandardHost) getParent()).getXmlValidation());
38- }
39-
40- if (!tldNamespaceAware) {
41- tldConfig.setTldNamespaceAware
42- (((StandardHost) getParent()).getXmlNamespaceAware());
43- }
44-
45- try {
46- tldConfig.execute();
47- } catch (Exception ex) {
48- log.error("Error reading tld listeners "
49- + ex.toString(), ex);
50- }
51- }
52-
53- /**
54 * Stop this Context component.
55 *
56 * @exception LifecycleException if a shutdown error occurs
57@@ -5083,6 +5045,10 @@
58 return;
59 }
60 }
61+ if (processTlds) {
62+ this.addLifecycleListener(new TldConfig());
63+ }
64+
65 super.init();
66
67 // Notify our interested LifecycleListeners
68Index: container/catalina/src/share/org/apache/catalina/startup/TldConfig.java
69===================================================================
70--- container/catalina/src/share/org/apache/catalina/startup/TldConfig.java (wersja 781541)
71+++ container/catalina/src/share/org/apache/catalina/startup/TldConfig.java (wersja 781542)
72@@ -49,20 +49,24 @@
73
74 import org.apache.catalina.Context;
75 import org.apache.catalina.Globals;
76+import org.apache.catalina.Lifecycle;
77+import org.apache.catalina.LifecycleEvent;
78+import org.apache.catalina.LifecycleListener;
79 import org.apache.catalina.core.StandardContext;
80+import org.apache.catalina.core.StandardHost;
81 import org.apache.catalina.util.StringManager;
82 import org.apache.tomcat.util.digester.Digester;
83 import org.xml.sax.InputSource;
84
85 /**
86- * Startup event listener for a <b>Context</b> that configures the properties
87- * of that Context, and the associated defined servlets.
88+ * Startup event listener for a <b>Context</b> that configures application
89+ * listeners configured in any TLD files.
90 *
91 * @author Craig R. McClanahan
92 * @author Jean-Francois Arcand
93 * @author Costin Manolache
94 */
95-public final class TldConfig {
96+public final class TldConfig implements LifecycleListener {
97
98 // Names of JARs that are known not to contain any TLDs
99 private static HashSet noTldJars;
100@@ -399,20 +403,6 @@
101 }
102
103 /**
104- * Create (if necessary) and return a Digester configured to process a tag
105- * library descriptor, looking for additional listener classes to be
106- * registered.
107- */
108- private static Digester createTldDigester() {
109-
110- return DigesterFactory.newDigester(tldValidation,
111- tldNamespaceAware,
112- new TldRuleSet());
113-
114- }
115-
116-
117- /**
118 * Scan the JAR file at the specified resource path for TLDs in the
119 * <code>META-INF</code> subdirectory, and scan each TLD for application
120 * event listeners that need to be registered.
121@@ -504,10 +494,6 @@
122 private void tldScanStream(InputSource resourceStream)
123 throws Exception {
124
125- if (tldDigester == null){
126- tldDigester = createTldDigester();
127- }
128-
129 synchronized (tldDigester) {
130 try {
131 tldDigester.push(this);
132@@ -726,4 +712,51 @@
133
134 return jarPathMap;
135 }
136+
137+ public void lifecycleEvent(LifecycleEvent event) {
138+ // Identify the context we are associated with
139+ try {
140+ context = (Context) event.getLifecycle();
141+ } catch (ClassCastException e) {
142+ log.error(sm.getString("tldConfig.cce", event.getLifecycle()), e);
143+ return;
144+ }
145+
146+ if (event.getType().equals(Lifecycle.INIT_EVENT)) {
147+ init();
148+ } else if (event.getType().equals(Lifecycle.START_EVENT)) {
149+ try {
150+ execute();
151+ } catch (Exception e) {
152+ log.error(sm.getString(
153+ "tldConfig.execute", context.getPath()), e);
154+ }
155+ } // Ignore the other event types - nothing to do
156+ }
157+
158+ private void init() {
159+ if (tldDigester == null){
160+ // (1) check if the attribute has been defined
161+ // on the context element.
162+ setTldValidation(context.getTldValidation());
163+ setTldNamespaceAware(context.getTldNamespaceAware());
164+
165+ // (2) if the attribute wasn't defined on the context
166+ // try the host.
167+ if (!tldValidation) {
168+ setTldValidation(
169+ ((StandardHost) context.getParent()).getXmlValidation());
170+ }
171+
172+ if (!tldNamespaceAware) {
173+ setTldNamespaceAware(
174+ ((StandardHost) context.getParent()).getXmlNamespaceAware());
175+ }
176+
177+ tldDigester = DigesterFactory.newDigester(tldValidation,
178+ tldNamespaceAware,
179+ new TldRuleSet());
180+ tldDigester.getParser();
181+ }
182+ }
183 }
184Index: container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties
185===================================================================
186--- container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties (wersja 781541)
187+++ container/catalina/src/share/org/apache/catalina/startup/LocalStrings.properties (wersja 781542)
188@@ -87,6 +87,8 @@
189 hostConfig.undeploy=Undeploying context [{0}]
190 hostConfig.undeploy.error=Error undeploying web application at context path {0}
191 hostConfig.undeploying=Undeploying deployed web applications
192+tldConfig.cce=Lifecycle event data object {0} is not a Context
193+tldConfig.execute=Error processing TLD files for context path {0}
194 userConfig.database=Exception loading user database
195 userConfig.deploy=Deploying web application for user {0}
196 userConfig.deploying=Deploying user web applications
This page took 0.080395 seconds and 4 git commands to generate.