Author: norman
Date: Mon May 31 19:56:29 2010
New Revision: 949850

URL: http://svn.apache.org/viewvc?rev=949850&view=rev
Log:
Respect VirtualHosting on SenderAuthIdentifyVerification

Modified:
    
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractSenderAuthIdentifyVerificationRcptHook.java

Modified: 
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractSenderAuthIdentifyVerificationRcptHook.java
URL: 
http://svn.apache.org/viewvc/james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractSenderAuthIdentifyVerificationRcptHook.java?rev=949850&r1=949849&r2=949850&view=diff
==============================================================================
--- 
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractSenderAuthIdentifyVerificationRcptHook.java
 (original)
+++ 
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractSenderAuthIdentifyVerificationRcptHook.java
 Mon May 31 19:56:29 2010
@@ -29,7 +29,7 @@ import org.apache.james.protocols.smtp.h
 import org.apache.mailet.MailAddress;
 
 /**
- * Handler which check if the authenticated user is incorrect or correct
+ * Handler which check if the authenticated user is the same as the one used 
as MAIL FROM
  */
 public abstract class AbstractSenderAuthIdentifyVerificationRcptHook 
implements RcptHook {  
     /**
@@ -43,8 +43,14 @@ public abstract class AbstractSenderAuth
             MailAddress senderAddress = (MailAddress) session.getState().get(
                     SMTPSession.SENDER);
 
+            String username;
+            if (useVirtualHosting()) {
+                username = senderAddress.toString();
+            } else {
+                username = senderAddress.getLocalPart();
+            }
             if ((senderAddress == null)
-                    || (!authUser.equals(senderAddress.getLocalPart()))
+                    || (!authUser.equals(username))
                     || (!isLocalDomain(senderAddress.getDomain()))) {
                 return new HookResult(HookReturnCode.DENY, 
                         SMTPRetCode.BAD_SEQUENCE,
@@ -64,5 +70,13 @@ public abstract class AbstractSenderAuth
      * @return isLocal
      */
     protected abstract boolean isLocalDomain(String domain);
+    
+    /**
+     * Return true if virtualHosting should get used. If so the full email 
address will get used to 
+     * match against the supplied auth username
+     * 
+     * @return useVirtualHosting
+     */
+    protected abstract boolean useVirtualHosting();
 
 }



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

Reply via email to