Commit Graph

162 Commits

Author SHA1 Message Date
Martin Dosch
ce687243c1 NextEnd: Use Token() instead of RawToken()
I assumed RawToken would be better suited here, but there were errors
parsing messages that could be fixed by reverting to Token().
2024-03-31 15:50:04 +02:00
Martin Dosch
78d07e9eee XEP-0478: Further improve error message. 2024-03-28 18:17:45 +01:00
Martin Dosch
416bb6e7b7 XEP-0478: Be more verbose in error if max stanza size is exceeded. 2024-03-28 18:07:23 +01:00
Martin Dosch
aef1257ed1 Fix timeout when server doesn't reply with closing stream element. 2024-03-28 17:22:02 +01:00
Martin Dosch
da17a46e6f Also read stream limits after authentication
The [business rules](https://xmpp.org/extensions/xep-0478.html#rules)
mention the following:

> It is acceptable for the limits on a stream to change whenever new stream features are announced - such as before and after authentication of the connecting entity.

The first detection of the stream limits is not deleted as there is also
ANONYMOUS authentication.
2024-03-28 15:57:56 +01:00
Martin Dosch
eedd7259cb Generate new ID for session (fixes #67)
Co-authored-by: https://github.com/ikq
2024-03-28 15:53:09 +01:00
Martin Dosch
07196efcf3 Add support for XEP-0478: Stream Limits Advertisement. 2024-03-28 15:49:08 +01:00
Martin Dosch
bbd90cc04b Copy token in nextStart function.
See
bc81053dbc (commitcomment-140301890)
and bc81053dbc (commitcomment-140303962)
2024-03-27 21:12:42 +01:00
Martin Dosch
0c7ee22452 Revert "Don't copy token."
This reverts commit bc81053dbc.
2024-03-27 21:09:43 +01:00
Martin Dosch
862c21f845 Make XEP-0474 configurable (default off).
As it is still experimental we should not enable it per default.
2024-03-26 21:36:15 +01:00
Martin Dosch
bc81053dbc Don't copy token.
This should be unnecessary and is probably a
leftover of previous experiments to fix some races
when closing the connection.
2024-03-26 19:26:19 +01:00
Kale Blankenship
f6a9836fdf move nextMutex to Client to prevent blocking separate Clients
Avoids a global mutex which could end up unexpectedly blocking a
separate client. For example, if there were a client with few messages
and a client with many messages, the client with few could hold the lock
waiting for a token blocking the client with many from receiving.
2024-03-26 11:02:05 -07:00
Martin Dosch
8ab32d885f Fix race condition for nextStart and nextEnd. 2024-03-16 19:04:09 +01:00
Martin Dosch
73f06c9f3d Catch stream error after bind request. 2024-03-10 13:44:33 +01:00
Martin Dosch
9c5e758356 Use RawToken() instead of Token() for finding nextEnd.
This should improve stability as RawToken() does not
verify that start and end elements match.
2024-03-10 11:30:39 +01:00
Martin Dosch
ea4874e8c9 SCRAM: Check for SASL failure after sending auth message. 2024-03-09 19:51:47 +01:00
Martin Dosch
c051d69509 Improve closing the stream. 2024-03-03 12:10:45 +01:00
Martin Dosch
aed021cf3e Wait for the server closing the stream before closing the connection. 2024-03-02 14:17:47 +01:00
Martin Dosch
9684a8ff69 Close stream before closing connection. 2024-02-25 12:25:57 +01:00
Martin Dosch
0bcc057225 Remove unused types. 2024-02-22 17:58:48 +01:00
Martin Dosch
49054ca9e9 Remove unused function saslDigestResponse. 2024-02-22 17:55:38 +01:00
Martin
d6e9a15f29
Merge pull request #181 from mdosch/scram-improvement
Improve RFC5802 compatibility.
2024-02-01 13:52:47 +08:00
Martin Dosch
6ffd595a06 Improve RFC5802 compatibility.
According to RFC 5802 5.1 only the "m" attribute should
cause an authentication error.
2024-02-01 13:35:55 +08:00
Martin Dosch
d67787ca0f Filter invalid UTF8 from message body.
Closes #134
2024-01-18 19:46:18 +01:00
Martin Dosch
7bfa331758 Add support for SOCKS5 proxies. 2024-01-13 14:05:35 +01:00
Martin Dosch
7ccad52e63 (Indirectly) check that TLS was not renegotioated when using "tls-server-end-point". 2024-01-12 12:10:06 +01:00
Martin Dosch
705f68d1a5 Simplify tls-server-end-point channel binding code. 2024-01-12 11:56:32 +01:00
Martin Dosch
d3d16d5db9 SCRAM: Add support for tls-server-end-point channel binding. 2024-01-11 13:29:59 +01:00
Eleksir
34d683d25a
Extend SendPresence() stub func to allow send useful statuses (#150) 2024-01-10 23:24:28 +01:00
Martin
dffa92c129
Remove DIGEST-MD5 (#171)
As mentioned in https://github.com/xmppo/go-xmpp/issues/166#issuecomment-1884898526
DIGEST-MD5 is obsolete for a long time now.
2024-01-10 22:41:08 +01:00
Martin
8531e2e36a
improve no more auth err msg (#176)
Improve error message when no viable authentication method is available
2024-01-10 16:17:02 +01:00
Martin
e7d5b17113
Readability improvements. (#175)
* Improve readability of switch statement for auth mechanism choice

We have enough space in the width here, so it is not
necessary to span the cases over two lines.
2024-01-10 16:04:40 +01:00
Martin
424970d23c
Fix manual choice of auth mechanism. (#173) 2024-01-10 15:49:08 +01:00
Martin
5fdcf18a81
Simplify authentication choice code. (#169)
* Simplify authentication choice code.

Should be a lot easier to read and understand now.
2024-01-10 14:53:36 +01:00
Martin
794ed98f9f
Provide access to xml:lang information. (#168) 2024-01-10 13:57:27 +01:00
Martin
39f5b80375
Authentication improvements. (#165)
* Add XEP-0474 support.
* Add missing error handling.
2024-01-09 10:24:56 +01:00
Martin Dosch
9dcf67c0ad Merge branch 'master' into rework-newlines 2023-11-11 14:37:59 +01:00
Martin
4c385a334c
Add SCRAM PLUS variants. (#163) 2023-11-11 21:08:17 +09:00
Martin
a6b124c9b2
Fix typo. (#158) 2023-09-24 23:18:19 +09:00
Martin Dosch
6138e9dbe5 Harmonize newlines
Now there should be no more newlines in between any stanza and a
newline after every stanza.
This should not affect functionality but is looking better if
stanzas are printed for debugging.
2023-08-14 10:28:33 +02:00
Martin
98ff0d4df7
Rework printing of sent stanzas when debug is enabled (#148)
* Rework printing of sent stanzas when debug is enabled

This got reworked to also work with multiple connections
as pointed out by @vcabbage in
https://github.com/mattn/go-xmpp/pull/141#issuecomment-1557334066

* Remove StanzaWriter.
2023-07-28 23:42:12 +09:00
Martin
bef3e549f7
add scram auth (#147)
* Fix syntax errors.

* gofmt

* Add SCRAM-SHA-1, SCRAM-SHA-256 and SCRAM-SHA-512 auth
2023-05-21 16:26:59 +09:00
Martin
9129a110df
fix syntax errors (#145)
* Fix syntax errors.

* gofmt
2023-03-03 00:20:58 +09:00
PapaTutuWawa
d72a0f3154
Implement Disco queries against other entities (#124)
* Improve support for XEP-0030

This commit allows the user to query information about the server
or a node belonging to the server as per XEP-0030.

* Fix broken PubSub functionality
2023-03-02 13:23:29 +09:00
Martin
9fc0b1236c
Print sent stanzas in debug mode. (#141)
* Print sent stanzas in debug mode.

* Remove unnecessary newline.
2023-03-02 13:22:44 +09:00
Martin
05cd75074a
success msg (#144)
* Remove unnecessary newline.

* Make success content available.

Closes #142.
2023-03-02 13:20:49 +09:00
Martin
2eb234970c
Remove unnecessary newline. (#140) 2022-07-13 07:17:24 +09:00
Martin
3b26f73300
[codespell] Fix typo. (#139) 2022-07-11 02:58:21 +09:00
milampi
1411b9cc8b
Add xml attribute support for XMLElement (#136)
* Save attributes of the xml element

* Update unittest to check xml attributes
2022-05-13 17:24:06 +09:00
Martin
99ddfc1aa4
Return all pubsub IQs. (#137)
* Return all pubsub IQs.

This makes other pubsub requests accessible via
client.Recv().

* Fix formatting (gofmt).
2022-04-10 14:46:12 +09:00