diff options
author | Joshua Colp <jcolp@digium.com> | 2012-07-16 12:58:18 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2012-07-16 12:58:18 +0000 |
commit | 5d20f603376e230129f3801004fe6eebdbc0b6df (patch) | |
tree | c482ffc80de8d3129d3f6755c8bef86ed675bcf2 | |
parent | e9387375700a1b3e78ce44af0495aefe29c6d2a4 (diff) |
Fix an issue where specifying the resource in the username would cause authentication to fail.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370073 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | res/res_xmpp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/res/res_xmpp.c b/res/res_xmpp.c index 63e6384c7..42d15ce85 100644 --- a/res/res_xmpp.c +++ b/res/res_xmpp.c @@ -2557,7 +2557,14 @@ static int xmpp_client_authenticate_sasl(struct ast_xmpp_client *client, struct 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); |