tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core LocalStrings.properties StandardContext.java StandardWrapper.java
Date Sat, 13 Oct 2001 01:38:46 GMT
remm        01/10/12 18:38:46

  Modified:    catalina/src/share/org/apache/catalina Context.java
               catalina/src/share/org/apache/catalina/core
                        LocalStrings.properties StandardContext.java
                        StandardWrapper.java
  Log:
  - Port the support for privileged contexts.
  
  Revision  Changes    Path
  1.18      +20 -5     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Context.java	2001/07/29 04:34:17	1.17
  +++ Context.java	2001/10/13 01:38:46	1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
1.17 2001/07/29 04:34:17 craigmcc Exp $
  - * $Revision: 1.17 $
  - * $Date: 2001/07/29 04:34:17 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Context.java,v
1.18 2001/10/13 01:38:46 remm Exp $
  + * $Revision: 1.18 $
  + * $Date: 2001/10/13 01:38:46 $
    *
    * ====================================================================
    *
  @@ -96,7 +96,7 @@
    * <p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.17 $ $Date: 2001/07/29 04:34:17 $
  + * @version $Revision: 1.18 $ $Date: 2001/10/13 01:38:46 $
    */
   
   public interface Context extends Container {
  @@ -309,9 +309,24 @@
       /**
        * Set the override flag for this web application.
        *
  -     * @param overried The new override flag
  +     * @param override The new override flag
        */
       public void setOverride(boolean override);
  +
  +
  +    /**
  +     * Return the privileged flag for this web application.
  +     */
  +    public boolean getPrivileged();
  +
  +
  +    /**
  +     * Set the privileged flag for this web application.
  +     * 
  +     * @param privileged The new privileged flag
  +     */
  +    public void setPrivileged(boolean privileged);
  +
   
       /**
        * Return the servlet context for which this Context is a facade.
  
  
  
  1.39      +1 -0      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/LocalStrings.properties,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- LocalStrings.properties	2001/09/26 17:51:52	1.38
  +++ LocalStrings.properties	2001/10/13 01:38:46	1.39
  @@ -142,6 +142,7 @@
   standardWrapper.notClass=No servlet class has been specified for servlet {0}
   standardWrapper.notContext=Parent container of a Wrapper must be a Context
   standardWrapper.notServlet=Class {0} is not a Servlet
  +standardWrapper.privilegedServlet=Servlet of class {0} is privileged and cannot be loaded
by this web application
   standardWrapper.releaseFilters=Release filters exception for servlet {0}
   standardWrapper.serviceException=Servlet.service() for servlet {0} threw exception
   standardWrapper.statusHeader=HTTP Status {0} - {1}
  
  
  
  1.83      +36 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- StandardContext.java	2001/10/10 00:55:22	1.82
  +++ StandardContext.java	2001/10/13 01:38:46	1.83
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.82 2001/10/10 00:55:22 remm Exp $
  - * $Revision: 1.82 $
  - * $Date: 2001/10/10 00:55:22 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
1.83 2001/10/13 01:38:46 remm Exp $
  + * $Revision: 1.83 $
  + * $Date: 2001/10/13 01:38:46 $
    *
    * ====================================================================
    *
  @@ -142,7 +142,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.82 $ $Date: 2001/10/10 00:55:22 $
  + * @version $Revision: 1.83 $ $Date: 2001/10/13 01:38:46 $
    */
   
   public class StandardContext
  @@ -370,6 +370,12 @@
   
   
       /**
  +     * The privileged flag for this web application.
  +     */
  +    private boolean privileged = false;
  +
  +
  +    /**
        * Should the next call to <code>addWelcomeFile()</code> cause replacement
        * of any existing welcome files?  This will be set before processing the
        * web application's deployment descriptor, so that application specified
  @@ -937,6 +943,32 @@
       public boolean getOverride() {
   
           return (this.override);
  +
  +    }
  +
  +
  +    /**
  +     * Return the privileged flag for this web application.
  +     */
  +    public boolean getPrivileged() {
  +
  +        return (this.privileged);
  +
  +    }
  +
  +
  +    /**
  +     * Set the privileged flag for this web application.
  +     * 
  +     * @param privileged The new privileged flag
  +     */
  +    public void setPrivileged(boolean privileged) {
  +
  +        boolean oldPrivileged = this.privileged;
  +        this.privileged = privileged;
  +        support.firePropertyChange("privileged",
  +                                   new Boolean(oldPrivileged),
  +                                   new Boolean(this.privileged));
   
       }
   
  
  
  
  1.32      +32 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
  
  Index: StandardWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- StandardWrapper.java	2001/10/11 23:30:58	1.31
  +++ StandardWrapper.java	2001/10/13 01:38:46	1.32
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
1.31 2001/10/11 23:30:58 craigmcc Exp $
  - * $Revision: 1.31 $
  - * $Date: 2001/10/11 23:30:58 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
1.32 2001/10/13 01:38:46 remm Exp $
  + * $Revision: 1.32 $
  + * $Date: 2001/10/13 01:38:46 $
    *
    * ====================================================================
    *
  @@ -105,7 +105,7 @@
    * make them efficient are counter-productive.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.31 $ $Date: 2001/10/11 23:30:58 $
  + * @version $Revision: 1.32 $ $Date: 2001/10/13 01:38:46 $
    */
   
   public final class StandardWrapper
  @@ -830,6 +830,14 @@
                   (sm.getString("standardWrapper.instantiate", actualClass), e);
           }
   
  +        // Check if loading the servlet in this web application should be 
  +        // allowed
  +        if (!isServletAllowed(servlet)) {
  +            throw new SecurityException
  +                (sm.getString("standardWrapper.privilegedServlet", 
  +                              actualClass));
  +        }
  +
           // Special handling for ContainerServlet instances
           if ((servlet instanceof ContainerServlet) &&
               isContainerServlet(actualClass)) {
  @@ -1110,6 +1118,26 @@
               return (true);
           else
               return (false);
  +
  +    }
  +
  +
  +    /**
  +     * Return <code>true</code> if loading this servlet is allowed.
  +     */
  +    private boolean isServletAllowed(Object servlet) {
  +
  +        if (servlet instanceof ContainerServlet) {
  +            if (((Context) getParent()).getPrivileged() 
  +                || (servlet.getClass().getName().equals
  +                    ("org.apache.catalina.servlets.InvokerServlet"))) {
  +                return (true);
  +            } else {
  +                return (false);
  +            }
  +        }
  +
  +        return (true);
   
       }
   
  
  
  

Mime
View raw message