commit 162534e928f8749a396c7d1eec2d8d0143052914 parent 639b2ec596b41303491fbfaa66579008ae40466e Author: Daniel Gultsch <daniel@gultsch.de> Date: Fri, 10 Jun 2016 00:16:50 +0200 try to automatically create non existing accounts Diffstat:
A | reports/datenknoten.me.txt | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | reports/swissjabber.de.txt | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | reports/yax.im.txt | | | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
M | src/main/java/eu/siacs/ComplianceTester.java | | | 23 | ++++++++++++++++++----- |
A | src/main/java/eu/siacs/RegistrationHelper.java | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
5 files changed, 231 insertions(+), 5 deletions(-)
diff --git a/reports/datenknoten.me.txt b/reports/datenknoten.me.txt @@ -0,0 +1,56 @@ +Use compliance suite 'Advanced Server Core Compliance Suite' to test datenknoten.me + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +passed 2/2 + +Advanced Server Core Compliance Suite: PASSED + + +Use compliance suite 'Advanced Server IM Compliance Suite' to test datenknoten.me + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running Roster Versioning… PASSED +running XEP-0280: Message Carbons… PASSED +running XEP-0191: Blocking Command… PASSED +running XEP-0045: Multi-User Chat… PASSED +running XEP-0198: Stream Management… PASSED +running XEP-0313: Message Archive Management… PASSED +passed 8/8 + +Advanced Server IM Compliance Suite: PASSED + + +Use compliance suite 'Advanced Server Mobile Compliance Suite' to test datenknoten.me + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running XEP-0198: Stream Management… PASSED +running XEP-0352: Client State Indication… PASSED +running XEP-0357: Push Notifications… FAILED +passed 4/5 + +Advanced Server Mobile Compliance Suite: FAILED + + +Use compliance suite 'Conversations Compliance Suite' to test datenknoten.me + +Server is Prosody 0.10 nightly build 261 (2016-05-30, 6943b1dd4e3d) +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running Roster Versioning… PASSED +running XEP-0280: Message Carbons… PASSED +running XEP-0191: Blocking Command… PASSED +running XEP-0045: Multi-User Chat… PASSED +running XEP-0198: Stream Management… PASSED +running XEP-0313: Message Archive Management… PASSED +running XEP-0352: Client State Indication… PASSED +running XEP-0363: HTTP File Upload… PASSED +running XEP-0065: SOCKS5 Bytestreams (Proxy)… FAILED +running XEP-0357: Push Notifications (on server)… FAILED +passed 10/12 + +Conversations Compliance Suite: FAILED + + diff --git a/reports/swissjabber.de.txt b/reports/swissjabber.de.txt @@ -0,0 +1,56 @@ +Use compliance suite 'Advanced Server Core Compliance Suite' to test swissjabber.de + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +passed 2/2 + +Advanced Server Core Compliance Suite: PASSED + + +Use compliance suite 'Advanced Server IM Compliance Suite' to test swissjabber.de + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running Roster Versioning… PASSED +running XEP-0280: Message Carbons… FAILED +running XEP-0191: Blocking Command… PASSED +running XEP-0045: Multi-User Chat… FAILED +running XEP-0198: Stream Management… FAILED +running XEP-0313: Message Archive Management… FAILED +passed 4/8 + +Advanced Server IM Compliance Suite: FAILED + + +Use compliance suite 'Advanced Server Mobile Compliance Suite' to test swissjabber.de + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running XEP-0198: Stream Management… FAILED +running XEP-0352: Client State Indication… FAILED +running XEP-0357: Push Notifications… FAILED +passed 2/5 + +Advanced Server Mobile Compliance Suite: FAILED + + +Use compliance suite 'Conversations Compliance Suite' to test swissjabber.de + +Server is Prosody 0.9.10 +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running Roster Versioning… PASSED +running XEP-0280: Message Carbons… FAILED +running XEP-0191: Blocking Command… PASSED +running XEP-0045: Multi-User Chat… FAILED +running XEP-0198: Stream Management… FAILED +running XEP-0313: Message Archive Management… FAILED +running XEP-0352: Client State Indication… FAILED +running XEP-0363: HTTP File Upload… FAILED +running XEP-0065: SOCKS5 Bytestreams (Proxy)… FAILED +running XEP-0357: Push Notifications (on server)… FAILED +passed 4/12 + +Conversations Compliance Suite: FAILED + + diff --git a/reports/yax.im.txt b/reports/yax.im.txt @@ -0,0 +1,56 @@ +Use compliance suite 'Advanced Server Core Compliance Suite' to test yax.im + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +passed 2/2 + +Advanced Server Core Compliance Suite: PASSED + + +Use compliance suite 'Advanced Server IM Compliance Suite' to test yax.im + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running Roster Versioning… PASSED +running XEP-0280: Message Carbons… PASSED +running XEP-0191: Blocking Command… FAILED +running XEP-0045: Multi-User Chat… PASSED +running XEP-0198: Stream Management… PASSED +running XEP-0313: Message Archive Management… FAILED +passed 6/8 + +Advanced Server IM Compliance Suite: FAILED + + +Use compliance suite 'Advanced Server Mobile Compliance Suite' to test yax.im + +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running XEP-0198: Stream Management… PASSED +running XEP-0352: Client State Indication… FAILED +running XEP-0357: Push Notifications… FAILED +passed 3/5 + +Advanced Server Mobile Compliance Suite: FAILED + + +Use compliance suite 'Conversations Compliance Suite' to test yax.im + +Server is Prosody 0.9.10 +running XEP-0115: Entity Capabilities… PASSED +running XEP-0163: Personal Eventing Protocol… PASSED +running Roster Versioning… PASSED +running XEP-0280: Message Carbons… PASSED +running XEP-0191: Blocking Command… FAILED +running XEP-0045: Multi-User Chat… PASSED +running XEP-0198: Stream Management… PASSED +running XEP-0313: Message Archive Management… FAILED +running XEP-0352: Client State Indication… FAILED +running XEP-0363: HTTP File Upload… FAILED +running XEP-0065: SOCKS5 Bytestreams (Proxy)… FAILED +running XEP-0357: Push Notifications (on server)… FAILED +passed 6/12 + +Conversations Compliance Suite: FAILED + + diff --git a/src/main/java/eu/siacs/ComplianceTester.java b/src/main/java/eu/siacs/ComplianceTester.java @@ -23,11 +23,24 @@ public class ComplianceTester { password = args[1]; AccountStore.storePassword(jid, password); } else { - password = AccountStore.getPassword(jid); - if (password == null) { - System.err.println("password for "+jid+ " was not stored"); - System.exit(1); - return; + String storedPassword = AccountStore.getPassword(jid); + if (storedPassword != null) { + password = storedPassword; + } else { + System.err.println("password for "+jid+ " was not stored. trying to register"); + try { + password = RegistrationHelper.register(jid); + AccountStore.storePassword(jid, password); + } catch (RegistrationHelper.RegistrationNotSupported e) { + System.err.println("server "+jid.getDomain()+" does not support registration"); + System.exit(1); + return; + } catch (RegistrationHelper.RegistrationFailed e) { + System.out.println("registration failed on server "+jid.getDomain()); + System.exit(1); + return; + } + } } List<Class <? extends AbstractTestSuite>> testSuites = Arrays.asList( diff --git a/src/main/java/eu/siacs/RegistrationHelper.java b/src/main/java/eu/siacs/RegistrationHelper.java @@ -0,0 +1,45 @@ +package eu.siacs; + +import rocks.xmpp.addr.Jid; +import rocks.xmpp.core.XmppException; +import rocks.xmpp.core.session.XmppClient; +import rocks.xmpp.extensions.register.RegistrationManager; +import rocks.xmpp.extensions.register.model.Registration; + +import java.math.BigInteger; +import java.security.SecureRandom; + +public class RegistrationHelper { + public static String register(Jid jid) throws RegistrationFailed, RegistrationNotSupported { + XmppClient client = XmppClient.create(jid.getDomain()); + try { + client.connect(jid); + RegistrationManager registrationManager = client.getManager(RegistrationManager.class); + if (registrationManager.isRegistrationSupported().getResult()) { + String password = new BigInteger(64, new SecureRandom()).toString(36); + Registration registration = Registration.builder() + .username(jid.getLocal()) + .password(password) + .build(); + registrationManager.register(registration).getResult(); + return password; + } else { + throw new RegistrationNotSupported(); + } + } catch (XmppException e) { + throw new RegistrationFailed(); + } + } + + private abstract static class RegistrationException extends Exception { + + } + + public static class RegistrationNotSupported extends RegistrationException { + + } + + public static class RegistrationFailed extends RegistrationException { + + } +}