mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Merge pull request #62 from PaulSD/master
Fix errors when generating random binary strings
This commit is contained in:
commit
54667511f6
@ -43,7 +43,9 @@ mech_new(Host, _GetPassword, _CheckPassword, _CheckPasswordDigest) ->
|
|||||||
{ok, #state{server = Host}}.
|
{ok, #state{server = Host}}.
|
||||||
|
|
||||||
mech_step(#state{server = Server}, _ClientIn) ->
|
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
|
case ejabberd_auth:is_user_exists(User, Server) of
|
||||||
true -> {error, <<"not-authorized">>};
|
true -> {error, <<"not-authorized">>};
|
||||||
false -> {ok, [{username, User}, {auth_module, ejabberd_auth_anonymous}]}
|
false -> {ok, [{username, User}, {auth_module, ejabberd_auth_anonymous}]}
|
||||||
|
@ -897,7 +897,8 @@ resource_conflict_action(U, S, R) ->
|
|||||||
closenew -> closenew;
|
closenew -> closenew;
|
||||||
setresource ->
|
setresource ->
|
||||||
Rnew = iolist_to_binary([randoms:get_string()
|
Rnew = iolist_to_binary([randoms:get_string()
|
||||||
| tuple_to_list(now())]),
|
| [jlib:integer_to_binary(X)
|
||||||
|
|| X <- tuple_to_list(now())]]),
|
||||||
{accept_resource, Rnew}
|
{accept_resource, Rnew}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
@ -912,7 +913,8 @@ wait_for_bind({xmlstreamelement, El}, StateData) ->
|
|||||||
error -> error;
|
error -> error;
|
||||||
<<"">> ->
|
<<"">> ->
|
||||||
iolist_to_binary([randoms:get_string()
|
iolist_to_binary([randoms:get_string()
|
||||||
| tuple_to_list(now())]);
|
| [jlib:integer_to_binary(X)
|
||||||
|
|| X <- tuple_to_list(now())]]);
|
||||||
Resource -> Resource
|
Resource -> Resource
|
||||||
end,
|
end,
|
||||||
case R of
|
case R of
|
||||||
|
Loading…
Reference in New Issue
Block a user