[Bug 30296] Add Conn.I.Addressing support to Gabble

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Nov 17 16:29:07 CET 2011


https://bugs.freedesktop.org/show_bug.cgi?id=30296

--- Comment #20 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2011-11-17 07:29:07 PST ---
+ escaped_node = g_uri_escape_string (node, NULL, TRUE);
+ if (escaped_node == NULL)
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "'%s' is not a valid JID", jid);

How could this possibly fail, given that node is already non-NULL? Likewise for
the other two g_uri_escape_string calls.

+ if (!gabble_decode_jid (jid, &tmp_node, &tmp_domain, &tmp_resource))
+ {
+ g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+ "'%s' is not a valid XMPP URI", uri);
+ goto OUT;
+ }

You probably want wocky_decode_jid instead of gabble_decode_jid (it's a trivial
wrapper).

This is relying on the fact that wocky_decode_jid will allow "%" in all three
components, I think? Not all valid escaped-JIDs are valid JIDs. I think it'd be
enough to open this as a bug and move on, though.

I can't help feeling that gabble_parse_xmpp_uri() should validate the node,
domain and resource individually - at the moment it does a *lot* of JID ->
tuple -> JID -> tuple round-trips - but to do that properly, we'd need Wocky to
expose wocky_validate_jid_node(), wocky_validate_jid_domain(), and a new
wocky_validate_jid_domain() (at the moment the first two are static and the
third is just "is a non-empty string").

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.



More information about the telepathy-bugs mailing list