aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorphsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-07 14:25:29 +0000
committerphsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b>2008-01-07 14:25:29 +0000
commit3d189055b51e6f06a43d8bbe3e1e0256d58979f8 (patch)
treeeea5bff8690d41f6ee5c861c2cb502a4752c3893 /res
parent8294d92d3a7d6f6c558e0a64c94660d42a1aed90 (diff)
Compute the base64 value over the [authzid]\0authcid\0password string,
thus excluding the trailing NULL byte. This change has already been committed to trunk, see #11644. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@96797 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_jabber.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c
index d106cd4a1..03ec4795b 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -583,7 +583,12 @@ static int aji_act_hook(void *data, int type, iks *node)
iks_insert_attrib(x, "xmlns", IKS_NS_XMPP_SASL);
iks_insert_attrib(x, "mechanism", "PLAIN");
sprintf(s, "%c%s%c%s", 0, client->jid->user, 0, client->password);
- ast_base64encode(base64, (const unsigned char *) s, len, len * 2);
+
+ /* exclude the NULL training byte from the base64 encoding operation
+ as some XMPP servers will refuse it.
+ The format for authentication is [authzid]\0authcid\0password
+ not [authzid]\0authcid\0password\0 */
+ ast_base64encode(base64, (const unsigned char *) s, len - 1, len * 2);
iks_insert_cdata(x, base64, 0);
iks_send(client->p, x);
iks_delete(x);