Norman Maurer wrote: > Noel J. Bergman wrote: >>> private void checkValidRcpt(SMTPSession session) { >>> MailAddress rcpt = session.getState().getSMTPSession.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. > Can you explain a bit more ? I not understand what exactly you want to do.
Well, we can optimize the order for performance, but for clarity, I had in mind something like: if ((mapping && map(rcpt) != null) // there is a valid mapping // or there is a local POP3 box of this name // --- BUT IT COULD BE WRONG, so allow disabling || (useRepository && (session.getConfigurationData().getUsersRepository().contains(rcpt.getUser() ) == true)) // explicit, and most likely fake, recipient, e.g., a mailing list address || (recipients != null && recipients.contains(rcpt.toString().toLowerCase())) // explicit domain, e.g., one for which we merely forward || (domains != null && domains.contains(rcpt.getHost().toLowerCase()))) { invalidUser = false; } NOTA BENE: the mapping code needs to make be aware of "error:" and similar strings that can be in the target field, and do NOT imply a successful mapping. We might want to restructure the code to keep the mapping result so that we don't need to map it again in the pipeline, although we don't want to expose the mapping in the Received: header we'll generate. Therefore, perhaps it would be best to put virtual mapping into a RCPT handler that is inserted in the handler chain before the ValidRcptHandler, and which can short-circuit the chain in the event of an invalid recipient. --- Noel --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]