Examples of PermErrorException


Examples of org.apache.james.jspf.exceptions.PermErrorException

            }
            // Remove Macro code so that r macro code does not clash with r the
            // reverse modifier
            replaceValue = replaceValue.substring(1);
        } else {
            throw new PermErrorException("MacroLetter not found: "+replaceValue);
        }

        // Find number of domains to use
        cellPattern = Pattern.compile("\\d+");
        cellMatcher = cellPattern.matcher(replaceValue);
        while (cellMatcher.find()) {
            domainNumber = cellMatcher.group();
            if (Integer.parseInt(domainNumber) == 0) {
                throw new PermErrorException(
                        "Digit transformer must be non-zero");
            }
        }
        // find if reversed
        cellPattern = Pattern.compile("r");
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

        } else if (variable.equalsIgnoreCase("r")) {
            rValue = macroData.getReceivingDomain();
        }

        if (rValue == null) {
            throw new PermErrorException("Unknown command : " + variable);

        } else {
            log.debug("Used macro: " + macro + " replaced with: " + rValue);

            return rValue;
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

            }
        // PermError / TempError
        // TODO: Should we replace this with the "right" Exceptions ?
        } catch (Exception e) {
            log.debug("No valid ipAddress: ",e);
            throw new PermErrorException("No valid ipAddress: "
                    + spfData.getIpAddress());
        }
        // No match found
        return false;
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

    public synchronized void config(Configuration params) throws PermErrorException {
        super.config(params);
        if (params.groupCount() >= 2 && params.group(2) != null) {
            ip4cidr = Integer.parseInt(params.group(2));
            if (ip4cidr > 32) {
                throw new PermErrorException("Ivalid IP4 CIDR length");
            }
        } else {
            ip4cidr = 32;
        }
        if (params.groupCount() >= 3 && params.group(3) != null) {
            ip6cidr = Integer.parseInt(params.group(3).toString());
            if (ip6cidr > 128) {
                throw new PermErrorException("Ivalid IP6 CIDR length");
            }
        } else {
            ip6cidr = 128;
        }
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

        try {
            // get the in Address
            this.inAddress = IPAddr.getInAddress(clientIP);
        } catch (PermErrorException e) {
            // throw an exception cause the ip was not rfc conform
            throw new PermErrorException(e.getMessage());
        }

        // setup the data!
        setupData(mailFrom, hostName);
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

     * SPF-RFC Section 10.1. Processing Limits
     */
    public void increaseCurrentDepth() throws PermErrorException {
        this.currentDepth++;
        if (currentDepth > MAX_DEPTH)
            throw new PermErrorException(
                    "Maximum mechanism/modifiers calls done: "
                        + currentDepth);
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

    /**
     * @see org.apache.james.jspf.terms.GenericMechanism#config(Configuration)
     */
    public synchronized void config(Configuration params) throws PermErrorException {
        if (params.groupCount() == 0) {
            throw new PermErrorException("Missing ip");
        }
        String ipString = params.group(1);
        if (!isValidAddress(ipString)) {
            throw new PermErrorException("Invalid Address: " + ipString);
        }
        int maskLength = getMaxCidr();
        if (params.groupCount() >= 2 && params.group(2) != null) {
            String maskLengthString = params.group(2);
            maskLength = Integer.parseInt(maskLengthString);

            if (maskLength > getMaxCidr() || (maskLengthString.length() > 1 && maskLengthString.startsWith("0"))) {
                throw new PermErrorException("Invalid CIDR: " + maskLengthString);
            }
        }
        ip = IPAddr.getAddress(ipString, maskLength);
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

           
            try {
                 spfChecker.checkSPF(spfData);
             
            } catch (NoneException e) {
                throw new PermErrorException("included checkSPF returned NoneException");
            } catch (NeutralException e) {
                throw new PermErrorException("included checkSPF returned NeutralException");
            }
           
            if (spfData.getCurrentResult() == null) {
                throw new TempErrorException("included checkSPF returned null");
            } else if (spfData.getCurrentResult().equals(SPF1Constants.PASS)) {
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

    /**
     * @see org.apache.james.jspf.core.Configurable#config(Configuration)
     */
    public synchronized void config(Configuration params) throws PermErrorException {
        if (params.groupCount() == 0) {
            throw new PermErrorException("Include mechanism without an host");
        }
        host = params.group(1);
    }
View Full Code Here

Examples of org.apache.james.jspf.exceptions.PermErrorException

            // We trim the compare value only for the comparison
            if (compare.toLowerCase().trim().startsWith(SPF1Constants.SPF_VERSION + " ") || compare.trim().equalsIgnoreCase(SPF1Constants.SPF_VERSION)) {
                if (returnValue == null) {
                    returnValue = compare;
                } else {
                    throw new PermErrorException(
                            "More than 1 SPF record found");
                }
            }
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.