I like this addition, which is one that I've wanted for a while, but ...

> +     <!-- 
> +     <handler 
> class="org.apache.james.smtpserver.core.filter.fastfail.ValidRcptHandler" 
> command="MAIL">
> +         <validRecipients> </validRecipients>

See below, but my thesis is that the user will exist either as a local user, or 
has a valid mapping.  We could leave this, I suppose, to support mappings that 
are done via other than virtual user tables.

> +         <validDomains> </validDomains>

We already know the valid domains, since we have already declared for which 
domains we accept mail.  Document that these are domains for which we may not 
be able to know about valid addresses, e.g., for domains to which we simply 
forward, so we accept e-mail for ANY address at these domains.

> +         <validRegexPattern> </validRegexPattern>

We should add support for AbstractVirtualUserTable, which would mean allowing 
the configuration for XMLVirtualUserTable to what you already have for 
JDBCVirtualUserTable.  See james-config.xml as well as the two mailets.

> +    public void onCommand(SMTPSession session) {
> +        if (!session.isRelayingAllowed() && !(session.isAuthRequired() && 
> session.getUser() != null)) {
> +            checkValidRcpt(session);
> +        } else {
> +            getLogger().debug("Sender allowed to relay");

Huh?  "Sender allowed to relay"?  What does this have to do with relaying?

> +    private void checkValidRcpt(SMTPSession session) {
> +        MailAddress rcpt = (MailAddress) 
> session.getState().get(SMTPSession.CURRENT_RECIPIENT);
> +        boolean invalidUser = true;
> 
> +        if 
> (session.getConfigurationData().getUsersRepository().contains(rcpt.getUser()) 
> == true
>              || recipients.contains(rcpt.toString().toLowerCase())
>              || domains.contains(rcpt.getHost().toLowerCase())) {

Check to see if you are doing virtual user mapping, and map the user first; 
THEN do the check.  And if there is a valid mapping, then I would consider that 
to imply a valid user for remote purposes, so that we don't have to deal with 
adding domains for mapped forwarding addresses.

Hope these help.

        --- Noel



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to