Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbadlop <badlop@ono.com>2013-04-25 14:48:55 +0400
committerbadlop <badlop@ono.com>2013-04-25 14:48:55 +0400
commit54667511f60651900753a0c0f141dc6139c27f64 (patch)
treee378ef9864c4a7b17b31c4b9d7bb6db448de4a4e /src
parentd38ccbea6b67516c2f02ffc8bafd079b1f883610 (diff)
parentb33a4825827119caf92a167dc872117323910ddf (diff)
Merge pull request #62 from PaulSD/master
Fix errors when generating random binary strings
Diffstat (limited to 'src')
-rw-r--r--src/cyrsasl_anonymous.erl4
-rw-r--r--src/ejabberd_c2s.erl6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/cyrsasl_anonymous.erl b/src/cyrsasl_anonymous.erl
index 3090cfe9d..1daa1c103 100644
--- a/src/cyrsasl_anonymous.erl
+++ b/src/cyrsasl_anonymous.erl
@@ -43,7 +43,9 @@ mech_new(Host, _GetPassword, _CheckPassword, _CheckPasswordDigest) ->
{ok, #state{server = Host}}.
mech_step(#state{server = Server}, _ClientIn) ->
- User = iolist_to_binary([randoms:get_string() | tuple_to_list(now())]),
+ User = iolist_to_binary([randoms:get_string()
+ | [jlib:integer_to_binary(X)
+ || X <- tuple_to_list(now())]]),
case ejabberd_auth:is_user_exists(User, Server) of
true -> {error, <<"not-authorized">>};
false -> {ok, [{username, User}, {auth_module, ejabberd_auth_anonymous}]}
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 1784f022f..dab8fa546 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -897,7 +897,8 @@ resource_conflict_action(U, S, R) ->
closenew -> closenew;
setresource ->
Rnew = iolist_to_binary([randoms:get_string()
- | tuple_to_list(now())]),
+ | [jlib:integer_to_binary(X)
+ || X <- tuple_to_list(now())]]),
{accept_resource, Rnew}
end.
@@ -912,7 +913,8 @@ wait_for_bind({xmlstreamelement, El}, StateData) ->
error -> error;
<<"">> ->
iolist_to_binary([randoms:get_string()
- | tuple_to_list(now())]);
+ | [jlib:integer_to_binary(X)
+ || X <- tuple_to_list(now())]]);
Resource -> Resource
end,
case R of