tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade RequestDispatcherImpl.java ServletContextFacade.java
Date Sat, 13 Oct 2001 04:22:51 GMT
costin      01/10/12 21:22:51

  Modified:    src/facade22/org/apache/tomcat/facade
                        RequestDispatcherImpl.java
                        ServletContextFacade.java
  Log:
  Fix 4114 ( with Larry's blessing ). We need to pass the right context in
  doPriviledged(), which is trusted. The previous code was passing the
  context of the caller, which was untrusted.
  
  Revision  Changes    Path
  1.24      +6 -4      jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java
  
  Index: RequestDispatcherImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/RequestDispatcherImpl.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- RequestDispatcherImpl.java	2001/09/20 03:38:15	1.23
  +++ RequestDispatcherImpl.java	2001/10/13 04:22:51	1.24
  @@ -127,11 +127,13 @@
   
       // name dispatchers
       String name;
  -
  +    private Object accessControlContext=null;
  +    
       /** Used for Context.getRD( path )
        */
  -    public RequestDispatcherImpl(Context context) {
  +    public RequestDispatcherImpl(Context context, Object acc) {
           this.context = context;
  +	accessControlContext=acc;
       }
   
       public void setPath( String urlPath ) {
  @@ -164,7 +166,7 @@
   	if( System.getSecurityManager() != null ) {
   	    try {
   		forwardAction.prepare( request, response );
  -		jdk11Compat.doPrivileged( forwardAction, jdk11Compat.getAccessControlContext() );
  +		jdk11Compat.doPrivileged( forwardAction, accessControlContext );
   	    } catch( Exception e) {
   		wrapException( e, null );
   	    }
  @@ -179,7 +181,7 @@
   	if( System.getSecurityManager() != null ) {
   	    try {
   		includeAction.prepare( request, response );
  -		jdk11Compat.doPrivileged( includeAction, jdk11Compat.getAccessControlContext() );
  +		jdk11Compat.doPrivileged( includeAction, accessControlContext );
   	    } catch( Exception e) {
   		wrapException( e, null );
   	    }
  
  
  
  1.7       +11 -3     jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletContextFacade.java
  
  Index: ServletContextFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletContextFacade.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ServletContextFacade.java	2001/08/03 02:35:56	1.6
  +++ ServletContextFacade.java	2001/10/13 04:22:51	1.7
  @@ -63,6 +63,7 @@
   import org.apache.tomcat.core.*;
   import org.apache.tomcat.util.res.StringManager;
   import org.apache.tomcat.util.io.FileUtil;
  +import org.apache.tomcat.util.compat.*;
   import java.io.*;
   import java.net.*;
   import java.util.*;
  @@ -84,10 +85,17 @@
       private StringManager sm = StringManager.getManager("org.apache.tomcat.resources");
       private ContextManager contextM;
       private Context context;
  -
  +    Jdk11Compat jdk11Compat=Jdk11Compat.getJdkCompat();
  +    Object accessControlContext=null;
  +    
       ServletContextFacade(ContextManager server, Context context) {
           this.contextM = server;
           this.context = context;
  +	try {
  +	    accessControlContext=jdk11Compat.getAccessControlContext();
  +	} catch( Exception ex) {
  +	    ex.printStackTrace();
  +	}
       }
   
       Context getRealContext() {
  @@ -175,7 +183,7 @@
   	if ( path == null  || ! path.startsWith("/")) {
   	    return null; // spec say "return null if we can't return a dispather
   	}
  -	RequestDispatcherImpl rD=new RequestDispatcherImpl( context );
  +	RequestDispatcherImpl rD=new RequestDispatcherImpl( context, accessControlContext);
   	rD.setPath( path );
   	
   	return rD;
  @@ -189,7 +197,7 @@
   	Handler wrapper = context.getServletByName( name );
   	if (wrapper == null)
   	    return null;
  -	RequestDispatcherImpl rD=new RequestDispatcherImpl( context );
  +	RequestDispatcherImpl rD=new RequestDispatcherImpl( context, accessControlContext );
   	rD.setName( name );
   
   	return rD;
  
  
  

Mime
View raw message