~samwhited/xmpp

internal/stream: limit XML token types

Make sure that we don't allow comments, proc insts, or directives
anywhere in the stream.

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/xmpptest: allow string comparison

Add an option to do a string comparison instead of comparing errors the
proper way.

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: fix DOS where no deadline was set on conns

When dialing a new connection in the Dial* functions no deadline was
being set meaning that a misbehaving server that blackholes the
connection could cause these functions to block forever. This patch
makes these functions respect any deadline set on the context, giving
the user control over cancelation.

Unifying the context logic also results in a secondary issue being fixed
where cancel functions were not being respected (but deadlines were) on
writes.

Fixes #124

Signed-off-by: Sam Whited <sam@samwhited.com>
jid: test that "WithDomain" performs normalization

Signed-off-by: Sam Whited <sam@samwhited.com>
jid: normalize domainparts

Normalize domainparts using the IDNA2008 "display" profile. This may or
may not match the rules of RFC 5895 exactly, but as long as all incoming
JIDs are run through this processing it shouldn't matter if two servers
have slightly different sets of rules.

Fixes #123

Signed-off-by: Sam Whited <sam@samwhited.com>
jid: move trailing . trimming out of split

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: remove unused argument from DialSession

Fixes #125

Signed-off-by: Sam Whited <sam@samwhited.com>
stanza: rename a file

With `Is' exported this now does more than handle IDs.
Rename the file for clarity.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: add function stanza.Is()

Add exported function stanza.Is() which tests an xml.Name for its name
and space. If it is a proper stanza it returns true.
This function was repeatedly defined in several files and is now defined
one time and exported in stanza/stanza.go

Fixes #113
all: fix tests broken by upstream change

We recently reported a minor DOS vector in the encoding/xml package
which was fixed by d0b79e3513a2. This revealed issues with the iterators
in the disco and roster packages that had previously been hidden by the
bad behavior of encoding/xml.

Signed-off-by: Sam Whited <sam@samwhited.com>
docs: document naming of Fetch functions

Previously some functions that made simple queries were called (or
started with) "Get" while others used "Fetch". Now "Fetch" is used to
indicate functions that return an iterator, while "Get" functions return
the full data.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: add myself to contributors

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
disco: rename GetItems(IQ) to FetchItems(IQ)

Like this we consistently signal that functions with the prefix `Fetch`
return an iterator.

Fixes #116

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
form: remove unnecessary loop

Signed-off-by: Sam Whited <sam@samwhited.com>
xmpp: lowercase error values

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/saslerr: remove unnecessary underscore

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/integration/prosody: fix unnecessary loop

Signed-off-by: Sam Whited <sam@samwhited.com>
ibr2: remove unused error

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/discover: fix ineffectual break

Signed-off-by: Sam Whited <sam@samwhited.com>
internal/discover: fix unused error

Signed-off-by: Sam Whited <sam@samwhited.com>
Next