Package org.apache.james.dnsservice.library.netmatcher

Examples of org.apache.james.dnsservice.library.netmatcher.NetMatcher


            java.util.Collection<String> networks = new java.util.ArrayList<String>();
            while (st.hasMoreTokens()) {
                String addr = st.nextToken();
                networks.add(addr);
            }
            authorizedNetworks = new NetMatcher(networks, dns);
        }
        SMTPProtocol transport = new SMTPProtocol(getProtocolHandlerChain(), theConfigData, new ProtocolLoggerAdapter(getLogger())) {

            @Override
            public ProtocolSession newSession(ProtocolTransport transport) {
View Full Code Here


            selectRS = selectStmt.executeQuery();
            List<String> nets = new ArrayList<String>();
            while (selectRS.next()) {
                nets.add(selectRS.getString(1));
            }
            NetMatcher matcher = new NetMatcher(nets, dns);
            boolean matched = matcher.matchInetNetwork(mail.getRemoteAddr());

            if (!matched) {
                selectStmt = conn.prepareStatement(selectNetworks);
                selectStmt.setString(1, "*");
                selectStmt.setString(2, recipientHost);
                selectRS = selectStmt.executeQuery();
                nets = new ArrayList<String>();
                while (selectRS.next()) {
                    nets.add(selectRS.getString(1));
                }
                matcher = new NetMatcher(nets, dns);
                matched = matcher.matchInetNetwork(mail.getRemoteAddr());
            }
            return matched;
        } catch (SQLException sqle) {
            log("Error accessing database", sqle);
            throw new MessagingException("Exception thrown", sqle);
View Full Code Here

    public void init() throws MessagingException {

        Collection<String> nets = allowedNetworks();

        if (nets != null) {
            authorizedNetworks = new NetMatcher(allowedNetworks(), dnsServer) {
                protected void log(String s) {
                    AbstractNetworkMatcher.this.log(s);
                }
            };
            log("Authorized addresses: " + authorizedNetworks.toString());
View Full Code Here

            String[] whitelistArray = nets.split(",");
            List<String> wList = new ArrayList<String>(whitelistArray.length);
            for (String aWhitelistArray : whitelistArray) {
                wList.add(aWhitelistArray.trim());
            }
            setWhiteListedNetworks(new NetMatcher(wList, dnsService));
            serviceLog.info("Whitelisted addresses: " + getWhiteListedNetworks().toString());

        }

        // Get the SQL file location
View Full Code Here

     *
     * @param networks  Collection of networks
     * @param dnsServer The DNSServer
     */
    public void setBannedNetworks(Collection<String> networks, DNSService dnsServer) {
        bNetwork = new NetMatcher(networks, dnsServer) {
            protected void log(String s) {
                serviceLog.debug(s);
            }
        };
    }
View Full Code Here

TOP

Related Classes of org.apache.james.dnsservice.library.netmatcher.NetMatcher

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.