james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1143792 - /james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
Date Thu, 07 Jul 2011 12:27:30 GMT
Author: norman
Date: Thu Jul  7 12:27:29 2011
New Revision: 1143792

URL: http://svn.apache.org/viewvc?rev=1143792&view=rev
Log:
The NetworkMatcher should get init in the init() method

Modified:
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java?rev=1143792&r1=1143791&r2=1143792&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
(original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPServer.java
Thu Jul  7 12:27:29 2011
@@ -83,12 +83,28 @@ public class SMTPServer extends Abstract
     private boolean verifyIdentity;
 
     private DNSService dns;
+    private String authorizedAddresses;
 
     @Resource(name = "dnsservice")
     public void setDNSService(DNSService dns) {
         this.dns = dns;
     }
     
+    @Override
+    protected void preInit() throws Exception {
+        if (authorizedAddresses != null) {
+            java.util.StringTokenizer st = new java.util.StringTokenizer(authorizedAddresses,
", ", false);
+            java.util.Collection<String> networks = new java.util.ArrayList<String>();
+            while (st.hasMoreTokens()) {
+                String addr = st.nextToken();
+                networks.add(addr);
+            }
+            authorizedNetworks = new NetMatcher(networks, dns);
+        }
+        super.preInit();
+    }
+
+    @Override
     public void doConfigure(final HierarchicalConfiguration configuration) throws ConfigurationException
{
         super.doConfigure(configuration);
         if (isEnabled()) {
@@ -105,7 +121,7 @@ public class SMTPServer extends Abstract
                 getLogger().info("This SMTP server does not require authentication.");
             }
 
-            String authorizedAddresses = configuration.getString("authorizedAddresses", null);
+            authorizedAddresses = configuration.getString("authorizedAddresses", null);
             if (authRequired == AUTH_DISABLED && authorizedAddresses == null) {
                 /*
                  * if SMTP AUTH is not required then we will use
@@ -123,16 +139,7 @@ public class SMTPServer extends Abstract
                 authorizedAddresses = "0.0.0.0/0.0.0.0";
             }
 
-            if (authorizedAddresses != null) {
-                java.util.StringTokenizer st = new java.util.StringTokenizer(authorizedAddresses,
", ", false);
-                java.util.Collection<String> networks = new java.util.ArrayList<String>();
-                while (st.hasMoreTokens()) {
-                    String addr = st.nextToken();
-                    networks.add(addr);
-                }
-                authorizedNetworks = new NetMatcher(networks, dns);
-            }
-
+          
             if (authorizedNetworks != null) {
                 getLogger().info("Authorized addresses: " + authorizedNetworks.toString());
             }



---------------------------------------------------------------------
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