public DNSLookupContinuation checkSPF()

in resolver/src/main/java/org/apache/james/jspf/policies/InitialChecksPolicy.java [44:72]


    public DNSLookupContinuation checkSPF(SPFSession spfData)
            throws PermErrorException, TempErrorException, NeutralException,
            NoneException {
        SPF1Record res = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
        if (res == null) {

            // Initial checks (spec 4.3)
            String currentDomain = spfData.getCurrentDomain();
            if (currentDomain != null) {
                String[] labels = currentDomain.split("\\.");
                for (int i = 0; i < labels.length; i++) {
                    if (labels[i] != null && labels[i].length() > 63) {
                        throw new NoneException("Domain "+currentDomain+" is malformed (label longer than 63 characters)");
                    }
                }
            }
            
            if (spfData.getSenderDomain().indexOf('.') < 0) {
                throw new NoneException("Sender domain "+spfData.getSenderDomain()+" is not an FQDN.");
            }
            
            try {
                Name.fromString(spfData.getSenderDomain());
            } catch (TextParseException e) {
                throw new NoneException("Invalid sender domain: "+e.getMessage());
            }
        }
        return null;
    }