Index: protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandler.java =================================================================== --- protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandler.java (revision 3494) +++ protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandler.java (revision 3495) @@ -27,7 +27,7 @@ import org.apache.james.protocols.smtp.hook.UnknownHook; /** - * {@link UnknownHook} implementation which disconnect the client after a issue to many unknown commands + * {@link UnknownHook} implementation which disconnect the client after a issue too many unknown commands * * */ @@ -36,7 +36,7 @@ public final static int DEFAULT_MAX_UNKOWN = 5; private final static String UNKOWN_COMMAND_COUNT = "UNKNOWN_COMMAND_COUNT"; - private int maxUnknown; + private int maxUnknown = DEFAULT_MAX_UNKOWN; public void setMaxUnknownCmdCount(int maxUnknown) { this.maxUnknown = maxUnknown; @@ -55,7 +55,7 @@ } session.setAttachment(UNKOWN_COMMAND_COUNT, count, State.Transaction); if (count > maxUnknown) { - return new HookResult(HookReturnCode.DENY | HookReturnCode.DISCONNECT, "521", "Closing connection as to many unknown commands received"); + return new HookResult(HookReturnCode.DENY | HookReturnCode.DISCONNECT, "521", "Closing connection as too many unknown commands received"); } else { Index: server/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java =================================================================== --- server/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java (revision 0) +++ server/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java (revision 3495) @@ -0,0 +1,39 @@ +/**************************************************************** + * 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 + + } +} Property changes on: server/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/MaxUnknownCmdHandler.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property