25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Fix Dialyzer errors in auth modules

This commit is contained in:
Badlop 2010-06-10 00:52:38 +02:00
parent ead2655a62
commit 1a6c162371
3 changed files with 19 additions and 20 deletions

View File

@ -393,11 +393,8 @@ remove_user(User, Server) when is_list(User), is_list(Server) ->
fun(M) ->
M:remove_user(User, Server)
end, auth_modules(Server)),
case R of
ok -> ejabberd_hooks:run(remove_user, list_to_binary(exmpp_stringprep:nameprep(Server)),
[list_to_binary(User), list_to_binary(Server)]);
_ -> none
end,
ejabberd_hooks:run(remove_user, list_to_binary(exmpp_stringprep:nameprep(Server)),
[list_to_binary(User), list_to_binary(Server)]),
R.
%% @spec (User, Server, Password) -> ok | not_exists | not_allowed | bad_request | error

View File

@ -201,8 +201,8 @@ register_connection(SID, JID, Info) when ?IS_JID(JID) ->
%% @doc Remove an anonymous user from the anonymous users table.
unregister_connection(SID, JID, _) when ?IS_JID(JID) ->
LUser = exmpp_jid:prep_node(JID),
LServer = exmpp_jid:prep_domain(JID),
LUser = exmpp_jid:prep_node_as_list(JID),
LServer = exmpp_jid:prep_domain_as_list(JID),
purge_hook(anonymous_user_exist(LUser, LServer),
LUser, LServer),
remove_connection(SID, LUser, LServer).
@ -215,7 +215,7 @@ unregister_connection(SID, JID, _) when ?IS_JID(JID) ->
purge_hook(false, _LUser, _LServer) ->
ok;
purge_hook(true, LUser, LServer) when is_list(LUser), is_list(LServer) ->
ejabberd_hooks:run(anonymous_purge_hook, LServer, [LUser, LServer]).
ejabberd_hooks:run(anonymous_purge_hook, list_to_binary(LServer), [LUser, LServer]).
%% ---------------------------------
%% Specific anonymous auth functions

View File

@ -133,13 +133,14 @@ check_password(User, Server, Password, Digest, DigestGen) ->
%% Password = string()
set_password(User, Server, Password) ->
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
US = {LUser, LServer},
if
(LUser == error) or (LServer == error) ->
LUser = (catch exmpp_stringprep:nodeprep(User)),
LServer = (catch exmpp_stringprep:nameprep(Server)),
case {LUser, LServer} of
{{stringprep, _, invalid_string, _}, _} ->
{error, invalid_jid};
true ->
{_, {stringprep, _, invalid_string, _}} ->
{error, invalid_jid};
US ->
F = fun() ->
mnesia:write(#passwd{us = US,
password = Password})
@ -154,13 +155,14 @@ set_password(User, Server, Password) ->
%% Password = string()
try_register(User, Server, Password) ->
LUser = exmpp_stringprep:nodeprep(User),
LServer = exmpp_stringprep:nameprep(Server),
US = {LUser, LServer},
if
(LUser == error) or (LServer == error) ->
LUser = (catch exmpp_stringprep:nodeprep(User)),
LServer = (catch exmpp_stringprep:nameprep(Server)),
case {LUser, LServer} of
{{stringprep, _, invalid_string, _}, _} ->
{error, invalid_jid};
true ->
{_, {stringprep, _, invalid_string, _}} ->
{error, invalid_jid};
US ->
F = fun() ->
case mnesia:read({passwd, US}) of
[] ->