~ubuntu-branches/ubuntu/maverick/tomcat6/maverick

« back to all changes in this revision

Viewing changes to debian/patches/0009-allow-empty-PID-file.patch

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2010-06-28 21:41:31 UTC
  • mfrom: (2.2.15 sid)
  • Revision ID: james.westby@ubuntu.com-20100628214131-3wktukpb3lgdf83h
Tags: 6.0.26-5
* Convert patches to dep3 format.
* Backport security fix from trunk to fix CVE-2010-1157. (Closes: #587447)
* Set urgency to medium due to the security fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Arto Jantunen <viiru@debian.org>
 
2
Date: Mon, 28 Jun 2010 21:19:14 +0200
 
3
Subject: [PATCH] allow empty PID file
 
4
 
 
5
---
 
6
 bin/catalina.sh |    8 ++++++--
 
7
 1 files changed, 6 insertions(+), 2 deletions(-)
 
8
 
 
9
diff --git a/bin/catalina.sh b/bin/catalina.sh
 
10
index 2ef2323..5843b56 100755
 
11
--- a/bin/catalina.sh
 
12
+++ b/bin/catalina.sh
 
13
@@ -305,7 +305,7 @@ elif [ "$1" = "run" ]; then
 
14
 elif [ "$1" = "start" ] ; then
 
15
 
 
16
   if [ ! -z "$CATALINA_PID" ]; then
 
17
-    if [ -f "$CATALINA_PID" ]; then
 
18
+    if [ -s "$CATALINA_PID" ]; then
 
19
       echo "PID file ($CATALINA_PID) found. Is Tomcat still running? Start aborted."
 
20
       exit 1
 
21
     fi
 
22
@@ -363,12 +363,16 @@ elif [ "$1" = "stop" ] ; then
 
23
   fi
 
24
 
 
25
   if [ ! -z "$CATALINA_PID" ]; then
 
26
-    if [ -f "$CATALINA_PID" ]; then
 
27
+    if [ -s "$CATALINA_PID" ]; then
 
28
       kill -0 `cat $CATALINA_PID` >/dev/null 2>&1
 
29
       if [ $? -eq 1 ]; then
 
30
         echo "PID file ($CATALINA_PID) found but no matching process was found. Stop aborted."
 
31
         exit 1
 
32
       fi
 
33
+    elif [ -f "$CATALINA_PID" ]; then
 
34
+        rm $CATALINA_PID
 
35
+        echo "\$CATALINA_PID was set ($CATALINA_PID) but the specified file is empty. Did Tomcat fail while starting? Stop aborted."
 
36
+        exit 1
 
37
     else
 
38
       echo "\$CATALINA_PID was set ($CATALINA_PID) but the specified file does not exist. Is Tomcat running? Stop aborted."
 
39
       exit 1
 
40
--