]> granicus.if.org Git - ejabberd/commitdiff
* src/web/ejabberd_http.erl (parse_auth): Allow password that
authorBadlop <badlop@process-one.net>
Mon, 12 May 2008 17:56:27 +0000 (17:56 +0000)
committerBadlop <badlop@process-one.net>
Mon, 12 May 2008 17:56:27 +0000 (17:56 +0000)
include colon character (EJAB-522)

SVN Revision: 1322

ChangeLog
src/web/ejabberd_http.erl

index e838076f71d671a8bed2c5afdb9654b1ce78b141..a121f9560d10d463fe0d6da5af0183c9afe6555d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-12  Badlop  <badlop@process-one.net>
+
+       * src/web/ejabberd_http.erl (parse_auth): Allow password that
+       include colon character (EJAB-522)
+
 2008-04-30  Christophe Romain <christophe.romain@process-one.net>
 
        * src/mod_caps.erl: XEP-0115 patch (EJAB-618)
index 5c14a287b5d566f892069db1f2dff827520b108d..a5391080381cde08064af87d12325f2d0148444b 100644 (file)
@@ -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(_) ->