aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/xmpp/s2s
diff options
context:
space:
mode:
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.java7
-rw-r--r--juick-www/src/main/java/com/juick/xmpp/s2s/XMPPComponent.java2
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"));