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/06/25 20:34:00 UTC
svn commit: r417037 - in /james/server/trunk/src: conf/james-config.xml
java/org/apache/james/smtpserver/SMTPHandler.java
java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java
java/org/apache/james/smtpserver/SMTPServer.java
Author: norman
Date: Sun Jun 25 11:33:59 2006
New Revision: 417037
URL: http://svn.apache.org/viewvc?rev=417037&view=rev
Log:
Make the smtpGreeting configurable
Modified:
james/server/trunk/src/conf/james-config.xml
james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandler.java
james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java
james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
Modified: james/server/trunk/src/conf/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/src/conf/james-config.xml?rev=417037&r1=417036&r2=417037&view=diff
==============================================================================
--- james/server/trunk/src/conf/james-config.xml (original)
+++ james/server/trunk/src/conf/james-config.xml Sun Jun 25 11:33:59 2006
@@ -902,6 +902,12 @@
<!--
<heloEhloEnforcement>true</heloEhloEnforcement>
-->
+
+ <!-- This sets the SMTPGreeting which will be used when connect to the smtpserver -->
+ <!-- If none is specified a default is generated -->
+ <!--
+ <smtpGreeting> JAMES SMTP Server </smtpGreeting>
+ -->
<!-- The configuration handler chain -->
<handlerchain>
Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandler.java?rev=417037&r1=417036&r2=417037&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandler.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandler.java Sun Jun 25 11:33:59 2006
@@ -130,6 +130,11 @@
private String blocklistedDetail = null;
/**
+ * The SMTPGreeting
+ */
+ private String smtpGreeting = null;
+
+ /**
* The id associated with this particular SMTP interaction.
*/
private String smtpID;
@@ -175,17 +180,24 @@
authRequired = theConfigData.isAuthRequired(remoteIP);
heloEhloEnforcement = theConfigData.useHeloEhloEnforcement();
sessionEnded = false;
+ smtpGreeting = theConfigData.getSMTPGreeting();
resetState();
- // Initially greet the connector
- // Format is: Sat, 24 Jan 1998 13:16:09 -0500
-
- responseBuffer.append("220 ")
- .append(theConfigData.getHelloName())
- .append(" SMTP Server (")
- .append(SOFTWARE_TYPE)
- .append(") ready ")
- .append(rfc822DateFormat.format(new Date()));
+ // if no greeting was configured use a default
+ if (smtpGreeting == null) {
+ // Initially greet the connector
+ // Format is: Sat, 24 Jan 1998 13:16:09 -0500
+
+ responseBuffer.append("220 ")
+ .append(theConfigData.getHelloName())
+ .append(" SMTP Server (")
+ .append(SOFTWARE_TYPE)
+ .append(") ready ")
+ .append(rfc822DateFormat.format(new Date()));
+ } else {
+ responseBuffer.append("220 ")
+ .append(smtpGreeting);
+ }
String responseString = clearResponseBuffer();
writeLoggedFlushedResponse(responseString);
Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java?rev=417037&r1=417036&r2=417037&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPHandlerConfigurationData.java Sun Jun 25 11:33:59 2006
@@ -87,6 +87,14 @@
* @return whether SMTP authentication is on
*/
boolean useHeloEhloEnforcement();
+
+
+ /**
+ * Return the SMTPGreeting which should used.
+ *
+ * @return the SMTPGreeting
+ */
+ String getSMTPGreeting();
/**
* Returns the MailServer interface for this service.
Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java?rev=417037&r1=417036&r2=417037&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java Sun Jun 25 11:33:59 2006
@@ -99,6 +99,11 @@
private boolean heloEhloEnforcement = false;
/**
+ * SMTPGreeting to use
+ */
+ private String smtpGreeting = null;
+
+ /**
* This is a Network Matcher that should be configured to contain
* authorized networks that bypass SMTP AUTH requirements.
*/
@@ -214,6 +219,9 @@
heloEhloEnforcement = handlerConfiguration.getChild("heloEhloEnforcement").getValueAsBoolean(true);
if (authRequiredString.equals("true")) authRequired = AUTH_REQUIRED;
+
+ // get the smtpGreeting
+ smtpGreeting = handlerConfiguration.getChild("smtpGreeting").getValue(null);
//set the logger
ContainerUtil.enableLogging(handlerChain,getLogger());
@@ -400,6 +408,14 @@
*/
public boolean useHeloEhloEnforcement() {
return SMTPServer.this.heloEhloEnforcement;
+ }
+
+
+ /**
+ * @see org.apache.james.smtpserver.SMTPHandlerConfigurationData#getSMTPGreeting()
+ */
+ public String getSMTPGreeting() {
+ return SMTPServer.this.smtpGreeting;
}
//TODO: IF we create here an interface to get DNSServer
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org