Package org.apache.james.jspf.core

Examples of org.apache.james.jspf.core.SPF1Record


         * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
            SPF1Record res = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            if (res == null) {
                res = policy.getSPFRecord(spfData.getCurrentDomain());
                spfData.setAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD, res);
            }
            return null;
View Full Code Here


         * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
            SPF1Record res = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            res = policy.getSPFRecord(spfData.getCurrentDomain(), res);
            spfData.setAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD, res);
            return null;
        }
View Full Code Here

         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
           
            SPF1Record spfRecord = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            // make sure we cleanup the record, for recursion support
            spfData.removeAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
           
            LinkedList<SPFChecker> policyCheckers = new LinkedList<SPFChecker>();
           
            Iterator<SPFChecker> i = spfRecord.iterator();
            while (i.hasNext()) {
                SPFChecker checker = i.next();
                policyCheckers.add(checker);
            }

View Full Code Here

         * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
            SPF1Record res = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            if (res == null) {
                res = policy.getSPFRecord(spfData.getCurrentDomain());
                spfData.setAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD, res);
            }
            return null;
View Full Code Here

         * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
            SPF1Record res = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            res = policy.getSPFRecord(spfData.getCurrentDomain(), res);
            spfData.setAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD, res);
            return null;
        }
View Full Code Here

    public SPF1Record parse(String spfRecord) throws PermErrorException,
            NoneException, NeutralException {

        log.debug("Start parsing SPF-Record: " + spfRecord);

        SPF1Record result = new SPF1Record();

        // check the version "header"
        if (spfRecord.toLowerCase().startsWith(SPF1Constants.SPF_VERSION1 + " ") || spfRecord.equalsIgnoreCase(SPF1Constants.SPF_VERSION1)) {
            if (!spfRecord.toLowerCase().startsWith(SPF1Constants.SPF_VERSION1 + " ")) throw new NeutralException("Empty SPF Record");
        } else {
            throw new NoneException("No valid SPF Record: " + spfRecord);
        }

        // extract terms
        String[] terms = termsSeparatorPattern.split(spfRecord.replaceFirst(
                SPF1Constants.SPF_VERSION1, ""));

        // cycle terms
        for (int i = 0; i < terms.length; i++) {
            if (terms[i].length() > 0) {
                Matcher termMatcher = termPattern.matcher(terms[i]);
                if (!termMatcher.matches()) {
                    throw new PermErrorException("Term [" + terms[i]
                            + "] is not syntactically valid: "
                            + termPattern.pattern());
                }

                // true if we matched a modifier, false if we matched a
                // directive
                String modifierString = termMatcher
                        .group(TERM_STEP_REGEX_MODIFIER_POS);

                if (modifierString != null) {
                    // MODIFIER
                    Modifier mod = (Modifier) lookupAndCreateTerm(termMatcher,
                            TERM_STEP_REGEX_MODIFIER_POS);

                    if (mod.enforceSingleInstance()) {
                        Iterator<Modifier> it = result.getModifiers().iterator();
                        while (it.hasNext()) {
                            if (it.next().getClass().equals(mod.getClass())) {
                                throw new PermErrorException("More than one "
                                        + modifierString
                                        + " found in SPF-Record");
                            }
                        }
                    }

                    result.getModifiers().add(mod);

                } else {
                    // DIRECTIVE
                    String qualifier = termMatcher
                            .group(TERM_STEP_REGEX_QUALIFIER_POS);

                    Object mech = lookupAndCreateTerm(termMatcher,
                            TERM_STEP_REGEX_MECHANISM_POS);

                    result.getDirectives().add(
                            new Directive(qualifier, (Mechanism) mech, log.getChildLogger(qualifier+"directive")));

                }

            }
View Full Code Here

         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
           
            SPF1Record spfRecord = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            // make sure we cleanup the record, for recursion support
            spfData.removeAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
           
            LinkedList<SPFChecker> policyCheckers = new LinkedList<SPFChecker>();
           
            Iterator<SPFChecker> i = spfRecord.iterator();
            while (i.hasNext()) {
                SPFChecker checker = i.next();
                policyCheckers.add(checker);
            }

View Full Code Here

         * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
            SPF1Record res = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            if (res == null) {
                res = policy.getSPFRecord(spfData.getCurrentDomain());
                spfData.setAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD, res);
            }
            return null;
View Full Code Here

         * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
         */
        public DNSLookupContinuation checkSPF(SPFSession spfData)
                throws PermErrorException, TempErrorException,
                NeutralException, NoneException {
            SPF1Record res = (SPF1Record) spfData.getAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD);
            res = policy.getSPFRecord(spfData.getCurrentDomain(), res);
            spfData.setAttribute(SPF1Utils.ATTRIBUTE_SPF1_RECORD, res);
            return null;
        }
View Full Code Here

     * @see org.apache.james.jspf.core.SPFChecker#checkSPF(org.apache.james.jspf.core.SPFSession)
     */
    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) {
View Full Code Here

TOP

Related Classes of org.apache.james.jspf.core.SPF1Record

Copyright © 2018 www.massapicom. 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.