james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r418488 - in /james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver: EhloCmdHandler.java HeloCmdHandler.java MailCmdHandler.java RcptCmdHandler.java
Date Sat, 01 Jul 2006 16:21:04 GMT
Author: norman
Date: Sat Jul  1 09:20:59 2006
New Revision: 418488

URL: http://svn.apache.org/viewvc?rev=418488&view=rev
Log:
Remove filter commands from core handler

Modified:
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java
    james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java?rev=418488&r1=418487&r2=418488&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
(original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
Sat Jul  1 09:20:59 2006
@@ -17,106 +17,21 @@
 
 package org.apache.james.smtpserver;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
+import java.util.ArrayList;
+
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.james.services.DNSServer;
 import org.apache.james.util.mail.dsn.DSNStatus;
 
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-
 /**
   * Handles EHLO command
   */
-public class EhloCmdHandler extends AbstractLogEnabled implements CommandHandler,Configurable,
 Serviceable {
+public class EhloCmdHandler extends AbstractLogEnabled implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler
      */
     private final static String COMMAND_NAME = "EHLO";
 
-    /**
-     * set checkResolvableEhlo to false as default value
-     */
-    private boolean checkResolvableEhlo = false;
-
-    private boolean checkReverseEqualsEhlo = false;
-    
-    private boolean checkAuthNetworks = false;
-    
-    private DNSServer dnsServer = null;
-    
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration handlerConfiguration) throws ConfigurationException
{
-        Configuration configuration = handlerConfiguration.getChild("checkResolvableEhlo",false);
-        if(configuration != null) {
-           setCheckResolvableEhlo(configuration.getValueAsBoolean(false));
-        }
-        
-        Configuration config = handlerConfiguration.getChild(
-                "checkReverseEqualsEhlo", false);
-        if (config != null) {
-            setCheckReverseEqualsEhlo(config.getValueAsBoolean(false));
-        }
-        
-        Configuration configRelay = handlerConfiguration.getChild("checkAuthNetworks",false);
-        if(configRelay != null) {
-            setCheckAuthNetworks(configRelay.getValueAsBoolean(false));
-        }
-    }
-    
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
-     */
-    public void service(ServiceManager serviceMan) throws ServiceException {
-        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
-    }
-    
-    /**
-     * Set to true to enable check for resolvable EHLO
-     * 
-     * @param checkResolvableEhlo Set to true for enable check
-     */
-    public void setCheckResolvableEhlo(boolean checkResolvableEhlo) {
-        this.checkResolvableEhlo = checkResolvableEhlo;
-    }
-    
-    /**
-     * Set to true to enable check for reverse equal EHLO
-     * 
-     * @param checkReverseEqualsEhlo
-     *            Set to true for enable check
-     */
-    public void setCheckReverseEqualsEhlo(boolean checkReverseEqualsEhlo) {
-        this.checkReverseEqualsEhlo = checkReverseEqualsEhlo;
-    }
-
-    /**
-     * Set to true if AuthNetworks should be included in the EHLO check
-     * 
-     * @param checkAuthNetworks
-     *            Set to true to enable
-     */
-    public void setCheckAuthNetworks(boolean checkAuthNetworks) {
-        this.checkAuthNetworks = checkAuthNetworks;
-    }
-    
-    /**
-     * Set the DNSServer
-     * 
-     * @param dnsServer The DNSServer
-     */
-    public void setDnsServer(DNSServer dnsServer) {
-        this.dnsServer = dnsServer;
-    }
-
     /*
      * processes EHLO command
      *
@@ -137,60 +52,12 @@
     private void doEHLO(SMTPSession session, String argument) {
         String responseString = null;
         StringBuffer responseBuffer = session.getResponseBuffer();
-        boolean badEhlo = false;
-        
-        /**
-         * don't check if the ip address is allowed to relay. Only check if it
-         * is set in the config. ed.
-         */
-        if (!session.isRelayingAllowed() || checkAuthNetworks) {
-            // check for resolvable EHLO if its set in config
-            if (checkResolvableEhlo) {
-                // try to resolv the provided helo. If it can not resolved do not accept
it.
-                try {
-                    dnsServer.getByName(argument);
-                } catch (UnknownHostException e) {
-                    badEhlo = true;
-                    responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+"
Provided EHLO " + argument + " can not resolved";
-                    session.writeResponse(responseString);
-                    getLogger().info(responseString);
-                }
-            } else if (checkReverseEqualsEhlo) {
-                try {
-                    // get reverse entry
-                    String reverse = dnsServer.getByName(
-                            session.getRemoteIPAddress()).getHostName();
-
-                    if (!argument.equals(reverse)) {
-                        badEhlo = true;
-                        responseString = "501 "
-                                + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                                        DSNStatus.DELIVERY_INVALID_ARG)
-                                + " Provided EHLO " + argument
-                                + " not equal reverse of "
-                                + session.getRemoteIPAddress();
-
-                        session.writeResponse(responseString);
-                        getLogger().info(responseString);
-                    }
-                } catch (UnknownHostException e) {
-                    badEhlo = true;
-                    responseString = "501 "
-                            + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                                    DSNStatus.DELIVERY_INVALID_ARG)
-                            + " Ipaddress " + session.getRemoteIPAddress()
-                            + " can not resolved";
-
-                    session.writeResponse(responseString);
-                    getLogger().info(responseString);
-                }
-            }
-        }
         
+     
         if (argument == null) {
             responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+"
Domain address required: " + COMMAND_NAME;
             session.writeResponse(responseString);
-        } else if (!badEhlo){
+        } else {
             session.resetState();
             session.getState().put(SMTPSession.CURRENT_HELO_MODE, COMMAND_NAME);
 

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java?rev=418488&r1=418487&r2=418488&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
(original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/HeloCmdHandler.java
Sat Jul  1 09:20:59 2006
@@ -18,104 +18,18 @@
 package org.apache.james.smtpserver;
 
 
-import java.net.UnknownHostException;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.james.services.DNSServer;
-import org.apache.james.util.mail.dsn.DSNStatus;
 
 
 /**
   * Handles HELO command
   */
-public class HeloCmdHandler extends AbstractLogEnabled implements CommandHandler,Configurable,
Serviceable {
+public class HeloCmdHandler extends AbstractLogEnabled implements CommandHandler {
 
     /**
      * The name of the command handled by the command handler
      */
     private final static String COMMAND_NAME = "HELO";
-
-    /**
-     * set checkValidHelo to false as default value
-     */
-    private boolean checkResolvableHelo = false;
-    
-    private boolean checkReverseEqualsHelo = false;
-    
-    private boolean checkAuthNetworks = false;
-    
-    private DNSServer dnsServer = null;
-    
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration handlerConfiguration) throws ConfigurationException
{
-        Configuration configuration = handlerConfiguration.getChild("checkResolvableHelo",false);
-        if(configuration != null) {
-           setCheckResolvableHelo(configuration.getValueAsBoolean(false));
-        }
-          
-        Configuration config = handlerConfiguration.getChild(
-                "checkReverseEqualsHelo", false);
-        if (config != null) {
-            setCheckReverseEqualsHelo(config.getValueAsBoolean(false));
-        }
-        
-        Configuration configRelay = handlerConfiguration.getChild("checkAuthNetworks",false);
-        if(configRelay != null) {
-            setCheckAuthNetworks(configRelay.getValueAsBoolean(false));
-        }
-        
-    }
-    
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
-     */
-    public void service(ServiceManager serviceMan) throws ServiceException {
-        dnsServer = (DNSServer) serviceMan.lookup(DNSServer.ROLE);
-    }
-    
-    /**
-     * Set to true to enable check for resolvable EHLO
-     * 
-     * @param checkResolvableHelo Set to true for enable check
-     */
-    public void setCheckResolvableHelo(boolean checkResolvableHelo) {
-        this.checkResolvableHelo = checkResolvableHelo;
-    }
-    
-    /**
-     * Set to true to enable check for reverse equal HELO
-     * 
-     * @param checkReverseEqualsHelo
-     *            Set to true for enable check
-     */
-    public void setCheckReverseEqualsHelo(boolean checkReverseEqualsHelo) {
-        this.checkReverseEqualsHelo = checkReverseEqualsHelo;
-    }
-
-    /**
-     * Set to true if AuthNetworks should be included in the EHLO check
-     * 
-     * @param checkAuthNetworks Set to true to enable
-     */
-    public void setCheckAuthNetworks(boolean checkAuthNetworks) {
-        this.checkAuthNetworks = checkAuthNetworks;
-    }
-    
-    /**
-     * Set the DNSServer
-     * 
-     * @param dnsServer The DNSServer
-     */
-    public void setDnsServer(DNSServer dnsServer) {
-        this.dnsServer = dnsServer;
-    }
       
     /*
      * process HELO command
@@ -136,64 +50,12 @@
      */
     private void doHELO(SMTPSession session, String argument) {
         String responseString = null;
-        boolean badHelo = false;
-                
-        /**
-         * don't check if the ip address is allowed to relay. Only check if it is set in
the config. ed.
-         */
-        if (!session.isRelayingAllowed() || checkAuthNetworks) {
-
-            // check for resolvable HELO if its set in config
-            if (checkResolvableHelo) {
-            
-
-                // try to resolv the provided helo. If it can not resolved do not accept
it.
-                try {
-                    dnsServer.getByName(argument);
-                } catch (UnknownHostException e) {
-                    badHelo = true;
-                    responseString = "501 Provided HELO " + argument + " can not resolved";
-                    session.writeResponse(responseString);
-                    getLogger().info(responseString);
-                } 
-
-            } else if (checkReverseEqualsHelo) {
-                try {
-                    // get reverse entry
-                    String reverse = dnsServer.getByName(
-                            session.getRemoteIPAddress()).getHostName();
-
-                    if (!argument.equals(reverse)) {
-                        badHelo = true;
-                        responseString = "501 "
-                                + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                                        DSNStatus.DELIVERY_INVALID_ARG)
-                                + " Provided HELO " + argument
-                                + " not equal reverse of "
-                                + session.getRemoteIPAddress();
-
-                        session.writeResponse(responseString);
-                        getLogger().info(responseString);
-                    }
-                } catch (UnknownHostException e) {
-                    badHelo = true;
-                    responseString = "501 "
-                            + DSNStatus.getStatus(DSNStatus.PERMANENT,
-                                    DSNStatus.DELIVERY_INVALID_ARG)
-                            + " Ipaddress " + session.getRemoteIPAddress()
-                            + " can not resolved";
-
-                    session.writeResponse(responseString);
-                    getLogger().info(responseString);
-                }
-            }
-        }
-        
+              
         if (argument == null) {
             responseString = "501 Domain address required: " + COMMAND_NAME;
             session.writeResponse(responseString);
             getLogger().info(responseString);
-        } else if (!badHelo) {
+        } else {
             session.resetState();
             session.getState().put(SMTPSession.CURRENT_HELO_MODE, COMMAND_NAME);
             session.getResponseBuffer().append("250 ")

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java?rev=418488&r1=418487&r2=418488&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java
(original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/MailCmdHandler.java
Sat Jul  1 09:20:59 2006
@@ -17,89 +17,23 @@
 
 package org.apache.james.smtpserver;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
+import java.util.Locale;
+import java.util.StringTokenizer;
+
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.james.services.DNSServer;
 import org.apache.james.util.mail.dsn.DSNStatus;
 import org.apache.mailet.MailAddress;
 
-import java.util.Collection;
-import java.util.Locale;
-import java.util.StringTokenizer;
-
 /**
   * Handles MAIL command
   */
 public class MailCmdHandler
     extends AbstractLogEnabled
-    implements CommandHandler,Configurable, Serviceable {
+    implements CommandHandler {
 
     private final static String MAIL_OPTION_SIZE = "SIZE";
 
     private final static String MESG_SIZE = "MESG_SIZE"; // The size of the message
-
-    private boolean checkValidSenderDomain = false;
-    
-    private boolean checkAuthClients = false;
-    
-    private DNSServer dnsServer = null;
-    
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration handlerConfiguration) throws ConfigurationException
{
-        Configuration configuration = handlerConfiguration.getChild("checkValidSenderDomain",false);
-        if(configuration != null) {
-           setCheckValidSenderDomain(configuration.getValueAsBoolean(false));
-           if (checkValidSenderDomain && dnsServer == null) {
-               throw new ConfigurationException("checkValidSenderDomain enabled but no DNSServer
service provided to SMTPServer");
-           }
-        }
-        
-        Configuration configRelay = handlerConfiguration.getChild("checkAuthClients",false);
-        if(configRelay != null) {
-            setCheckAuthClients(configRelay.getValueAsBoolean(false));
-        }
-    }
-    
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(ServiceManager)
-     */
-    public void service(ServiceManager serviceMan) throws ServiceException {
-        setDnsServer((DNSServer) serviceMan.lookup(DNSServer.ROLE));
-    }
-    
-    /**
-     * Set the DnsServer
-     * 
-     * @param dnsServer The DnsServer
-     */
-    public void setDnsServer(DNSServer dnsServer) {
-        this.dnsServer = dnsServer;
-    }
-    
-    /**
-     * Enable checkvalidsenderdomain feature
-     * 
-     * @param checkValidSenderDomain Set to true to enable
-     */
-    public void setCheckValidSenderDomain(boolean checkValidSenderDomain) {
-        this.checkValidSenderDomain = checkValidSenderDomain;
-    }
-    
-    /**
-     * Enable checking of authorized clients
-     * 
-     * @param checkAuthClients Set to true to enable
-     */
-    public void setCheckAuthClients(boolean checkAuthClients) {
-        this.checkAuthClients = checkAuthClients;
-    }
     
     /**
      * handles MAIL command
@@ -122,7 +56,6 @@
         String responseString = null;
         StringBuffer responseBuffer = session.getResponseBuffer();
         String sender = null;
-        boolean badSenderDomain = false;
         
         if ((argument != null) && (argument.indexOf(":") > 0)) {
             int colonIndex = argument.indexOf(":");
@@ -223,39 +156,14 @@
                     return;
                 }
             }
+         
             
-            if (checkValidSenderDomain == true) {
-                
-                /**
-                 * don't check if the ip address is allowed to relay. Only check if it is
set in the config. 
-                 */
-                if (checkAuthClients || !session.isRelayingAllowed()) {
-     
-                    // Maybe we should build a static method in org.apache.james.dnsserver.DNSServer
?
-                    Collection records;
-                
-                    records = dnsServer.findMXRecords(senderAddress.getHost());
-                    if (records == null || records.size() == 0) {
-                        badSenderDomain = true;
-                    }
-                
-                    // try to resolv the provided domain in the senderaddress. If it can
not resolved do not accept it.
-                    if (badSenderDomain) {
-                        responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.ADDRESS_SYNTAX_SENDER)+
" sender " + senderAddress + " contains a domain with no valid MX records";
-                        session.writeResponse(responseString);
-                        getLogger().info(responseString);
-                    }
-                }
-            }
-            
-            if (!badSenderDomain) {
-                session.getState().put(SMTPSession.SENDER, senderAddress);
-                responseBuffer.append("250 "+DSNStatus.getStatus(DSNStatus.SUCCESS,DSNStatus.ADDRESS_OTHER)+"
Sender <")
-                              .append(sender)
-                              .append("> OK");
-                responseString = session.clearResponseBuffer();
-                session.writeResponse(responseString);
-            }
+            session.getState().put(SMTPSession.SENDER, senderAddress);
+            responseBuffer.append("250 "+DSNStatus.getStatus(DSNStatus.SUCCESS,DSNStatus.ADDRESS_OTHER)+"
Sender <")
+                          .append(sender)
+                          .append("> OK");
+            responseString = session.clearResponseBuffer();
+            session.writeResponse(responseString);
         }
     }
 

Modified: james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java?rev=418488&r1=418487&r2=418488&view=diff
==============================================================================
--- james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java
(original)
+++ james/server/sandbox/handlerapi/src/java/org/apache/james/smtpserver/RcptCmdHandler.java
Sat Jul  1 09:20:59 2006
@@ -17,81 +17,21 @@
 
 package org.apache.james.smtpserver;
 
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Locale;
+import java.util.StringTokenizer;
+
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.james.util.mail.dsn.DSNStatus;
 import org.apache.mailet.MailAddress;
-import java.util.Collection;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-import java.util.Locale;
 
 /**
   * Handles RCPT command
   */
-public class RcptCmdHandler
-    extends AbstractLogEnabled
-    implements CommandHandler,Configurable {
+public class RcptCmdHandler extends AbstractLogEnabled implements
+        CommandHandler {
 
-    /**
-     * The keys used to store sender and recepients in the SMTPSession state
-     */
-    private final static String RCPTCOUNT = "RCPT_COUNT";
-    private int maxRcpt = 0;
-    private int tarpitRcptCount = 0;
-    private long tarpitSleepTime = 5000;
-    
-    /**
-     * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
-     */
-    public void configure(Configuration handlerConfiguration) throws ConfigurationException
{
-        Configuration configuration = handlerConfiguration.getChild("maxRcpt",false);
-        if(configuration != null) {
-           setMaxRcpt(configuration.getValueAsInteger(0));
-        }
-        
-        Configuration configTarpitRcptCount = handlerConfiguration.getChild("tarpitRcptCount",false);
-        if(configTarpitRcptCount != null) {
-           setTarpitRcptCount(configTarpitRcptCount.getValueAsInteger(0));
-        }
-        
-        Configuration configTarpitSleepTime = handlerConfiguration.getChild("tarpitSleepTime",false);
-        if(configTarpitSleepTime != null) {
-           setTarpitSleepTime(configTarpitSleepTime.getValueAsLong(5000));
-        }
-    }
-    
-    /**
-     * Set the max rcpt for wich should be accepted
-     *  
-     * @param maxRcpt The max rcpt count
-     */
-    public void setMaxRcpt(int maxRcpt) {
-        this.maxRcpt = maxRcpt;
-    }
-    
-    /**
-     * Set the tarpit count after which the tarpit sleep time will be activated
-     * 
-     * @param tarpitRcptCount
-     */
-    public void setTarpitRcptCount(int tarpitRcptCount) {
-        this.tarpitRcptCount = tarpitRcptCount;
-    }
-    
-    /**
-     * Set the tarpit sleep time 
-     * 
-     * @param tarpitSleepTime Time in milliseconds
-     */
-    public void setTarpitSleepTime(long tarpitSleepTime) {
-        this.tarpitSleepTime = tarpitSleepTime;
-    }
-    
-    
-    
     /*
      * handles RCPT command
      *
@@ -113,8 +53,6 @@
     private void doRCPT(SMTPSession session, String argument) {
         String responseString = null;
         StringBuffer responseBuffer = session.getResponseBuffer();
-        boolean maxRcptReached = false;
-        boolean useTarpit = false;
         
         String recipient = null;
         if ((argument != null) && (argument.indexOf(":") > 0)) {
@@ -280,58 +218,16 @@
               }
               optionTokenizer = null;
             }
+    
             
-            // check if we should check for max recipients
-            if (maxRcpt > 0) {
-                int rcptCount = 0;
-            
-                // check if the key exists
-                rcptCount = getRcptCount(session);
-                
-                rcptCount++;
-        
-                // check if the max recipients has reached
-                if (rcptCount > maxRcpt) {
-                    maxRcptReached = true;
-                    responseString = "452 "+DSNStatus.getStatus(DSNStatus.NETWORK,DSNStatus.DELIVERY_TOO_MANY_REC)+"
Requested action not taken: max recipients reached";
-                    session.writeResponse(responseString);
-                    getLogger().error(responseString);
-                }
-                
-                // put the recipient cound in session hashtable
-                session.getState().put(RCPTCOUNT,Integer.toString(rcptCount));
-            }
-            
-            // check if we should use tarpit
-            if (tarpitRcptCount > 0) {
-                int rcptCount = 0;
-                rcptCount = getRcptCount(session);
-                rcptCount++;
-                
-                if (rcptCount > tarpitRcptCount) {
-                    useTarpit = true;                   
-                }
-                
-                // put the recipient cound in session hashtable
-                session.getState().put(RCPTCOUNT,Integer.toString(rcptCount));
-                 
-            }
+            rcptColl.add(recipientAddress);
+            session.getState().put(SMTPSession.RCPT_LIST, rcptColl);
+            responseBuffer.append("250 "+DSNStatus.getStatus(DSNStatus.SUCCESS,DSNStatus.ADDRESS_VALID)+"
Recipient <")
+                          .append(recipient)
+                          .append("> OK");
+            responseString = session.clearResponseBuffer();
+            session.writeResponse(responseString);
             
-            if (maxRcptReached == false) {
-                rcptColl.add(recipientAddress);
-                session.getState().put(SMTPSession.RCPT_LIST, rcptColl);
-                responseBuffer.append("250 "+DSNStatus.getStatus(DSNStatus.SUCCESS,DSNStatus.ADDRESS_VALID)+"
Recipient <")
-                              .append(recipient)
-                              .append("> OK");
-                responseString = session.clearResponseBuffer();
-                
-                if (useTarpit == true) {
-                    try {
-                        sleep(tarpitSleepTime);
-                    } catch (InterruptedException e) { }
-                }
-                session.writeResponse(responseString);
-            }
         }
     }
 
@@ -348,22 +244,4 @@
         }
         return sb.toString();
     } 
-    
-    
-    private int getRcptCount(SMTPSession session) {
-        int startCount = 0;
-        
-        // check if the key exists
-        if (session.getState().get(RCPTCOUNT) != null) {
-            Integer rcptCountInteger = Integer.valueOf(session.getState().get(RCPTCOUNT).toString());
-            return rcptCountInteger.intValue();
-        } else {
-            return startCount;
-        }
-    }
-    
-    
-    public void sleep(float timeInMillis) throws InterruptedException {
-        Thread.sleep( (long) timeInMillis );
-    }
 }



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


Mime
View raw message