[asterisk-commits] file: trunk r370073 - /trunk/res/res_xmpp.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 16 07:58:22 CDT 2012
Author: file
Date: Mon Jul 16 07:58:18 2012
New Revision: 370073
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370073
Log:
Fix an issue where specifying the resource in the username would cause authentication to fail.
Modified:
trunk/res/res_xmpp.c
Modified: trunk/res/res_xmpp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_xmpp.c?view=diff&rev=370073&r1=370072&r2=370073
==============================================================================
--- trunk/res/res_xmpp.c (original)
+++ trunk/res/res_xmpp.c Mon Jul 16 07:58:18 2012
@@ -2557,7 +2557,14 @@
iks_insert_attrib(auth, "xmlns", IKS_NS_XMPP_SASL);
iks_insert_attrib(auth, "mechanism", "PLAIN");
- snprintf(combined, sizeof(combined), "%c%s%c%s", 0, cfg->user, 0, cfg->password);
+ if (strchr(cfg->user, '/')) {
+ char *user = ast_strdupa(cfg->user);
+
+ snprintf(combined, sizeof(combined), "%c%s%c%s", 0, strsep(&user, "/"), 0, cfg->password);
+ } else {
+ snprintf(combined, sizeof(combined), "%c%s%c%s", 0, cfg->user, 0, cfg->password);
+ }
+
ast_base64encode(base64, (const unsigned char *) combined, len - 1, (len + 2) * 4 / 3);
iks_insert_cdata(auth, base64, 0);
More information about the asterisk-commits
mailing list