1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-15 03:52:05 +01:00
Commit graph

4268 commits

Author SHA1 Message Date
Florian Schmaus
ae2c57f56b Fix XML in MamResultProviderTest
Add missing whitespace between XML attributes.
2019-04-29 13:56:16 +02:00
adiaholic
3b657d36c4 Changed XEP-0116 to XEP-0166
Rearranged as per the expected XEP sequence
2019-04-29 13:32:26 +05:30
Florian Schmaus
4e7cd83220 Fix (Privacy|Time)ProviderTest
XML attributes must be separated by a whitespace.
2019-04-29 08:52:36 +02:00
adiaholic
af5f161fff Prevent extremely long reply timeouts from being set.
Smack will throw an IllegalArguementException if extremely
long reply timeouts are tried to be set. I assumed currentTimeMilli()
to be the boundary condition as per SMACK-718
2019-04-26 20:32:35 +05:30
Florian Schmaus
870756997f Improve exception message of XmppConnectionStressTest 2019-04-24 21:25:22 +02:00
Guus der Kinderen
fc70484cf6 More specific Pubsub integration tests.
XEP-0060 prohibits publishing a request that contains an item to a node that
is both 'notification-only' and 'transient' (section 7.1.3.6)

In commit 8ed872ca63 the existing pubsub publication
test was modified (to resolve a different issue) to operate on a node that's both
'notification-only' and 'transient'. This resulted in a test that should return
an error, even though the test implementation didn't expect one.

This commit explicitly verifies that publishing an item to such a node causes
an error to be returned. A new test is added that verifies that publishing an
event notification does succeed.
2019-04-17 21:52:01 +02:00
Florian Schmaus
2dbc32340d
Merge pull request #311 from guusdk/sint-accountmanager-disconnect
Admin should be disconnected after tests.
2019-04-17 21:32:42 +02:00
Florian Schmaus
d97fb126a1 Add PubSubManager.getInstanceFor() just like all other Managers
and deprecate PubSubManager.getInstance().
2019-04-16 11:21:22 +02:00
Florian Schmaus
99bf8316f5 Add javadoc about callbacks to XMPPConnection 2019-04-16 09:33:07 +02:00
Florian Schmaus
9c30e4f3cc Merge branch '4.3' 2019-04-16 09:27:48 +02:00
Florian Schmaus
11775ed6b0 Add checkstyle rule for 'synchronized' on Manager.getInstanceFor() 2019-04-15 09:58:53 +02:00
Florian Schmaus
488055948d Add missing 'synchronized' keywords to Manager.getInstanceFor()
Fixes SMACK-865.
2019-04-15 09:48:52 +02:00
Florian Schmaus
7fd0676ff4 Add unit test for smack-resolver-minidns-dox 2019-04-14 22:34:15 +02:00
Florian Schmaus
6076a9dfa5 Introduce asyncGoLimited()
which limits the number of threads created for asynchronous
operations.

Fixes SMACK-864.
2019-04-14 21:40:09 +02:00
V Lau
f1fb03d08c Add a success callback for auto-join on reconnect.
When auto-join on reconnection is success, invoke a callback.

Conform to the proper copyright format.
2019-04-09 14:21:11 -07:00
Florian Schmaus
a1c88f1fad Add DNSSEC support to DnsOverXmppMiniDnsResolver 2019-04-09 21:00:08 +02:00
Florian Schmaus
fc45e1b905 DoX: Ensure that the response message ID matches the query ID 2019-04-09 17:02:56 +02:00
Florian Schmaus
0ec7e84cbc Update link to XMPP Registry for Service Discovery Identities 2019-04-09 14:26:15 +02:00
Florian Schmaus
9ad162af6e Use correct field in ServiceDiscoveryManager.getIdentities()
Fixes SMACK-863.
2019-04-09 12:14:12 +02:00
Florian Schmaus
474ea68d4a Remove unused method in Smack's Base64 API 2019-04-09 10:56:47 +02:00
Florian Schmaus
62fd897cf7 Add support for XEP-0418: DNS Queries over XMPP (DoX)
Fixes SMACK-862.
2019-04-09 10:56:47 +02:00
Florian Schmaus
75b1d8ce13 Add AbstractError.Builder.setDescriptiveEnText(String, Exception) 2019-04-09 09:33:32 +02:00
Florian Schmaus
1122bf394c Add ExceptionUtil 2019-04-09 09:33:32 +02:00
Florian Schmaus
3075430713 Use IQ.isRequestIQ() in IQ 2019-04-09 09:33:32 +02:00
Florian Schmaus
d1f2631771 Use IQ.isResponseIQ() in AbstractXMPPConnection 2019-04-09 09:33:32 +02:00
Florian Schmaus
87e0ac9ba1 Add IQ.isResponseIQ() 2019-04-09 09:33:32 +02:00
Florian Schmaus
7d5274dad1 Use java.util.Base64 and remove build-in Base64 API 2019-04-09 09:33:32 +02:00
Guus der Kinderen
a9673408cc Admin should be disconnected after tests.
The Smack Integration tests can use an admin account to provision
accounts that are used by the tests. This admin account uses an XMPP
connection to interact with the server-under-test.

When the tests are over, this account should be disconnected
explicitly, to prevent stream management from keeping it alive longer
than it needs to.
2019-04-08 16:10:29 +02:00
Florian Schmaus
0d17f195b0 Use EntityFullJid as JID type in MultiUserChat.getJoinedRooms()
Got a user who put in a EntityBareJid and wondered why the returned
list was empty.
2019-04-07 22:13:38 +02:00
Florian Schmaus
d6b6fdca17 Add ConnectionConfiguration.setXmppAddressAndPassword() 2019-04-07 16:44:04 +02:00
Florian Schmaus
38384a1eed Improve javadoc of ConnectionConfiguration 2019-04-07 16:43:48 +02:00
Florian Schmaus
af0fb7543c
Merge pull request #309 from vanitasvitae/rosterListenerDoc
Add missing Roster documentation
2019-04-06 15:19:59 +02:00
Florian Schmaus
fea7362293
Merge pull request #306 from Alameyo/doc-fix-stanza-type-filter-to-uppercase
Fix in documentation. StanzaTypeFilter to uppercase as in code.
2019-04-06 15:17:58 +02:00
af88227919
Add missing Roster documentation 2019-04-06 02:36:32 +02:00
Florian Schmaus
d10319f1a0 Merge branch '4.3' 2019-04-05 10:22:12 +02:00
Florian Schmaus
c499556d07 Remove dead code from OmemoService 2019-04-02 16:00:18 +02:00
Florian Schmaus
7d7fbe6828 Do not explicity select the (crypto) Provider in smack-omemo
This makes the system select the "best" available provider.

Also the 'BC' provider in newer Android version does not longer
implement certain Ciphers, which causes an NoSuchAlgorithmException if
the Cipher is requested explicitly by the 'BC' provider:

E/XmppService: XmppServiceConnection - Error while sending pending messages
  org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException: java.security.NoSuchAlgorithmException: The BC provider no longer provides an implementation for Cipher.AES/GCM/NoPadding.  Please see https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html for more details.
      at org.jivesoftware.smackx.omemo.OmemoService.encrypt(OmemoService.java:375)
      at org.jivesoftware.smackx.omemo.OmemoService.createOmemoMessage(OmemoService.java:537)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:341)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:314)
      at es.iecisa.xmppservice.XmppServiceConnection.lambda$sendMessage$0(XmppServiceConnection.java:516)
      at es.iecisa.xmppservice.-$$Lambda$XmppServiceConnection$aBU_80chagvypMTSd-aSm7pRQRY.run(Unknown Source:4)
      at java.lang.Thread.run(Thread.java:764)
   Caused by: java.security.NoSuchAlgorithmException: The BC provider no longer provides an implementation for Cipher.AES/GCM/NoPadding.  Please see https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html for more details.
      at sun.security.jca.Providers.checkBouncyCastleDeprecation(Providers.java:563)
      at sun.security.jca.Providers.checkBouncyCastleDeprecation(Providers.java:346)
      at javax.crypto.Cipher.createCipher(Cipher.java:722)
      at javax.crypto.Cipher.getInstance(Cipher.java:717)
      at javax.crypto.Cipher.getInstance(Cipher.java:674)
      at org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder.setMessage(OmemoMessageBuilder.java:169)
      at org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder.<init>(OmemoMessageBuilder.java:116)
      at org.jivesoftware.smackx.omemo.OmemoService.encrypt(OmemoService.java:372)
      at org.jivesoftware.smackx.omemo.OmemoService.createOmemoMessage(OmemoService.java:537)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:341)
      at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:314)
      at es.iecisa.xmppservice.XmppServiceConnection.lambda$sendMessage$0(XmppServiceConnection.java:516)
      at es.iecisa.xmppservice.-$$Lambda$XmppServiceConnection$aBU_80chagvypMTSd-aSm7pRQRY.run(Unknown Source:4)
      at java.lang.Thread.run(Thread.java:764)
2019-04-02 15:58:34 +02:00
Florian Schmaus
9f8d13b8cd Do not explicitly select the Provider in HashManager
Note that we still setup the BouncyCastleProvider so all requested
MessageDigest instances should be avaialble.
2019-04-02 15:58:34 +02:00
Florian Schmaus
d6a90942a4 Unify Bouncy Castle versions: Add bouncyCastleVersion variable 2019-04-02 15:58:34 +02:00
Florian Schmaus
9be498c440 Fix NPE in Roster's presence listeners if 'from' is not set
The NPE is caused by an inbound presence stanza without the 'from'
attribute set. The stacktrace of the NPE is:

FATAL EXCEPTION: Smack Cached Executor
Process: de.fhg.ivi.senetz.mobile.android.mbk.debug, PID: 13365
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:944)
    at org.jivesoftware.smack.roster.Roster.getPresencesInternal(Roster.java:374)
    at org.jivesoftware.smack.roster.Roster.getOrCreatePresencesInternal(Roster.java:388)
    at org.jivesoftware.smack.roster.Roster.access$1100(Roster.java:94)
    at org.jivesoftware.smack.roster.Roster$PresencePacketListener$1.run(Roster.java:1519)
    at org.jivesoftware.smack.AsyncButOrdered$Handler.run(AsyncButOrdered.java:121)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)

Thanks to Marcel Heckel for reporting this.

Fixes SMACK-861.
2019-04-02 14:28:41 +02:00
Florian Schmaus
25b3f35421 Ensure that shutdown() terminates reader/writer threads
In case an exception happens in connect()/login() the
'disconnectedButResumable' boolean may (still) be set. Which causes
only one of the reader and writer threads to exit, typically the
reader thread, because shutdown() will bail out very early. This
leaves a dangling (writer) thread causing memory leaks and deadlocks
on a subsequent connect()/login().
2019-03-28 17:58:25 +01:00
Alameyo
7f542e403f Adjust in documentation StanzaTypeFilter to uppercase as in code 2019-03-27 00:12:58 +01:00
Florian Schmaus
5d46e281fc XMPPTCPConnection log when reader/writer threads start and exit 2019-03-26 17:23:27 +01:00
Florian Schmaus
ab7d81e7b5 Use type parameter bounds for the 'to' set in OpenPgpgContentElement 2019-03-25 18:58:58 +01:00
Florian Schmaus
89c0fa4b99 Let StringUtils.(insecure)randomString() return empty string
in case length is zero. Also do throw a NegativeArraySizeException if
length is negative instead of returning null.

This fixes the following sporadic test issue:

org.jivesoftware.smackx.ox.PainlessOpenPgpProviderTest > encryptDecryptTest FAILED
java.lang.AssertionError
at org.jivesoftware.smack.util.XmlStringBuilder.escape(XmlStringBuilder.java:425)
at org.jivesoftware.smackx.ox.element.EncryptedOpenPgpContentElement.addCommonXml(EncryptedOpenPgpContentElement.java:65)
at org.jivesoftware.smackx.ox.element.CryptElement.toXML(CryptElement.java:51)
at org.jivesoftware.smackx.ox.element.CryptElement.toXML(CryptElement.java:31)
at org.jivesoftware.smack.packet.Element.toXML(Element.java:41)
at org.jivesoftware.smackx.ox.element.OpenPgpContentElement.toInputStream(OpenPgpContentElement.java:186)
at org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider.encrypt(PainlessOpenPgpProvider.java:136)
at org.jivesoftware.smackx.ox.PainlessOpenPgpProviderTest.encryptDecryptTest(PainlessOpenPgpProviderTest.java:155)

because EncryptedOpenPgpContentElement rpad field was sometimes
'null' in case the random function returned '0' as length.
2019-03-25 18:58:58 +01:00
Florian Schmaus
14f288a763 Introduce RandomUtil
and use it in EncryptedOpenPgpContentElement
2019-03-25 18:58:58 +01:00
Florian Schmaus
927eb5e7d7 Add MemoryLeakTest(Util)
to check for the correct operation of what was implemented with
SMACK-383.
2019-03-25 18:58:58 +01:00
Florian Schmaus
0cd3318b12
Merge pull request #301 from adiaholic/JIRA836
Saving an instance of ServiceDiscoveryManager in MultiUserChatManager.
2019-03-24 11:39:20 +01:00
Florian Schmaus
a23adfab6e Merge branch '4.3' 2019-03-24 00:16:24 +01:00
Oliver Mihatsch
007a04c4fe Better error messages when using a Proxy to connect to the XMPP server. 2019-03-24 00:12:32 +01:00