You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2006/07/02 18:44:21 UTC

svn commit: r418616 - in /james/server/sandbox/handlerapi/src: conf/ java/org/apache/james/smtpserver/ java/org/apache/james/smtpserver/basefilter/

Author: norman
Date: Sun Jul  2 09:44:21 2006
New Revision: 418616

URL: http://svn.apache.org/viewvc?rev=418616&view=rev
Log:
Add fastfail filters

Modified:
    james/server/sandbox/handlerapi/src/conf/james-config.xml
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java

Modified: james/server/sandbox/handlerapi/src/conf/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/conf/james-config.xml?rev=418616&r1=418615&r2=418616&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/conf/james-config.xml (original)
+++ james/server/sandbox/handlerapi/src/conf/james-config.xml Sun Jul  2 09:44:21 2006
@@ -932,7 +932,61 @@
             -->            
             
             <!-- The command handler configuration -->
+            
+            <!-- The basic command handler checks -->
             <handler class="org.apache.james.smtpserver.core.BaseFilterCmdHandler"></handler>
+            
+            <!-- The filter handler configuration -->
+
+            <!-- checks for resolvable HELO/EHLO before accept the HELO/EHLO -->
+            <!-- If checkAuthNetworks is set to true sender domain will be checked also for clients that -->
+            <!-- are allowed to relay. Default is false. -->
+            <!--
+            <handler class="org.apache.james.smtpserver.fastfailfilter.ResolvableEhloHeloHandler" command="EHLO,HELO">
+                 <checkAuthNetworks> false </checkAuthNetworks>
+            </handler>  
+            -->
+            
+            <!-- Checks HELO/EHLO is equal the reverse of the connecting client before accept it -->
+            <!-- If checkAuthNetworks is set to true sender domain will be checked also for clients that -->
+            <!-- are allowed to relay. Default is false. -->
+            <!--
+            <handler class="org.apache.james.smtpserver.fastfailfilter.ReverseEqualsEhloHeloHandler" command="EHLO,HELO">
+                <checkAuthClients> false </checkAuthClients>
+            </handler>
+            -->
+            
+            <!-- If activated mail is only accepted if the sender contains -->
+            <!-- a resolvable domain having a valid MX Record or A Record associated! -->
+            <!-- If checkAuthNetworks is set to true sender domain will be checked also for clients that -->
+            <!-- are allowed to relay. Default is false. -->
+            <!--
+            <handler class="org.apache.james.smtpserver.fastfailfilter.ValidSenderDomainHandler" command="MAIL">
+                <checkAuthClients> false </checkAuthClients>
+            </handler>
+            -->
+            
+            <!-- If activated you can limit the maximal recipients -->
+            <!-- 
+            <handler class="org.apache.james.smtpserver.fastfailfilter.MaxRcptHandler" command="RCPT">
+                <maxRcpt> 10 </maxRcpt>                
+            </handler>
+            -->
+            
+            <!-- If is set to a bigger value as 0 you can set the recipients after which -->
+            <!-- tarpitting get activated. -->
+            <!-- Tarpitting is a method to insert a small sleep after each rcpt. For more -->
+            <!-- infos read this: http://www.palomine.net/qmail/tarpit.html . -->
+            <!-- Default is set to 0 (disabled). -->
+            <!-- You can also configure the time to sleep in milliseconds -->
+            <!--
+            <handler class="org.apache.james.smtpserver.fastfailfilter.TarpitHandler" command="RCPT">
+                <tarpitRcptCount> 5 </tarpitRcptCount>
+                 <tarpitSleepTime> 5000 </tarpitSleepTime>
+            </handler>
+            -->
+            
+            <!-- The basic command handlers -->
             <handler class="org.apache.james.smtpserver.core.BaseCmdHandler"></handler>
             
             <!-- The message handler configuration -->

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java?rev=418616&r1=418615&r2=418616&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandler.java Sun Jul  2 09:44:21 2006
@@ -270,7 +270,7 @@
                   ((CommandHandler)commandHandlers.get(i)).onCommand(this);
                   theWatchdog.reset();
                   //if the response is received, stop processing of command handlers
-                  if(mode != COMMAND_MODE) {
+                  if(mode != COMMAND_MODE || getState().get(SMTPSession.STOP_HANDLER_PROCESSING) != null) {
                       
                       // remove the blockin state
                       getState().remove(SMTPSession.STOP_HANDLER_PROCESSING);

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java?rev=418616&r1=418615&r2=418616&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/SMTPHandlerChain.java Sun Jul  2 09:44:21 2006
@@ -235,10 +235,15 @@
         // if it is a command handler add it to the map with key as command name
         if (handler instanceof CommandHandler) {
             String commandName = config.getAttribute("command");
-            commandName = commandName.toUpperCase(Locale.US);
-            addToMap(commandName, (CommandHandler) handler);
-            if (getLogger().isInfoEnabled()) {
-                getLogger().info("Added Commandhandler: " + className);
+            String cmds[] = commandName.split(",");
+
+            for (int i = 0; i < cmds.length; i++) {
+                commandName = cmds[i].trim().toUpperCase(Locale.US);
+                addToMap(commandName, (CommandHandler) handler);
+                if (getLogger().isInfoEnabled()) {
+                    getLogger().info("Added Commandhandler: " + className);
+                }
+
             }
 
         }

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java?rev=418616&r1=418615&r2=418616&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java (original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/basefilter/EhloBaseFilterCmdHandler.java Sun Jul  2 09:44:21 2006
@@ -54,8 +54,6 @@
             
             // After this filter match we should not call any other handler!
             session.getState().put(SMTPSession.STOP_HANDLER_PROCESSING, "true");
-            return;
-            
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org