Thx Noel,

so i remembered it right. I just did a commit in the sandbox to throw an
ConfigurationException on startup when an unimplemented command was used
to configure the command handler. I think thats a great improvment
( also to the current handler loading) to get sure that an admin can not
misconfigure the smtphandlerchain.

bye
Norman

Am Montag, den 03.07.2006, 16:11 -0400 schrieb Noel J. Bergman:
> > attached are notes for Norman
> 
> Below ...
> 
>       --- Noel
> 
> -------------------------------------------------------------------------
> 
> loop:
> handler.call(session)
> if (session.responseCode != 0) break;
> endloop
> 
> while handler.call(session) != false handler = next();
> 
> 
> interface CommandsHandler {
>     Map getCommands();
> }
> 
> 
> MyHandler implements ConnectionHandler, CommandsHandler, MessageHandler {
> 
>       onConnection(...) { do onConnection processing }
>       onMessage(...) { do onMessage processing }
>       Map getCommands(...) {
>               mailFromCmd = new CommandHandler() {
>                       onCommand(...) {
>                               do MAIL FROM processing
>                       }
>               }
>               rcptCmd = new CommandHandler() {
>                       onCommand(...) {
>                               do RCPT TO processing
>                       }
>               }
> 
>               map.add("MAIL", mailFromCmd);
>               map.add ("RCPT", rcptCmd);
>               return map;
>       }
> 
> }
> 
> 
> NormanHeloFilter implements CommandHandler {
>       onCommand(...) {
>               if (session.getCurrentCommand() == "HELO") { do HELO processing}
>               else if (session.getCurrentCommand() == "EHLO") { do slighly 
> different
> EHLO processing }
>               else log ("This command handler does not IMPLEMENT " +
> session.getCurrentCommand() + ".  Please fix.");
>         }
> }
> 
> 
> SPFHandler implements CommandHandler, MessageHandler {
>       onCommand(SMTPSession) { ...
> session.getState().put("org.apache.james.jspf.header", ...); }
>       onMessage(SMTPSession) { ... add header to message ... }
> }
> 
> 
> <handlerClain>
> 
>   <maxmessagesize>
>   <verifyIdentity>
> 
>   <attribute name="maxmessagesize" value"0"/>
>   <attribute name="heloEhloEnforcement" value="true"/>
>   <attribute name="verifyIdentity" value="true" />
> 
>   <handler class="org.apache.james.smtpserver.SyntaxChecker"/>
>   <handler.class="org.apache.james.smtpserver.rbldnschecker">
>      <rblservers>
>         <whitelist> query.bondedsender.org </whitelist>
>         <blacklist> sbl-xbl.spamhaus.org </blacklist>
>         <blacklist> list.dsbl.org </blacklist>
>         <blacklist> dul.dnsbl.sorbs.net </blacklist>
>         <blacklist> relays.ordb.org </blacklist>
>      </rblservers>
>   </handler>
>   <handler class="de.norman.NormanHeloFilter" onCommand="HELO,EHLO"/>
>   <handler class="org.apache.james.smtpserver.spfHandler" onCommand="MAIL">
>      <attribute name="softfail" value="true"/>
>   </handler>
>   <handler class="org.apache.james.smtpserver.basecommands"/>
> </handlerChain>
> 
> 
> 
> 
> chainBuilder:
> 
> aHandler = class.newInstance();
> 
> if (aHandler instanceof ConnectionHandler) add to connection handler chain
> if (aHandler instanceof MessageHandler) add to message handler chain
> if (aHandler instanceof CommandsHandlers) {
>       get commands
>       loop through commands
>       for each command, add to that command's handler chain
> }
> if (aHandler instance of CommandHandler) {
>       get list of commands
>       add handler to each chain
> }
> 
> 
> MyHandler implements ConnectionHandler, CommandHandlers {
> 
>       onConnection(...) { INIT THE SESSION }
>       Map getCommands(...) { ... }
> }
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> !EXCUBATOR:1,44a97a1148531651610094!

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to