You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/06/20 07:36:20 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config AutoWebApp.java

costin      01/06/19 22:36:20

  Modified:    src/share/org/apache/tomcat/modules/config AutoWebApp.java
  Log:
  Fix for 2199 - dot files added as webapps. Most of the time dot files are
  special, and may contain private info - it's better to be safe and disable
  by default.
  
  It's an option, so you can re-enable if you like .dirs as webapps.
  
  Revision  Changes    Path
  1.4       +13 -1     jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoWebApp.java
  
  Index: AutoWebApp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoWebApp.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AutoWebApp.java	2001/02/06 06:42:01	1.3
  +++ AutoWebApp.java	2001/06/20 05:36:20	1.4
  @@ -85,6 +85,7 @@
       String appsD="webapps";
       String defaultHost=null; 
       boolean flat=true;
  +    boolean ignoreDot=true;
   
       // encoding scheme - XXX review, customize, implement
       char hostSeparator='@'; // if support for vhost configuration is enabled
  @@ -117,6 +118,12 @@
   	defaultHost=h;
       }
   
  +    /** Ignore directories starting with a "."
  +     */
  +    public void setIngoreDot( boolean b ) {
  +	ignoreDot=b;
  +    }
  +    
   
       /** Not implemented - default is true. If flat==false, virtual
   	hosts will be configured using the hierarchy in webapps.
  @@ -166,6 +173,8 @@
   	if( flat ) {
   	    for (int i = 0; i < list.length; i++) {
   		String name = list[i];
  +		if( ignoreDot && name.startsWith( "." ))
  +		    continue;
   		File f=new File( webappD, name );
   		if( f.isDirectory() ) {
   		    String appHost=defaultHost;
  @@ -188,7 +197,10 @@
   		String name = list[i];
   		File f=new File( webappD, name );
   		if( f.isDirectory() ) {
  -		    addVHost( cm, webappD, name );
  +		    if( ignoreDot && name.statsWith("." )) {
  +			continue;
  +		    } else
  +			addVHost( cm, webappD, name );
   		}
   	    }
   	}