Commit Graph

1112 Commits

Author SHA1 Message Date
Martin Fidczuk ffd027cc7d
Use XMPP connection as local SOCKS5 address
The default local address is often just "the first address found in the list of addresses read from the OS" and this might mean an internal IP address that cannot reach external servers. So wherever possible use the same IP address being used to connect to the XMPP server because this local address has a better chance of being suitable.

This MR adds the above behaviour, and two UTs to test that we use the local XMPP connection IP when connected, and the previous behaviour when not.
2023-04-26 10:00:23 +01:00
Florian Schmaus f78eade4da Merge branch '4.4' 2023-03-17 18:20:20 +01:00
Florian Schmaus bf3a27df9a [core] Fix ErrorIQ not showing potential original IQ child
Also delete StanzaIdTest since the test was fundamentally weak and
flawed. It does not work anyway, since TestIQ has a fixed stanza ID.

Fixes SMACK-931.
2023-03-17 18:03:57 +01:00
Florian Schmaus dee34b5efc [core] Add InternetAddress.fromIgnoringZoneId(String) 2023-02-12 16:06:53 +01:00
Guus der Kinderen 3a84a1ff47 s/ the the / the /g 2023-02-03 20:53:14 +01:00
Florian Schmaus c9a9982cef Migrate markdown documentation to javadoc
While markdown is easier to write, Smack's markdown documentation was
never tightly coupled with the source. For example, the markdown
documentation never provided links to the actual Java classes and
methods. This poses the risk that the documentation and the code
diverge over time. Furthermore, javadoc is constantly improving (for
example @snippet annotations) and I expect that one will be able to
write javadoc in markdown.

Fixes SMACK-928.
2023-02-03 09:50:35 +01:00
Florian Schmaus 92f253cc74 [core] Replace AbstractXMPPConnection.inOrderListeners
Using AsyncButOrdered for the receive listeners means that a listener
may not have been yet run once
invokeStanzaCollectorsAndNotifyRecvListeners() returnes. This can lead
to deadlocks as reported by Boris Grozev [1].

Fixes SMACK-927.

1: https://discourse.igniterealtime.org/t/thread-stuck-in-multiuserchat-enter-forever/92090
2022-10-05 11:28:48 +02:00
Florian Schmaus e87da18495 Bump Bouncy Castle to 1.71 2022-08-07 16:59:47 +02:00
Florian Schmaus 167af86f79 [core] Make ExtensionElementFilter's constructor public 2022-08-07 16:55:41 +02:00
Florian Schmaus c77948bb91 Add non-blocking send 2022-08-03 16:57:57 +02:00
Florian Schmaus 6be3eb194a Merge branch '4.4' 2022-06-07 08:41:46 +02:00
Florian Schmaus 66370c7ef5 [core] Add SmackConfiguration.TRUELY_ASYNC_SENDS
This option is meant a quick and dirty hack until
XMPPConnection.sendStanza() throws a dedicated Exception in case the
connection's outgoing queue is full.
2022-06-06 09:52:57 +02:00
Florian Schmaus e51bfb1dbe Merge branch '4.4' 2022-05-18 21:46:19 +02:00
Florian Schmaus 00bcbff5ee [core] Add ConnectionConfiguration.getHostString() 2022-05-18 21:45:00 +02:00
Florian Schmaus 70abd8a182 Merge branch '4.4' 2022-04-30 15:16:24 +02:00
Florian Schmaus 881ebe731d [core] Fix typo in javadoc 2022-04-30 15:15:51 +02:00
Florian Schmaus 1f5326abb2 [core] Inline waitForConditionOrConnectionException
Using any of the two methods is error prone, see 0e0c0a4093 ("[tcp]
Fix handling in connection exceptions when resuming a stream"), as one
can easily forget to check for connection exceptions after it
returned. There are also no longer any call sites of those methods.

Let's inline both variants of this method.
2022-04-30 15:15:42 +02:00
Ingo Bauersachs 4efa707028 Replace legacy IQProvider with IqProvider 2022-04-02 16:02:46 +02:00
Florian Schmaus a15110694a Merge branch '4.4' 2022-02-18 21:30:42 +01:00
Florian Schmaus ba2e36dbc3 [core] Deprecate some SSLContext config options and add KeyManager option
Smack historically provided fine-grained options for the
SSLContext. This is however not flexible enough, as an option to
specifiy the KeyManager(s) was missing.

This deprecated the options for keystore path, keystore type, and
PKCS#11 library, in favor of an option to set the KeyManager, which
could be aware of the keystore path and type, and the PKCS#11
library. At some point, Smack may provide some high-level methods to
create a KeyManager from provided keystore path, keytsore type and
PKCS#11 library.
2022-02-17 12:17:54 +01:00
Florian Schmaus 4a83d2957e Merge branch '4.4' 2022-02-06 17:48:08 +01:00
Boris Grozev 67a5c3a41a [core] Correctly handle due time of '0' in SmackReactor
Scheduled actions that are due in 0 milliseconds are due
immediately. Otherwise we would invoke select() with 0.

Fixes SMACK-923.
2022-02-06 17:38:50 +01:00
Florian Schmaus ad9867ebdf Merge branch '4.4' 2022-02-03 08:43:32 +01:00
Florian Schmaus 5cd7a6c60e
Merge pull request #509 from Flowdalic/jingle-reason-extension-element
Jingle reason extension element
2022-02-03 07:58:29 +01:00
Florian Schmaus 3ff553549a [SmackFuture] Invoke the callbacks at most once
Previously, if a SmackFuture both was successful and unsuccessful, it
was possible that the onSuccess() callback was invoked twice.

Reported-by: Boris Grozev <boris@jitsi.org>
2022-02-02 20:47:31 +01:00
cmeng-git 4cdb4acf26 [core] Fix IQProvider javadoc
It is IqProvider that should be used instead.
2022-02-02 12:13:25 +01:00
Florian Schmaus c06cf72337 [core] Support IqProvider in SmackTestUtil 2022-02-02 10:41:00 +01:00
Florian Schmaus 0e637068e6 [core] Factor PacketParserUtils.parseIqData() in extra method 2022-02-02 10:41:00 +01:00
Florian Schmaus 1dae0c0c32 [core] Use Enum.toString() in XmlStringBuilder.attribute(String, Enum<?>)
All other enum-using methods of XmlStringBuilder already use
Enum.toString(), as opposed to Enum.name(), this was the only left. I
do not remember why I did not to change this method too, probably
because of its plenty call sites.

But since this method already broke Jingle XML serializaton,
JingleAction was e.g., 'session_accept' when it should be
'session-accept', we change it now.

Fixes SMACK-921.
2022-01-22 11:08:35 +01:00
Florian Schmaus 1a727c152e [core] Improve warning message of ExceptionThrowingCallbackWithHint 2022-01-22 10:24:01 +01:00
Florian Schmaus 10a2687ff1 [sinttest] Allow the selection of individual test *methods* 2021-12-13 21:08:45 +01:00
Florian Schmaus 11cc2d8d77 [core] Align behavior of getParserFor(InputStream) and getParserFor(Reader)
Reported-by: Ingo Bauersachs <ingo@jitsi.org>
2021-11-30 10:49:55 +01:00
Florian Schmaus cad63bc107 Merge branch '4.4' 2021-11-09 15:30:02 +01:00
Florian Schmaus 8736e3e434 [core] Remove erroneous "assert !connected" in connect()
Connections like XMPPTCPConnection may still reported connected, if
they are, for example disconnected but resumable. This is already
accounted for in throwAlreadyConnectedExceptionIfAppropriate(), hence
the assert is unnecessary and leads to false negatives for
XMPPTCPConnection.

For the sake of completeness, the right condition, assuming
XMPPTCPConnection is used, for the assert would be:

	assert !connected || disconnectedButResumable;
2021-11-05 10:19:26 +01:00
Florian Schmaus 7dc8cc176e [core] Add DoOnce utility 2021-11-01 19:27:09 +01:00
Florian Schmaus fa88f78232 Merge branch '4.4' 2021-10-25 17:05:12 +02:00
Jonathan Lennox 4ae3fbb073 Add removeExtension methods to StanzaBuilder. 2021-10-25 14:50:45 +00:00
Florian Schmaus e842195b71 Merge branch '4.4' 2021-10-19 14:33:21 +02:00
Florian Schmaus ab92bc4b40
Merge pull request #501 from Flowdalic/fix-redundant-namespaces
Fix redundant namespaces
2021-10-19 14:29:18 +02:00
Florian Schmaus 0fa6d88575
Merge pull request #500 from jitsi/bugfix/4.4/error-stanzagetter
Add getter for the stanza associated with the exception
2021-10-19 14:29:11 +02:00
Florian Schmaus a0f97707d8
Merge pull request #499 from jitsi/feature/4.4/osgi
Make Smack jars OSGi bundles
2021-10-19 14:28:59 +02:00
Florian Schmaus 9fb7d6d97c
Merge pull request #497 from jitsi/bugfix/4.4/sasl-anonymous
Prevent password enforcement for SASL anonymous
2021-10-19 14:09:39 +02:00
Florian Schmaus b243a40e26 [core] Pass down the XML environment in IQChildElementXmlStringBuilder
This allows to avoid redundant XML namespaces within IQs, like for
example here:

<iq xmlns='jabber:client' id='EKP8I-1' type='set'>
    <jingle xmlns='urn:xmpp:jingle:1' action='content-accept' sid='MySession'>
        <content xmlns='urn:xmpp:jingle:1' creator='initiator' name='Hello world'>
        </content>
    </jingle>
</iq>

Fixes SMACK-917

Reported-by: Jonathan Lennox
2021-10-19 11:29:23 +02:00
Ingo Bauersachs 27ff37fa98 Add getter for the stanza associated with the exception
Fixes SMACK-916
2021-10-17 16:06:41 +02:00
Ingo Bauersachs b675aac81b Make Smack jars OSGi bundles
Fixes SMACK-343 by using bnd instead of the deprecated Gradle
plugin that was previously used and removed in commit
d06f533bb9.
2021-10-17 15:57:48 +02:00
Ingo Bauersachs 9b339efbc1 Prevent password enforcement for SASL anonymous
requirePassword from 92f4aadfdc
already excludes SASL external, but missed SASL anonymous.
2021-10-16 21:09:01 +02:00
Florian Schmaus 55299fb7e7 [core] Assert that 'event' is not END_DOCUMENT in forwardToEndTagOfDepth() 2021-09-13 10:10:55 +02:00
Jonathan Lennox f0a0796d33 Update documentation of default SecurityMode. 2021-09-09 17:28:25 +00:00
Florian Schmaus 3f2418dec7 [core] Fix spelling errors in code comment within PacketParserUtils 2021-08-25 22:54:23 +02:00
Florian Schmaus 001985647a Merge branch '4.4'
This also fixes a errornous merge where the same branch with different
commit was merged into master and 4.4

The conflicting commits are

4.4:
8f760eaeb3  getRawValueCharSequences
e626580f68

master:
b47225c2c1  getRawValues
097d245358
2021-08-23 18:02:00 +02:00