diff options
author | Vitaly Takmazov | 2016-07-20 15:03:48 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-07-20 15:03:48 +0300 |
commit | d5d21e26157f7a5821a68f53e043ad88b150fca3 (patch) | |
tree | 7ebf9e44b4977ec2350cbee1bc4694c3a9cf9ee7 /juick-www/src/main/java/com/juick/xmpp/s2s | |
parent | f7a94873f2572247b34d25bf4ab4434b7d7cfc1a (diff) |
xmpp: banned_hosts
Diffstat (limited to 'juick-www/src/main/java/com/juick/xmpp/s2s')
-rw-r--r-- | juick-www/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java | 7 | ||||
-rw-r--r-- | juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/juick-www/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java b/juick-www/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java index 7181f1c2..3b3c0316 100644 --- a/juick-www/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java +++ b/juick-www/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java @@ -55,8 +55,13 @@ public class ConnectionIn extends Connection implements Runnable { throw new Exception("STREAM FROM ? " + streamID + " INVALID FIRST PACKET"); } boolean xmppversionnew = parser.getAttributeValue(null, "version") != null; + String from = parser.getAttributeValue(null, "from"); - sendOpenStream(parser.getAttributeValue(null, "from"), xmppversionnew); + if (xmpp.bannedHosts.contains(from)) { + closeConnection(); + return; + } + sendOpenStream(from, xmppversionnew); while (parser.next() != XmlPullParser.END_DOCUMENT) { updateTsRemoteData(); diff --git a/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java b/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java index d0b231e2..4fb40e23 100644 --- a/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java +++ b/juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java @@ -46,6 +46,7 @@ public class XMPPComponent implements ServletContextListener, Stream.StreamListe public String keystore; public String keystorePassword; public List<String> brokenSSLhosts; + public List<String> bannedHosts; final List<ConnectionIn> inConnections = Collections.synchronizedList(new ArrayList<>()); final List<ConnectionOut> outConnections = Collections.synchronizedList(new ArrayList<>()); final List<CacheEntry> outCache = Collections.synchronizedList(new ArrayList<>()); @@ -182,6 +183,7 @@ public class XMPPComponent implements ServletContextListener, Stream.StreamListe keystore = conf.getProperty("keystore"); keystorePassword = conf.getProperty("keystore_password"); brokenSSLhosts = Arrays.asList(conf.getProperty("broken_ssl_hosts", "").split(",")); + bannedHosts = Arrays.asList(conf.getProperty("banned_hosts", "").split(",")); DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName(conf.getProperty("datasource_driver", "com.mysql.jdbc.Driver")); dataSource.setUrl(conf.getProperty("datasource_url")); |