This is an automated email from the ASF dual-hosted git repository.

chibenwa pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-jspf.git

commit 92ffd7c3fa110667e48b4ff931456010e786e406
Author: Benoit TELLIER <[email protected]>
AuthorDate: Thu Nov 26 09:28:50 2026 +0100

    [PERF] DefaultExplanationPolicy: expand the default explanation once
    
    On every fail without an explanation, checkExpand expanded the default
    explanation and the ExplanationChecker it pushed expanded it a second time.
    Keep the first expansion, and push the checker only when %{p} needs the PTR
    lookup first.
---
 .../james/jspf/policies/local/DefaultExplanationPolicy.java       | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
 
b/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
index 62b8f12..cc78d1c 100644
--- 
a/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
+++ 
b/resolver/src/main/java/org/apache/james/jspf/policies/local/DefaultExplanationPolicy.java
@@ -87,8 +87,14 @@ public final class DefaultExplanationPolicy implements 
PolicyPostFilter {
                     } else {
                         explanation = defExplanation;
                     }
-                    
spfData.setAttribute(ATTRIBUTE_DEFAULT_EXPLANATION_POLICY_EXPLANATION, 
explanation);
                     try {
+                        String expanded = macroExpand.expand(explanation, 
spfData, MacroExpand.EXPLANATION);
+                        if (expanded != null) {
+                            spfData.setExplanation(expanded);
+                            return null;
+                        }
+                        // %{p} needs the PTR names of the client address 
first: expand again once they are known
+                        
spfData.setAttribute(ATTRIBUTE_DEFAULT_EXPLANATION_POLICY_EXPLANATION, 
explanation);
                         DNSLookupContinuation cont = 
macroExpand.checkExpand(explanation, spfData, MacroExpand.EXPLANATION);
                         spfData.pushChecker(explanationCheckr);
                         return cont;


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

Reply via email to