cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2004-03-04 Thread amyroh
amyroh  2004/03/04 13:47:19

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Fix bugzilla 20770 - Admin Tool removes "workDir" attribute from "context".
  
  Revision  ChangesPath
  1.38  +5 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- StandardServer.java   3 Feb 2003 22:52:19 -   1.37
  +++ StandardServer.java   4 Mar 2004 21:47:18 -   1.38
  @@ -156,7 +156,7 @@
   { "org.apache.catalina.core.StandardContext", "publicId" },
   { "org.apache.catalina.core.StandardContext", "replaceWelcomeFiles" },
   { "org.apache.catalina.core.StandardContext", "sessionTimeout" },
  -{ "org.apache.catalina.core.StandardContext", "workDir" },
  +//{ "org.apache.catalina.core.StandardContext", "workDir" },
   { "org.apache.catalina.session.StandardManager", "distributable" },
   { "org.apache.catalina.session.StandardManager", "entropy" },
   };
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-02-03 Thread amyroh
amyroh  2003/02/03 14:52:20

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Fix for bugzilla 16106.  Patch submitted by Rich J <[EMAIL PROTECTED]>.
  
  Revision  ChangesPath
  1.37  +5 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- StandardServer.java   7 Jan 2003 22:20:12 -   1.36
  +++ StandardServer.java   3 Feb 2003 22:52:19 -   1.37
  @@ -931,7 +931,7 @@
   private boolean isSkippable(String className) {
   
   for (int i = 0; i < skippables.length; i++) {
  -if (skippables[i] == className) {
  +if (skippables[i].equals(className)) {
   return (true);
   }
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-07 Thread amyroh
amyroh  2003/01/07 14:20:12

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Fix bug 15819.  Do not write out StandardDefaultContext Listener to server.xml.
  
  Revision  ChangesPath
  1.36  +5 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- StandardServer.java   6 Jan 2003 23:25:24 -   1.35
  +++ StandardServer.java   7 Jan 2003 22:20:12 -   1.36
  @@ -191,6 +191,7 @@
   "org.apache.catalina.authenticator.SSLAuthenticator",
   "org.apache.catalina.core.NamingContextListener",
   "org.apache.catalina.core.StandardContextValve",
  +"org.apache.catalina.core.StandardDefaultContext",
   "org.apache.catalina.core.StandardEngineValve",
   "org.apache.catalina.core.StandardHostValve",
   "org.apache.catalina.startup.ContextConfig",
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-06 Thread amyroh
amyroh  2003/01/06 15:25:25

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Correct fix.
  
  Revision  ChangesPath
  1.35  +5 -10 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- StandardServer.java   3 Jan 2003 19:47:01 -   1.34
  +++ StandardServer.java   6 Jan 2003 23:25:24 -   1.35
  @@ -824,12 +824,7 @@
   } else if (c == '"') {
   filtered.append(""");
   } else if (c == '&') {
  -int j = input.indexOf(";", i);
  -if (j > 0) {
  -filtered.append(c);
  -} else {
  -filtered.append("&");
  -}
  +filtered.append("&");
   } else {
   filtered.append(c);
   }
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-05 Thread Christoph Seibert
Am Sonntag, 05.01.03 um 02:15 Uhr schrieb Roberto Casanova:

You should not revert completely to revision 1.32.  There were two
changes done to StandardServer.java in your commit of revision 1.33.

We discussed only the first change (in method convertStr around line
824) and I think we agree it should be reverted.

But the second change done in that same commit actually fixes the
original problem (bug 15762) and should be preserved.


I agree. I simply forgot to point that out in my last post.

In discussing this bug, and looking at bug 15798 (which is
Windows-specific, I guess, but nevertheless concerns a similiar
issue), I think that the way the XML files are written 'by hand'
through PrintWriters is prone to produce bugs of this kind, because
it is easy to forget that some strings must be encoded. Isn't there
some standard API for _writing_ XML, which takes care of these
encoding issues transparently?

I thought about maybe having a look at the Cocoon project's
Serializers, which I think do something like this via SAX events.
Of course, one could also construct a DOM tree and write that out,
but I don't know whether this is a good idea in terms of performance.
Also, I don't know if encoding issues are taken care of in each
approach.

Ciao,
Christoph

--
--- Christoph Seibert   [EMAIL PROTECTED] ---
-- Farlon Dragon -==(UDIC)==-http://home.pages.de/~seibert/ --
- Who can possibly rule if no one-
- who wants to can be allowed to? - D. Adams, HHGTTG -


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-04 Thread Roberto Casanova

You should not revert completely to revision 1.32.  There were two
changes done to StandardServer.java in your commit of revision 1.33.

We discussed only the first change (in method convertStr around line
824) and I think we agree it should be reverted.

But the second change done in that same commit actually fixes the
original problem (bug 15762) and should be preserved.  This is in method
storeNamingResources around line 1822:

  @@ -1822,7 +1830,7 @@
   writer.print(' ');
   }
   writer.print("");
  -writer.print(value);
  +writer.print(convertStr(value));
   writer.println("");
   for (int j = 0; j < indent + 2; j++) {
   writer.print(' ');

Actually, I have been running Tomcat with this same fix for a month or
so, and it works well.  You can enter special characters (like &) in the
data source url using the admin webapp (no need to escape them), they
get stored in server.xml and read back properly.  (I had attached that
patch with the original bug report)

Thanks
Roberto

> From: Amy Roh
> Sent: Sunday, January 05, 2003 0:46
> 
> Roberto Casanova wrote:
> > I see another problem with this code.
> > 
> > Suppose for some reason we have an attribute or resource 
> parameter value
> > like the following (without the quotes):
> > "> corresponds to >"
> > The correct XML for this string is:
> > "> corresponds to >"
> > However this code would write to server.xml:
> > "> corresponds to >"
> > The next time the server.xml file is read in, we end up with:
> > "> corresponds to >"
> > which is different than the original string.
> > 
> > In my opinion this portion of the code should be left as it was in
> > revision 1.32:
> 
> I see the problem with the previous commit - Sorry, I should have 
> thought about it more before making the quick change.  However, the 
> original problem of second time admin saving url in invalid 
> form still 
> occurs with revision 1.32.  The workaround is to make sure url is in 
> valid form in datasource page everytime you commit any changes via 
> admin.  Is this workaround feasible?
> 
> Amy
> 
> > 
> > Roberto
> > 
> > 
> >>Christoph Seibert wrote:
> >>
> >>>Hi there,
> >>>
> >>>I think there is a problem with the following fix:
> >>>
> >>>
> amyroh  2003/01/02 17:59:09
> 
>   Modified:catalina/src/share/org/apache/catalina/core
> StandardServer.java
>   Log:
>   Fix for bugzilla 15762.
> >>>
> >>>[...]
> >>>
> >>>
>   diff -u -r1.32 -r1.33
>   --- StandardServer.java11 Sep 2002 14:19:33 -1.32
>   +++ StandardServer.java3 Jan 2003 01:59:08 -1.33
>   @@ -824,7 +824,15 @@
>    } else if (c == '"') {
>    filtered.append(""");
>    } else if (c == '&') {
>   -filtered.append("&");
>   +char s1 = input.charAt(i+3);
>   +char s2 = input.charAt(i+4);
>   +char s3 = input.charAt(i+5);
>   +if (((s1 == ';') || (s2 == ';')) || (s3 
> >>>
> >>== ';')) {
> >>
>   +// do not convert if it's already 
> >>>
> >>in converted 
> >>
> form
>   +filtered.append(c);
>   +} else {
>   +filtered.append("&");
>   +}
>    } else {
>    filtered.append(c);
>    }
> >>>
> >>>
> >>>(Note: I haven't had a look at the surrounding code yet, so 
> >>
> >>I have to 
> >>
> >>>assume that 'i' is the position of 'c', that is the '&' character.)
> >>>
> >>>This code assumes that character or entity references will not be 
> >>>shorter than 4 characters (including the delimiters '&' and 
> >>
> >>';') and 
> >>
> >>>no longer than 6. However, the XML specification does not 
> >>
> >>in any way 
> >>
> >>>define restrictions like that. For example, '&d;' is a 
> valid entity 
> >>>reference (assuming it was defined in the DTD). Worse, 
> character or 
> >>>entity references can have arbitrary length. For example, 
> >>>' ' is a valid character reference to the ' 
> >>
> >>' (space) 
> >>
> >>>character.
> >>>
> >>>I'm sorry I don't have a better fix right now, but I assume 
> >>
> >>one would 
> >>
> >>>have to iterate through the characters following the '&' 
> >>
> >>until either 
> >>
> >>>a ';' is found or a character occurs that is not a legal 
> part of an 
> >>>entity reference name (or in the case of a character 
> reference, not 
> >>>one of [0-9] for decimal or [0-9a-fA-F] for hexadecimal).
> >>>
> >>>(Actually, I believe this wheel must already have been 
> >>
> >>invented, but 
> >>
> >>>with only looking at this code snippet, I don't really know.)
> >>
> >>I believe iterating through the characters following the '&' 
> >>to look for 
> >>';' is found wi

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-04 Thread Christoph Seibert
Am Freitag, 03.01.03 um 20:55 Uhr schrieb Amy Roh:

Christoph Seibert wrote:

  Fix for bugzilla 15762.

I'm sorry I don't have a better fix right now, but I assume one
would have to iterate through the characters following the '&'
until either a ';' is found or a character occurs that is not a legal
part of an entity reference name (or in the case of a character
reference, not one of [0-9] for decimal or [0-9a-fA-F] for
hexadecimal).

I believe iterating through the characters following the '&' to look 
for ';' is found will fix the problem.  A character such as 
' ' without following ';' will result in parsing error 
where as ' ' will be written as a space(' ').

I'm sorry (really - I'm new here and already I start correcting
other people's code without having contributed any myself), but
I don't think this is sufficient. On encountering a string like

'I like to spell & as &'

your solution would treat '& as &' as a valid entity
reference, and would not escape the first '&' character.

However, please also see my answer to Roberto's mail before
making another change.

Ciao,
Christoph

--
--- Christoph Seibert   [EMAIL PROTECTED] ---
-- Farlon Dragon -==(UDIC)==-http://home.pages.de/~seibert/ --
- Who can possibly rule if no one-
- who wants to can be allowed to? - D. Adams, HHGTTG -


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-04 Thread Christoph Seibert
Am Freitag, 03.01.03 um 23:48 Uhr schrieb Roberto Casanova:

I see another problem with this code.

Suppose for some reason we have an attribute or resource parameter 
value
like the following (without the quotes):
"> corresponds to >"
The correct XML for this string is:
"> corresponds to >"
However this code would write to server.xml:
"> corresponds to >"
The next time the server.xml file is read in, we end up with:
"> corresponds to >"
which is different than the original string.

In my opinion this portion of the code should be left as it was in
revision 1.32:

Actually, after reading the code in context (that is, I've had a
look at StandardServer.java), I agree with this. The change to
convertStr() results in inconsistent handling of input strings.

The question I've been asking myself is: Why should convertStr()
treat the input string as if it was a mixture of unescaped and
already escaped <,>,&,' and " characters? Since I still don't
have the full context, I don't know where the input string comes
from, so I can't really answer that. If the input string comes
from a form, it should be treated as in revision 1.32, because
of what Roberto points out. If it comes from an XML file, no
conversion should be necessary, because the XML parser checks
for well-formedness of the input file - unless the parser resolves
the entity and character references before passing the string, in
which case the conversion becomes necessary again. (Wow, I hope
this doesn't sound like complete drivel... ;-))

Ciao,
Christoph

--
--- Christoph Seibert   [EMAIL PROTECTED] ---
-- Farlon Dragon -==(UDIC)==-http://home.pages.de/~seibert/ --
- Who can possibly rule if no one-
- who wants to can be allowed to? - D. Adams, HHGTTG -


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-03 Thread Roberto Casanova

I see another problem with this code.

Suppose for some reason we have an attribute or resource parameter value
like the following (without the quotes):
"> corresponds to >"
The correct XML for this string is:
"&gt; corresponds to >"
However this code would write to server.xml:
"> corresponds to >"
The next time the server.xml file is read in, we end up with:
"> corresponds to >"
which is different than the original string.

In my opinion this portion of the code should be left as it was in
revision 1.32:

Roberto

> -Original Message-
> From: Amy Roh [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, January 03, 2003 20:55
> To: Tomcat Developers List
> Subject: Re: cvs commit: 
> jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core
>  StandardServer.java
> 
> 
> Christoph Seibert wrote:
> > Hi there,
> > 
> > I think there is a problem with the following fix:
> > 
> >> amyroh  2003/01/02 17:59:09
> >>
> >>   Modified:catalina/src/share/org/apache/catalina/core
> >> StandardServer.java
> >>   Log:
> >>   Fix for bugzilla 15762.
> > 
> > [...]
> > 
> >>   diff -u -r1.32 -r1.33
> >>   --- StandardServer.java11 Sep 2002 14:19:33 -1.32
> >>   +++ StandardServer.java3 Jan 2003 01:59:08 -1.33
> >>   @@ -824,7 +824,15 @@
> >>} else if (c == '"') {
> >>filtered.append(""");
> >>} else if (c == '&') {
> >>   -filtered.append("&");
> >>   +char s1 = input.charAt(i+3);
> >>   +char s2 = input.charAt(i+4);
> >>   +char s3 = input.charAt(i+5);
> >>   +if (((s1 == ';') || (s2 == ';')) || (s3 
> == ';')) {
> >>   +// do not convert if it's already 
> in converted 
> >> form
> >>   +filtered.append(c);
> >>   +} else {
> >>   +filtered.append("&");
> >>   +}
> >>} else {
> >>filtered.append(c);
> >>}
> > 
> > 
> > (Note: I haven't had a look at the surrounding code yet, so 
> I have to 
> > assume that 'i' is the position of 'c', that is the '&' character.)
> > 
> > This code assumes that character or entity references will not be 
> > shorter than 4 characters (including the delimiters '&' and 
> ';') and 
> > no longer than 6. However, the XML specification does not 
> in any way 
> > define restrictions like that. For example, '&d;' is a valid entity 
> > reference (assuming it was defined in the DTD). Worse, character or 
> > entity references can have arbitrary length. For example, 
> > ' ' is a valid character reference to the ' 
> ' (space) 
> > character.
> > 
> > I'm sorry I don't have a better fix right now, but I assume 
> one would 
> > have to iterate through the characters following the '&' 
> until either 
> > a ';' is found or a character occurs that is not a legal part of an 
> > entity reference name (or in the case of a character reference, not 
> > one of [0-9] for decimal or [0-9a-fA-F] for hexadecimal).
> > 
> > (Actually, I believe this wheel must already have been 
> invented, but 
> > with only looking at this code snippet, I don't really know.)
> 
> I believe iterating through the characters following the '&' 
> to look for 
> ';' is found will fix the problem.  A character such as 
> ' ' without following ';' will result in parsing error 
> where as ' ' will be written as a space(' ').
> 
> Thanks,
> Amy
> 
> > 
> > Ciao,
> > Christoph
> > 
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-03 Thread amyroh
amyroh  2003/01/03 11:47:01

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  More error-prone approach.
  
  Revision  ChangesPath
  1.34  +6 -9  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- StandardServer.java   3 Jan 2003 01:59:08 -   1.33
  +++ StandardServer.java   3 Jan 2003 19:47:01 -   1.34
  @@ -824,11 +824,8 @@
   } else if (c == '"') {
   filtered.append(""");
   } else if (c == '&') {
  -char s1 = input.charAt(i+3);
  -char s2 = input.charAt(i+4);
  -char s3 = input.charAt(i+5);
  -if (((s1 == ';') || (s2 == ';')) || (s3 == ';')) {
  -// do not convert if it's already in converted form
  +int j = input.indexOf(";", i);
  +if (j > 0) {
   filtered.append(c);
   } else {
   filtered.append("&");
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-03 Thread Christoph Seibert
Hi there,

I think there is a problem with the following fix:


amyroh  2003/01/02 17:59:09

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Fix for bugzilla 15762.

[...]

  diff -u -r1.32 -r1.33
  --- StandardServer.java	11 Sep 2002 14:19:33 -	1.32
  +++ StandardServer.java	3 Jan 2003 01:59:08 -	1.33
  @@ -824,7 +824,15 @@
   } else if (c == '"') {
   filtered.append(""");
   } else if (c == '&') {
  -filtered.append("&");
  +char s1 = input.charAt(i+3);
  +char s2 = input.charAt(i+4);
  +char s3 = input.charAt(i+5);
  +if (((s1 == ';') || (s2 == ';')) || (s3 == ';')) {
  +// do not convert if it's already in converted 
form
  +filtered.append(c);
  +} else {
  +filtered.append("&");
  +}
   } else {
   filtered.append(c);
   }

(Note: I haven't had a look at the surrounding code yet, so I have to
assume that 'i' is the position of 'c', that is the '&' character.)

This code assumes that character or entity references will not be
shorter than 4 characters (including the delimiters '&' and ';')
and no longer than 6. However, the XML specification does not in
any way define restrictions like that. For example, '&d;' is a
valid entity reference (assuming it was defined in the DTD). Worse,
character or entity references can have arbitrary length. For example,
' ' is a valid character reference to the ' ' (space)
character.

I'm sorry I don't have a better fix right now, but I assume one
would have to iterate through the characters following the '&'
until either a ';' is found or a character occurs that is not a legal
part of an entity reference name (or in the case of a character
reference, not one of [0-9] for decimal or [0-9a-fA-F] for
hexadecimal).

(Actually, I believe this wheel must already have been invented,
but with only looking at this code snippet, I don't really know.)

Ciao,
Christoph

--
--- Christoph Seibert   [EMAIL PROTECTED] ---
-- Farlon Dragon -==(UDIC)==-http://home.pages.de/~seibert/ --
- Who can possibly rule if no one-
- who wants to can be allowed to? - D. Adams, HHGTTG -


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2003-01-02 Thread amyroh
amyroh  2003/01/02 17:59:09

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Fix for bugzilla 15762.
  
  Revision  ChangesPath
  1.33  +14 -6 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- StandardServer.java   11 Sep 2002 14:19:33 -  1.32
  +++ StandardServer.java   3 Jan 2003 01:59:08 -   1.33
  @@ -824,7 +824,15 @@
   } else if (c == '"') {
   filtered.append(""");
   } else if (c == '&') {
  -filtered.append("&");
  +char s1 = input.charAt(i+3);
  +char s2 = input.charAt(i+4);
  +char s3 = input.charAt(i+5);
  +if (((s1 == ';') || (s2 == ';')) || (s3 == ';')) {
  +// do not convert if it's already in converted form
  +filtered.append(c);
  +} else {
  +filtered.append("&");
  +}
   } else {
   filtered.append(c);
   }
  @@ -1822,7 +1830,7 @@
   writer.print(' ');
   }
   writer.print("");
  -writer.print(value);
  +writer.print(convertStr(value));
   writer.println("");
   for (int j = 0; j < indent + 2; j++) {
   writer.print(' ');
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2002-07-10 Thread remm

remm2002/07/10 02:49:01

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  - Make sure the global resources are correctly initialized even if there is no
GlobalNamingResources element in the server.xml.
  
  Revision  ChangesPath
  1.30  +7 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- StandardServer.java   11 Jun 2002 19:41:23 -  1.29
  +++ StandardServer.java   10 Jul 2002 09:49:01 -  1.30
  @@ -218,6 +218,9 @@
   super();
   ServerFactory.setServer(this);
   
  +globalNamingResources = new NamingResources();
  +globalNamingResources.setContainer(this);
  +
   if (isUseNaming()) {
   if (namingContextListener == null) {
   namingContextListener = new NamingContextListener();
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2002-05-24 Thread remm

remm02/05/24 10:20:00

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  - Remove loop in import (the modern compiler doesn't like that, apparently).
  
  Revision  ChangesPath
  1.27  +4 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- StandardServer.java   22 May 2002 22:17:23 -  1.26
  +++ StandardServer.java   24 May 2002 17:20:00 -  1.27
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.26 2002/05/22 22:17:23 remm Exp $
  - * $Revision: 1.26 $
  - * $Date: 2002/05/22 22:17:23 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.27 2002/05/24 17:20:00 remm Exp $
  + * $Revision: 1.27 $
  + * $Date: 2002/05/24 17:20:00 $
*
* 
*
  @@ -107,7 +107,6 @@
   import org.apache.catalina.Service;
   import org.apache.catalina.Store;
   import org.apache.catalina.Valve;
  -import org.apache.catalina.core.StandardServer;
   import org.apache.catalina.core.StandardEngine;
   import org.apache.catalina.core.StandardHost;
   import org.apache.catalina.deploy.ApplicationParameter;
  @@ -132,7 +131,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.26 $ $Date: 2002/05/22 22:17:23 $
  + * @version $Revision: 1.27 $ $Date: 2002/05/24 17:20:00 $
*/
   
   public final class StandardServer
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2002-05-22 Thread remm

remm02/05/22 15:17:23

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  - Add back the code specific to the ServerLifecycleListener.
Otherwise, it wouldn't be part of the generated server.xml.
  
  Revision  ChangesPath
  1.26  +35 -35
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- StandardServer.java   21 May 2002 01:36:36 -  1.25
  +++ StandardServer.java   22 May 2002 22:17:23 -  1.26
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.25 2002/05/21 01:36:36 remm Exp $
  - * $Revision: 1.25 $
  - * $Date: 2002/05/21 01:36:36 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.26 2002/05/22 22:17:23 remm Exp $
  + * $Revision: 1.26 $
  + * $Date: 2002/05/22 22:17:23 $
*
* 
*
  @@ -132,7 +132,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.25 $ $Date: 2002/05/21 01:36:36 $
  + * @version $Revision: 1.26 $ $Date: 2002/05/22 22:17:23 $
*/
   
   public final class StandardServer
  @@ -192,7 +192,6 @@
   "org.apache.catalina.core.StandardContextValve",
   "org.apache.catalina.core.StandardEngineValve",
   "org.apache.catalina.core.StandardHostValve",
  -"org.apache.catalina.mbeans.ServerLifecycleListener",
   "org.apache.catalina.startup.ContextConfig",
   "org.apache.catalina.startup.EngineConfig",
   "org.apache.catalina.startup.HostConfig",
  @@ -202,6 +201,13 @@
   };
   
   
  +/**
  + * ServerLifecycleListener classname.
  + */
  +private static String SERVER_LISTENER_CLASS_NAME = 
  +"org.apache.catalina.mbeans.ServerLifecycleListener";
  +
  +
   //  Constructor
   
   
  @@ -1040,11 +1046,10 @@
   listeners = new LifecycleListener[0];
   }
   for (int i = 0; i < listeners.length; i++) {
  -/*
  -  if (listeners[i] instanceof ServerLifecycleListener) {
  -  continue;
  -  }
  -*/
  +if (listeners[i].getClass().getName().equals
  +(SERVER_LISTENER_CLASS_NAME)) {
  +continue;
  +}
   storeListener(writer, indent + 2, listeners[i]);
   }
   }
  @@ -1094,11 +1099,10 @@
   LifecycleListener listeners[] =
   ((Lifecycle) context).findLifecycleListeners();
   for (int i = 0; i < listeners.length; i++) {
  -/*
  -  if (listeners[i] instanceof ServerLifecycleListener) {
  -  continue;
  -  }
  -*/
  +if (listeners[i].getClass().getName().equals
  +(SERVER_LISTENER_CLASS_NAME)) {
  +continue;
  +}
   storeListener(writer, indent + 2, listeners[i]);
   }
   }
  @@ -1238,11 +1242,10 @@
   LifecycleListener listeners[] =
   ((Lifecycle) dcontext).findLifecycleListeners();
   for (int i = 0; i < listeners.length; i++) {
  -/*
  -  if (listeners[i] instanceof ServerLifecycleListener) {
  -  continue;
  -  }
  -*/
  +if (listeners[i].getClass().getName().equals
  +(SERVER_LISTENER_CLASS_NAME)) {
  +continue;
  +}
   storeListener(writer, indent + 2, listeners[i]);
   }
   }
  @@ -1398,11 +1401,10 @@
   LifecycleListener listeners[] =
   ((Lifecycle) engine).findLifecycleListeners();
   for (int i = 0; i < listeners.length; i++) {
  -/*
  -  if (listeners[i] instanceof ServerLifecycleListener) {
  -  continue;
  -  }
  -*/
  +if (listeners[i].getClass().getName().equals
  +(SERVER_LISTENER_CLASS_NAME)) {
  +continue;
  +}
   storeListener(writer, indent + 2, listeners[i]);
   }
   }
  @@ -1538,11 +1540,10 @@
   Lifec

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2002-01-31 Thread craigmcc

craigmcc02/01/31 13:20:00

  Modified:catalina/src/share/org/apache/catalina/connector/http Tag:
tomcat_40_branch HttpConnector.java
   catalina/src/share/org/apache/catalina/core Tag:
tomcat_40_branch StandardServer.java
  Log:
  Port enhancement to "address already in use" exceptions so show the
  port number (and optional IP address).
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.24.2.1  +16 -6 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java
  
  Index: HttpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
  retrieving revision 1.24
  retrieving revision 1.24.2.1
  diff -u -r1.24 -r1.24.2.1
  --- HttpConnector.java11 Sep 2001 17:33:02 -  1.24
  +++ HttpConnector.java31 Jan 2002 21:19:59 -  1.24.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
 1.24 2001/09/11 17:33:02 craigmcc Exp $
  - * $Revision: 1.24 $
  - * $Date: 2001/09/11 17:33:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
 1.24.2.1 2002/01/31 21:19:59 craigmcc Exp $
  + * $Revision: 1.24.2.1 $
  + * $Date: 2002/01/31 21:19:59 $
*
* 
*
  @@ -66,6 +66,7 @@
   
   
   import java.io.IOException;
  +import java.net.BindException;
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  @@ -96,7 +97,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.24 $ $Date: 2001/09/11 17:33:02 $
  + * @version $Revision: 1.24.2.1 $ $Date: 2002/01/31 21:19:59 $
*/
   
   
  @@ -943,14 +944,23 @@
   // If no address is specified, open a connection on all addresses
   if (address == null) {
   log(sm.getString("httpConnector.allAddresses"));
  -return (factory.createSocket(port, acceptCount));
  +try {
  +return (factory.createSocket(port, acceptCount));
  +} catch (BindException be) {
  +throw new BindException(be.getMessage() + ":" + port);
  +}
   }
   
   // Open a server socket on the specified address
   try {
   InetAddress is = InetAddress.getByName(address);
   log(sm.getString("httpConnector.anAddress", address));
  -return (factory.createSocket(port, acceptCount, is));
  +try {
  +return (factory.createSocket(port, acceptCount, is));
  +} catch (BindException be) {
  +throw new BindException(be.getMessage() + ":" + address
  ++ ":" + port);
  +}
   } catch (Exception e) {
   log(sm.getString("httpConnector.noAddress", address));
   return (factory.createSocket(port, acceptCount));
  
  
  
  No   revision
  
  
  No   revision
  
  
  1.12.2.1  +6 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- StandardServer.java   4 Sep 2001 19:19:48 -   1.12
  +++ StandardServer.java   31 Jan 2002 21:19:59 -  1.12.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.12 2001/09/04 19:19:48 craigmcc Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/09/04 19:19:48 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.12.2.1 2002/01/31 21:19:59 craigmcc Exp $
  + * $Revision: 1.12.2.1 $
  + * $Date: 2002/01/31 21:19:59 $
*
* 
*
  @@ -89,7 +89,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.12 $ $Date: 2001/09/04 19:19:48 $
  + * @version $Revision: 1.12.2.1 $ $Date: 2002/01/31 21:19:59 $
*/
   
   public final class StandardServer
  @@ -277,7 +277,8 @@
   new ServerSocket(port, 1,
InetAddress.getByName("127.0.0.1"));
   } catch (IOException e) {
  -System.err.println("StandardServer.awai

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2002-01-31 Thread Remy Maucherat

> > >   PR: Bugzilla #6130
> > >   Submitted by: Jon Stevens <[EMAIL PROTECTED]>
> >
> > +1 for the change.
> 
> Does that mean ok for 4.0.2 as well?

Nope, but +1 too. I don't see what anything it could break.

Remy


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2002-01-31 Thread Remy Maucherat

> craigmcc02/01/31 12:56:03
>
>   Modified:catalina/src/share/org/apache/catalina/connector/http
> HttpConnector.java
>catalina/src/share/org/apache/catalina/core
> StandardServer.java
>   Log:
>   Enhance the exception message produced when creating a server socket
>   fails (typically due to an "Address in use" situation) to include the
>   port number of the failed open.
>
>   Enhancements to the proposed patch include:
>   * If the socket is only for a particular IP address, report that also.
>   * Add a similar enhancement to the message for the shutdown port opening
> (although you will normally encounter an error on the connector before
> running in to this one).
>
>   PR: Bugzilla #6130
>   Submitted by: Jon Stevens <[EMAIL PROTECTED]>

+1 for the change.
Sorry Jon, I didn't have much time to apply it :-(

Remy


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2002-01-31 Thread craigmcc

craigmcc02/01/31 12:56:03

  Modified:catalina/src/share/org/apache/catalina/connector/http
HttpConnector.java
   catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Enhance the exception message produced when creating a server socket
  fails (typically due to an "Address in use" situation) to include the
  port number of the failed open.
  
  Enhancements to the proposed patch include:
  * If the socket is only for a particular IP address, report that also.
  * Add a similar enhancement to the message for the shutdown port opening
(although you will normally encounter an error on the connector before
running in to this one).
  
  PR: Bugzilla #6130
  Submitted by: Jon Stevens <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.30  +16 -6 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java
  
  Index: HttpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- HttpConnector.java20 Dec 2001 21:25:23 -  1.29
  +++ HttpConnector.java31 Jan 2002 20:56:03 -  1.30
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
 1.29 2001/12/20 21:25:23 remm Exp $
  - * $Revision: 1.29 $
  - * $Date: 2001/12/20 21:25:23 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
 1.30 2002/01/31 20:56:03 craigmcc Exp $
  + * $Revision: 1.30 $
  + * $Date: 2002/01/31 20:56:03 $
*
* 
*
  @@ -66,6 +66,7 @@
   
   
   import java.io.IOException;
  +import java.net.BindException;
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  @@ -102,7 +103,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.29 $ $Date: 2001/12/20 21:25:23 $
  + * @version $Revision: 1.30 $ $Date: 2002/01/31 20:56:03 $
*/
   
   
  @@ -972,14 +973,23 @@
   // If no address is specified, open a connection on all addresses
   if (address == null) {
   log(sm.getString("httpConnector.allAddresses"));
  -return (factory.createSocket(port, acceptCount));
  +try {
  +return (factory.createSocket(port, acceptCount));
  +} catch (BindException be) {
  +throw new BindException(be.getMessage() + ":" + port);
  +}
   }
   
   // Open a server socket on the specified address
   try {
   InetAddress is = InetAddress.getByName(address);
   log(sm.getString("httpConnector.anAddress", address));
  -return (factory.createSocket(port, acceptCount, is));
  +try {
  +return (factory.createSocket(port, acceptCount, is));
  +} catch (BindException be) {
  +throw new BindException(be.getMessage() + ":" + address +
  +":" + port);
  +}
   } catch (Exception e) {
   log(sm.getString("httpConnector.noAddress", address));
   return (factory.createSocket(port, acceptCount));
  
  
  
  1.21  +6 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- StandardServer.java   26 Jan 2002 00:02:16 -  1.20
  +++ StandardServer.java   31 Jan 2002 20:56:03 -  1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.20 2002/01/26 00:02:16 amyroh Exp $
  - * $Revision: 1.20 $
  - * $Date: 2002/01/26 00:02:16 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.21 2002/01/31 20:56:03 craigmcc Exp $
  + * $Revision: 1.21 $
  + * $Date: 2002/01/31 20:56:03 $
*
* 
*
  @@ -92,7 +92,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.20 $ $Date: 2002/01/26 00:02:16 $
  + * @version $Revision: 1.21 $ $Date: 2002/01/31 20:56:03 $
*/
   
   public final class StandardServer
  @@ -390,7 +390,8 @@
  

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-08-23 Thread craigmcc

craigmcc01/08/23 15:15:43

  Modified:catalina/src/share/org/apache/catalina Server.java
   catalina/src/share/org/apache/catalina/core
StandardServer.java
  Added:   catalina/src/share/org/apache/catalina ServerFactory.java
  Log:
  Add a singleton that will return the Server at the top of the component
  tree, without requiring a reference to any component in the tree.
  
  Revision  ChangesPath
  1.7   +8 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Server.java
  
  Index: Server.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Server.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Server.java   2001/07/22 21:02:45 1.6
  +++ Server.java   2001/08/23 22:15:43 1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Server.java,v 1.6 
2001/07/22 21:02:45 pier Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/07/22 21:02:45 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Server.java,v 1.7 
2001/08/23 22:15:43 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/08/23 22:15:43 $
*
* 
*
  @@ -85,9 +85,13 @@
* specified by the port property.  When a connection is accepted,
* the first line is read and compared with the specified shutdown command.
* If the command matches, shutdown of the server is initiated.
  + * 
  + * NOTE - The concrete implementation of this class should
  + * register the (singleton) instance with the ServerFactory
  + * class in its constructor(s).
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2001/07/22 21:02:45 $
  + * @version $Revision: 1.7 $ $Date: 2001/08/23 22:15:43 $
*/
   
   public interface Server {
  
  
  
  1.1  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/ServerFactory.java
  
  Index: ServerFactory.java
  ===
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/ServerFactory.java,v
 1.1 2001/08/23 22:15:43 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/08/23 22:15:43 $
   *
   * 
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *any, must include the following acknowlegement:
   *   "This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/)."
   *Alternately, this acknowlegement may appear in the software itself,
   *if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *Foundation" must not be used to endorse or promote products derived
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache"
   *nor may "Apache" appear in their names without prior written
   *permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contr

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-08-21 Thread craigmcc

craigmcc01/08/21 13:22:28

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Randomize the pad addition (forgot to save from my editor before
  committing last time).
  
  Revision  ChangesPath
  1.10  +13 -15
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardServer.java   2001/08/21 19:35:36 1.9
  +++ StandardServer.java   2001/08/21 20:22:28 1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.9 2001/08/21 19:35:36 craigmcc Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/08/21 19:35:36 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.10 2001/08/21 20:22:28 craigmcc Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/08/21 20:22:28 $
*
* 
*
  @@ -71,6 +71,7 @@
   import java.net.ServerSocket;
   import java.net.Socket;
   import java.security.AccessControlException;
  +import java.util.Random;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleException;
  @@ -87,7 +88,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.9 $ $Date: 2001/08/21 19:35:36 $
  + * @version $Revision: 1.10 $ $Date: 2001/08/21 20:22:28 $
*/
   
   public final class StandardServer
  @@ -117,6 +118,13 @@
   
   
   /**
  + * A random number generator that is only used if
  + * the shutdown command string is longer than 1024 characters.
  + */
  +private Random random = null;
  +
  +
  +/**
* The set of Services associated with this Server.
*/
   private Service services[] = new Service[0];
  @@ -278,24 +286,14 @@
   System.exit(1);
   }
   
  -boolean localAddress = isSameAddress(socket.getLocalAddress(),
  - socket.getInetAddress());
  -if (!localAddress) {
  -System.err.println("Invalid shutdown connection from " +
  -   socket.getInetAddress() + " ignored");
  -try {
  -socket.close();
  -} catch (IOException e) {
  -;
  -}
  -continue;
  -}
  -
   // Read a set of characters from the socket
   StringBuffer command = new StringBuffer();
   int expected = 1024; // Cut off to avoid DoS attack
  -while (expected < shutdown.length())
  -expected += 1024;
  +while (expected < shutdown.length()) {
  +if (random == null)
  +random = new Random(System.currentTimeMillis());
  +expected += (random.nextInt() % 1024);
  +}
   while (expected > 0) {
   int ch = -1;
   try {
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-08-21 Thread craigmcc

craigmcc01/08/21 12:35:36

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Strengthen the previous fix (that avoids a DoS attack) by not exposing the
  length of the shutdown command password to an attacker.  Thanks to Justin
  Erenkrantz <[EMAIL PROTECTED]> for pointing this out.
  
  Also, modify the server socket to *only* accept connections from the local
  host, rather than accepting all connections and filtering out
  non-localhost ones later.
  
  Revision  ChangesPath
  1.9   +10 -6 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardServer.java   2001/08/21 18:51:52 1.8
  +++ StandardServer.java   2001/08/21 19:35:36 1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.8 2001/08/21 18:51:52 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/08/21 18:51:52 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.9 2001/08/21 19:35:36 craigmcc Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/08/21 19:35:36 $
*
* 
*
  @@ -87,7 +87,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2001/08/21 18:51:52 $
  + * @version $Revision: 1.9 $ $Date: 2001/08/21 19:35:36 $
*/
   
   public final class StandardServer
  @@ -250,7 +250,9 @@
   // Set up a server socket to wait on
   ServerSocket serverSocket = null;
   try {
  -serverSocket = new ServerSocket(port, 1);
  +serverSocket =
  +new ServerSocket(port, 1,
  + InetAddress.getByName("127.0.0.1"));
   } catch (IOException e) {
   System.err.println("StandardServer.await: create: " + e);
   e.printStackTrace();
  @@ -291,7 +293,9 @@
   
   // Read a set of characters from the socket
   StringBuffer command = new StringBuffer();
  -int expected = shutdown.length();
  +int expected = 1024; // Cut off to avoid DoS attack
  +while (expected < shutdown.length())
  +expected += 1024;
   while (expected > 0) {
   int ch = -1;
   try {
  
  
  



Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-08-21 Thread Justin Erenkrantz

On Tue, Aug 21, 2001 at 06:51:52PM -, [EMAIL PROTECTED] wrote:
> craigmcc01/08/21 11:51:52
> 
>   Modified:catalina/src/share/org/apache/catalina/core
> StandardServer.java
>   Log:
>   Fix for a DoS attack against the shutdown port, that could cause an "out
>   of memory" exception by sending a continuous stream of characters.  Now,
>   Tomcat will only listen for enough characters to match or not-match the
>   required password, then it shuts the port.

Now I'll know exactly how long the shutdown password is.  =-)  -- justin




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-08-21 Thread craigmcc

craigmcc01/08/21 11:51:52

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Fix for a DoS attack against the shutdown port, that could cause an "out
  of memory" exception by sending a continuous stream of characters.  Now,
  Tomcat will only listen for enough characters to match or not-match the
  required password, then it shuts the port.
  
  PR: Bugzilla #3210
  Submitted by: Mike Price <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.8   +8 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardServer.java   2001/07/22 20:25:08 1.7
  +++ StandardServer.java   2001/08/21 18:51:52 1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.7 2001/07/22 20:25:08 pier Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/07/22 20:25:08 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.8 2001/08/21 18:51:52 craigmcc Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/08/21 18:51:52 $
*
* 
*
  @@ -87,7 +87,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.7 $ $Date: 2001/07/22 20:25:08 $
  + * @version $Revision: 1.8 $ $Date: 2001/08/21 18:51:52 $
*/
   
   public final class StandardServer
  @@ -289,9 +289,10 @@
   continue;
   }
   
  -// Read a line of characters from the socket
  +// Read a set of characters from the socket
   StringBuffer command = new StringBuffer();
  -while (true) {
  +int expected = shutdown.length();
  +while (expected > 0) {
   int ch = -1;
   try {
   ch = stream.read();
  @@ -303,6 +304,7 @@
   if (ch < 32)  // Control character or EOF terminates loop
   break;
   command.append((char) ch);
  +expected--;
   }
   
   // Close the socket now that we are done with it
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-03-31 Thread glenn

glenn   01/03/31 07:26:21

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Oops, fix logging of error
  
  Revision  ChangesPath
  1.5   +5 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardServer.java   2001/03/31 15:21:55 1.4
  +++ StandardServer.java   2001/03/31 15:26:21 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.4 2001/03/31 15:21:55 glenn Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/03/31 15:21:55 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.5 2001/03/31 15:26:21 glenn Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/03/31 15:26:21 $
*
* 
*
  @@ -87,7 +87,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2001/03/31 15:21:55 $
  + * @version $Revision: 1.5 $ $Date: 2001/03/31 15:26:21 $
*/
   
   public final class StandardServer
  @@ -253,7 +253,7 @@
socket.setSoTimeout(10 * 1000);  // Ten seconds
stream = socket.getInputStream();
   } catch (AccessControlException ace) {
  -log("socket accept security exception: " + ace.getMessage());
  +System.err.println("StandardServer.accept security exception: " + 
ace.getMessage());
   continue;
} catch (IOException e) {
System.err.println("StandardServer.await: accept: " + e);
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-03-31 Thread glenn

glenn   01/03/31 07:21:55

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Ensure socket ignores and logs SocketPermission AccessControlException's
  
  Revision  ChangesPath
  1.4   +8 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardServer.java   2001/02/07 01:08:58 1.3
  +++ StandardServer.java   2001/03/31 15:21:55 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.3 2001/02/07 01:08:58 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/02/07 01:08:58 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.4 2001/03/31 15:21:55 glenn Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/03/31 15:21:55 $
*
* 
*
  @@ -70,6 +70,7 @@
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  +import java.security.AccessControlException;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleException;
  @@ -86,7 +87,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/02/07 01:08:58 $
  + * @version $Revision: 1.4 $ $Date: 2001/03/31 15:21:55 $
*/
   
   public final class StandardServer
  @@ -251,6 +252,9 @@
socket = serverSocket.accept();
socket.setSoTimeout(10 * 1000);  // Ten seconds
stream = socket.getInputStream();
  +} catch (AccessControlException ace) {
  +log("socket accept security exception: " + ace.getMessage());
  +continue;
} catch (IOException e) {
System.err.println("StandardServer.await: accept: " + e);
e.printStackTrace();
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-02-06 Thread craigmcc

craigmcc01/02/06 17:08:59

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Correct the loop control for the reversed test variation.
  
  Submitted by: John Li <[EMAIL PROTECTED]>
  PR: 401
  
  Revision  ChangesPath
  1.3   +5 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardServer.java   2000/09/30 19:15:45 1.2
  +++ StandardServer.java   2001/02/07 01:08:58 1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.2 2000/09/30 19:15:45 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/09/30 19:15:45 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.3 2001/02/07 01:08:58 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/02/07 01:08:58 $
*
* 
*
  @@ -86,7 +86,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/09/30 19:15:45 $
  + * @version $Revision: 1.3 $ $Date: 2001/02/07 01:08:58 $
*/
   
   public final class StandardServer
  @@ -390,7 +390,7 @@
return (true);
   
// Compare the reversed form of the two addresses
  - for (int i = 0; serverAddr.length < 4; i++) {
  + for (int i = 0; i < serverAddr.length; i++) {
if (serverAddr[i] != clientAddr[(serverAddr.length-1)-i])
return (false);
}
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]