Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements #227

Merged
merged 6 commits into from
Nov 9, 2023
Merged

Minor improvements #227

merged 6 commits into from
Nov 9, 2023

Conversation

sjaeckel
Copy link
Member

@sjaeckel sjaeckel commented Nov 1, 2023

Check commit messages for details

* Be more verbose in which argument is `should` and which is `is`.
* Fix the order in the `ENSURE_EQ()` macro.

Signed-off-by: Steffen Jaeckel <[email protected]>
Only send an `r` stanza after we've received the reply to the previous one.

Signed-off-by: Steffen Jaeckel <[email protected]>
Signed-off-by: Steffen Jaeckel <[email protected]>
@sjaeckel sjaeckel requested a review from pasis November 2, 2023 11:07
src/common.h Show resolved Hide resolved
src/conn.c Outdated Show resolved Hide resolved
src/conn.c Show resolved Hide resolved
In case a connection is established, but the stream negotiation has not
completed yet, a user may think that they can start sending data,
but this is not the case.

All of the following quotes originate in RFC6120.

As of Ch. 8:

> After a client and a server (or two servers) have completed stream
> negotiation, either party can send XML stanzas.

As of Ch. 7.3.1:

> The parties to a stream MUST consider resource binding as
> mandatory-to-negotiate.

As of Ch. 6.3.1:

> The parties to a stream MUST consider SASL as mandatory-to-negotiate.

As of Ch. 4.3.5:

> The initiating entity MUST NOT attempt to send XML stanzas to entities
> other than itself (i.e., the client's connected resource or any other
> authenticated resource of the client's account) or the server to which
> it is connected until stream negotiation has been completed.
> Even if the initiating entity does attempt to do so, the receiving
> entity MUST NOT accept such stanzas and MUST close the stream with a
> <not-authorized/> stream error [...]

Signed-off-by: Steffen Jaeckel <[email protected]>
Instead of setting each element individually to 0 or NULL, use memset.

This also fixes the missing initialization of `conn->sm_disable`.

Signed-off-by: Steffen Jaeckel <[email protected]>
@sjaeckel sjaeckel merged commit c5b6026 into master Nov 9, 2023
48 checks passed
@sjaeckel sjaeckel deleted the minor-improvements branch November 9, 2023 10:24
@sjaeckel sjaeckel added this to the next milestone Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants