This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 5a5db5f138a3b22c4833d860e8017e6ac7af4c43 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Tue Jul 4 00:29:53 2023 +0700 JAMES-3920 Add todo once AsynchronousSPFExecutor is fixed --- .../test/java/org/apache/james/mailets/SPFIntegrationTests.java | 2 +- .../src/main/java/org/apache/james/transport/mailets/SPF.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SPFIntegrationTests.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SPFIntegrationTests.java index 3f1d71ff44..ebfdb0a2a5 100644 --- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SPFIntegrationTests.java +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/SPFIntegrationTests.java @@ -101,7 +101,7 @@ class SPFIntegrationTests { .addMailet(MailetConfiguration.builder() .matcher(All.class) .mailet(SPF.class) - .addProperty("checkLocalIps", "true")) + .addProperty("ignoreLocalIps", "false")) .addMailet(MailetConfiguration.builder() .matcher(HasMailAttributeWithValue.class) .matcherCondition("org.apache.james.transport.mailets.spf.result, softfail") diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/SPF.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/SPF.java index d215a73591..a6d9e4e5c9 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/SPF.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/SPF.java @@ -75,7 +75,7 @@ public class SPF extends GenericMailet { private boolean debug = false; private boolean addHeader = false; - private boolean ignoreLocalIps = false; + private boolean ignoreLocalIps = true; private org.apache.james.jspf.impl.SPF spf; public static final AttributeName EXPLANATION_ATTRIBUTE = AttributeName.of("org.apache.james.transport.mailets.spf.explanation"); public static final AttributeName RESULT_ATTRIBUTE = AttributeName.of("org.apache.james.transport.mailets.spf.result"); @@ -100,7 +100,7 @@ public class SPF extends GenericMailet { public void init() { debug = Boolean.parseBoolean(getInitParameter("debug", "false")); addHeader = Boolean.parseBoolean(getInitParameter("addHeader", "false")); - addHeader = Boolean.parseBoolean(getInitParameter("checkLocalIps", "false")); + ignoreLocalIps = Boolean.parseBoolean(getInitParameter("ignoreLocalIps", "true")); if (spfDnsService == null) { createSPF(new DNSServiceXBillImpl()); @@ -118,13 +118,14 @@ public class SPF extends GenericMailet { } private void createSPF(org.apache.james.jspf.core.DNSService dnsProbe) { + // TODO use once fixed AsynchronousSPFExecutor (see JAMES-3920) WiringServiceTable wiringService = new WiringServiceTable(); wiringService.put(DNSServiceEnabled.class, dnsProbe); MacroExpand macroExpand = new MacroExpand(dnsProbe); wiringService.put(MacroExpandEnabled.class, macroExpand); RFC4408SPF1Parser parser = new RFC4408SPF1Parser(new DefaultTermsFactory(wiringService)); SynchronousSPFExecutor executor = new SynchronousSPFExecutor(dnsProbe); - spf = new org.apache.james.jspf.impl.SPF(dnsProbe, parser, macroExpand,executor ); + spf = new org.apache.james.jspf.impl.SPF(dnsProbe, parser, macroExpand, executor); wiringService.put(SPFCheckEnabled.class, spf); } @@ -132,7 +133,7 @@ public class SPF extends GenericMailet { public void service(Mail mail) throws MessagingException { String remoteAddr = mail.getRemoteAddr(); - if (ignoreLocalIps || netMatcher.matchInetNetwork(remoteAddr)) { + if (ignoreLocalIps && netMatcher.matchInetNetwork(remoteAddr)) { LOGGER.debug("ignore SPF check for ip:{}", remoteAddr); } else { String helo = AttributeUtils.getValueAndCastFromMail(mail, Mail.SMTP_HELO, String.class).orElse(mail.getRemoteHost()); --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org