From a96cf33df31bb9308762e935a4f98b06f000d0f7 Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 12 May 2008 17:56:27 +0000 Subject: [PATCH] * src/web/ejabberd_http.erl (parse_auth): Allow password that include colon character (EJAB-522) SVN Revision: 1322 --- ChangeLog | 5 +++++ src/web/ejabberd_http.erl | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e838076f7..a121f9560 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-05-12 Badlop + + * src/web/ejabberd_http.erl (parse_auth): Allow password that + include colon character (EJAB-522) + 2008-04-30 Christophe Romain * src/mod_caps.erl: XEP-0115 patch (EJAB-618) diff --git a/src/web/ejabberd_http.erl b/src/web/ejabberd_http.erl index 5c14a287b..a53910803 100644 --- a/src/web/ejabberd_http.erl +++ b/src/web/ejabberd_http.erl @@ -635,11 +635,14 @@ parse_auth(_Orig = "Basic " ++ Auth64) -> {error, _Err} -> undefined; Auth -> - case string:tokens(Auth, ":") of - [User, Pass] -> - {User, Pass}; - _ -> - undefined + %% Auth should be a string with the format: user@server:password + %% Note that password can contain additional characters '@' and ':' + case string:chr(Auth, $:) of + 0 -> + undefined; + SplitIndex -> + {User, [$: | Pass]} = lists:split(SplitIndex-1, Auth), + {User, Pass} end end; parse_auth(_) ->