Author: eric
Date: Sun Apr 14 13:42:44 2013
New Revision: 1467776

URL: http://svn.apache.org/r1467776
Log:
Better protection against Denial-of-Service, patch contributed by Andrzej Rusin 
(JAMES-1427)

Added:
    
james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java

Added: 
james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java?rev=1467776&view=auto
==============================================================================
--- 
james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java
 (added)
+++ 
james/server/trunk/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java
 Sun Apr 14 13:42:44 2013
@@ -0,0 +1,40 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.smtpserver.fastfail;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import 
org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+
+public class MaxUnknownCmdHandler extends 
org.apache.james.protocols.smtp.core.fastfail.MaxUnknownCmdHandler implements 
InitializingLifecycleAwareProtocolHandler {
+
+    @Override
+    public void init(Configuration config) throws ConfigurationException {
+        int maxUnknown = config.getInt("maxUnknownCmdCount", 
DEFAULT_MAX_UNKOWN);
+        setMaxUnknownCmdCount(maxUnknown);        
+    }
+
+    @Override
+    public void destroy() {
+        // nothing todo
+        
+    }
+}
+



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to