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

* src/cyrsasl.erl: Fix compilation warnings: Part 1 (EJAB-290)

* src/ejabberd_auth_odbc.erl: Likewise
* src/ejabberd_config.erl: Likewise
* src/ejabberd_hooks.erl: Likewise
* src/ejabberd_s2s_out.erl: Likewise
* src/ejabberd_sm.erl: Likewise
* src/idna.erl: Likewise
* src/jd2ejd.erl: Likewise

SVN Revision: 1045
This commit is contained in:
Badlop 2007-12-06 23:15:04 +00:00
parent d625fc80fc
commit 6342c258a7
9 changed files with 137 additions and 126 deletions

View File

@ -1,3 +1,14 @@
2007-12-07 Badlop <badlop@process-one.net>
* src/cyrsasl.erl: Fix compilation warnings: Part 1 (EJAB-290)
* src/ejabberd_auth_odbc.erl: Likewise
* src/ejabberd_config.erl: Likewise
* src/ejabberd_hooks.erl: Likewise
* src/ejabberd_s2s_out.erl: Likewise
* src/ejabberd_sm.erl: Likewise
* src/idna.erl: Likewise
* src/jd2ejd.erl: Likewise
2007-12-06 Badlop <badlop@process-one.net>
* src/acl.erl and other 64 files: Remove Erlang module attribute

View File

@ -25,7 +25,7 @@
behaviour_info(callbacks) ->
[{mech_new, 3}, {mech_step, 2}];
behaviour_info(Other) ->
behaviour_info(_Other) ->
undefined.
start() ->
@ -43,38 +43,38 @@ register_mechanism(Mechanism, Module, RequirePlainPassword) ->
module = Module,
require_plain_password = RequirePlainPassword}).
% TODO: use callbacks
-include("ejabberd.hrl").
-include("jlib.hrl").
check_authzid(State, Props) ->
AuthzId = xml:get_attr_s(authzid, Props),
case jlib:string_to_jid(AuthzId) of
error ->
{error, "invalid-authzid"};
JID ->
LUser = jlib:nodeprep(xml:get_attr_s(username, Props)),
{U, S, R} = jlib:jid_tolower(JID),
case R of
"" ->
{error, "invalid-authzid"};
_ ->
case {LUser, ?MYNAME} of
{U, S} ->
ok;
_ ->
{error, "invalid-authzid"}
end
end
end.
%%% TODO: use callbacks
%%-include("ejabberd.hrl").
%%-include("jlib.hrl").
%%check_authzid(_State, Props) ->
%% AuthzId = xml:get_attr_s(authzid, Props),
%% case jlib:string_to_jid(AuthzId) of
%% error ->
%% {error, "invalid-authzid"};
%% JID ->
%% LUser = jlib:nodeprep(xml:get_attr_s(username, Props)),
%% {U, S, R} = jlib:jid_tolower(JID),
%% case R of
%% "" ->
%% {error, "invalid-authzid"};
%% _ ->
%% case {LUser, ?MYNAME} of
%% {U, S} ->
%% ok;
%% _ ->
%% {error, "invalid-authzid"}
%% end
%% end
%% end.
check_credentials(State, Props) ->
check_credentials(_State, Props) ->
User = xml:get_attr_s(username, Props),
case jlib:nodeprep(User) of
error ->
{error, "not-authorized"};
"" ->
{error, "not-authorized"};
LUser ->
_LUser ->
ok
end.
@ -94,7 +94,7 @@ listmech(Host) ->
['$1']}]),
filter_anonymous(Host, Mechs).
server_new(Service, ServerFQDN, UserRealm, SecFlags,
server_new(Service, ServerFQDN, UserRealm, _SecFlags,
GetPassword, CheckPassword) ->
#sasl_state{service = Service,
myname = ServerFQDN,

View File

@ -146,7 +146,7 @@ get_vh_registered_users_number(Server, Opts) ->
case catch odbc_queries:users_number(LServer, Opts) of
{selected, [_], [{Res}]} ->
list_to_integer(Res);
Other ->
_Other ->
0
end.

View File

@ -99,17 +99,17 @@ process_term(Term, State) ->
State#state{override_local = true};
override_acls ->
State#state{override_acls = true};
{acl, ACLName, ACLData} ->
{acl, _ACLName, _ACLData} ->
process_host_term(Term, global, State);
{access, RuleName, Rules} ->
{access, _RuleName, _Rules} ->
process_host_term(Term, global, State);
{shaper, Name, Data} ->
%lists:foldl(fun(Host, S) -> process_host_term(Term, Host, S) end,
% State, State#state.hosts);
{shaper, _Name, _Data} ->
%%lists:foldl(fun(Host, S) -> process_host_term(Term, Host, S) end,
%% State, State#state.hosts);
process_host_term(Term, global, State);
{host, Host} ->
{host, _Host} ->
State;
{hosts, Hosts} ->
{hosts, _Hosts} ->
State;
{host_config, Host, Terms} ->
lists:foldl(fun(T, S) -> process_host_term(T, Host, S) end,
@ -139,7 +139,7 @@ process_term(Term, State) ->
{loglevel, Loglevel} ->
ejabberd_loglevel:set(Loglevel),
State;
{Opt, Val} ->
{_Opt, _Val} ->
lists:foldl(fun(Host, S) -> process_host_term(Term, Host, S) end,
State, State#state.hosts)
end.
@ -159,7 +159,7 @@ process_host_term(Term, Host, State) ->
State#state.opts]};
{host, Host} ->
State;
{hosts, Hosts} ->
{hosts, _Hosts} ->
State;
{odbc_server, ODBC_server} ->
odbc_modules_found = check_odbc_modules(ODBC_server),

View File

@ -98,7 +98,7 @@ init([]) ->
%% {stop, Reason, Reply, State} | (terminate/2 is called)
%% {stop, Reason, State} (terminate/2 is called)
%%----------------------------------------------------------------------
handle_call({add, Hook, Host, Module, Function, Seq}, From, State) ->
handle_call({add, Hook, Host, Module, Function, Seq}, _From, State) ->
Reply = case ets:lookup(hooks, {Hook, Host}) of
[{_, Ls}] ->
El = {Seq, Module, Function},
@ -116,7 +116,7 @@ handle_call({add, Hook, Host, Module, Function, Seq}, From, State) ->
ok
end,
{reply, Reply, State};
handle_call({delete, Hook, Host, Module, Function, Seq}, From, State) ->
handle_call({delete, Hook, Host, Module, Function, Seq}, _From, State) ->
Reply = case ets:lookup(hooks, {Hook, Host}) of
[{_, Ls}] ->
NewLs = lists:delete({Seq, Module, Function}, Ls),
@ -126,7 +126,7 @@ handle_call({delete, Hook, Host, Module, Function, Seq}, From, State) ->
ok
end,
{reply, Reply, State};
handle_call(Request, From, State) ->
handle_call(_Request, _From, State) ->
Reply = ok,
{reply, Reply, State}.
@ -136,7 +136,7 @@ handle_call(Request, From, State) ->
%% {noreply, State, Timeout} |
%% {stop, Reason, State} (terminate/2 is called)
%%----------------------------------------------------------------------
handle_cast(Msg, State) ->
handle_cast(_Msg, State) ->
{noreply, State}.
%%----------------------------------------------------------------------
@ -145,7 +145,7 @@ handle_cast(Msg, State) ->
%% {noreply, State, Timeout} |
%% {stop, Reason, State} (terminate/2 is called)
%%----------------------------------------------------------------------
handle_info(Info, State) ->
handle_info(_Info, State) ->
{noreply, State}.
%%----------------------------------------------------------------------
@ -153,7 +153,7 @@ handle_info(Info, State) ->
%% Purpose: Shutdown the server
%% Returns: any (ignored by gen_server)
%%----------------------------------------------------------------------
terminate(Reason, State) ->
terminate(_Reason, _State) ->
ok.
@ -164,7 +164,7 @@ code_change(_OldVsn, State, _Extra) ->
%%% Internal functions
%%%----------------------------------------------------------------------
run1([], Hook, Args) ->
run1([], _Hook, _Args) ->
ok;
run1([{_Seq, Module, Function} | Ls], Hook, Args) ->
case catch apply(Module, Function, Args) of
@ -179,7 +179,7 @@ run1([{_Seq, Module, Function} | Ls], Hook, Args) ->
end.
run_fold1([], Hook, Val, Args) ->
run_fold1([], _Hook, Val, _Args) ->
Val;
run_fold1([{_Seq, Module, Function} | Ls], Hook, Val, Args) ->
case catch apply(Module, Function, [Val | Args]) of

View File

@ -51,7 +51,7 @@
new = false, verify = false,
timer}).
%-define(DBGFSM, true).
%%-define(DBGFSM, true).
-ifdef(DBGFSM).
-define(FSMOPTS, [{debug, [trace]}]).
@ -247,7 +247,7 @@ open_socket1(Addr, Port) ->
%%----------------------------------------------------------------------
wait_for_stream({xmlstreamstart, Name, Attrs}, StateData) ->
wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
case {xml:get_attr_s("xmlns", Attrs),
xml:get_attr_s("xmlns:db", Attrs),
xml:get_attr_s("version", Attrs) == "1.0"} of
@ -332,7 +332,7 @@ wait_for_validation({xmlstreamelement, El}, StateData) ->
{next_state, wait_for_validation, StateData, ?FSMTIMEOUT*3}
end;
wait_for_validation({xmlstreamend, Name}, StateData) ->
wait_for_validation({xmlstreamend, _Name}, StateData) ->
?INFO_MSG("wait for validation: ~s -> ~s (xmlstreamend)",
[StateData#state.myname, StateData#state.server]),
{stop, normal, StateData};
@ -360,8 +360,8 @@ wait_for_features({xmlstreamelement, El}, StateData) ->
{xmlelement, "stream:features", _Attrs, Els} ->
{SASLEXT, StartTLS, StartTLSRequired} =
lists:foldl(
fun({xmlelement, "mechanisms", Attrs1, Els1} = El1,
{SEXT, STLS, STLSReq} = Acc) ->
fun({xmlelement, "mechanisms", Attrs1, Els1} = _El1,
{_SEXT, STLS, STLSReq} = Acc) ->
case xml:get_attr_s("xmlns", Attrs1) of
?NS_SASL ->
NewSEXT =
@ -377,8 +377,8 @@ wait_for_features({xmlstreamelement, El}, StateData) ->
_ ->
Acc
end;
({xmlelement, "starttls", Attrs1, Els1} = El1,
{SEXT, STLS, STLSReq} = Acc) ->
({xmlelement, "starttls", Attrs1, _Els1} = El1,
{SEXT, _STLS, _STLSReq} = Acc) ->
case xml:get_attr_s("xmlns", Attrs1) of
?NS_TLS ->
Req = case xml:get_subtag(El1, "required") of
@ -444,7 +444,7 @@ wait_for_features({xmlstreamelement, El}, StateData) ->
{stop, normal, StateData}
end;
wait_for_features({xmlstreamend, Name}, StateData) ->
wait_for_features({xmlstreamend, _Name}, StateData) ->
?INFO_MSG("wait_for_features: xmlstreamend", []),
{stop, normal, StateData};
@ -512,7 +512,7 @@ wait_for_auth_result({xmlstreamelement, El}, StateData) ->
{stop, normal, StateData}
end;
wait_for_auth_result({xmlstreamend, Name}, StateData) ->
wait_for_auth_result({xmlstreamend, _Name}, StateData) ->
?INFO_MSG("wait for auth result: xmlstreamend", []),
{stop, normal, StateData};
@ -574,7 +574,7 @@ wait_for_starttls_proceed({xmlstreamelement, El}, StateData) ->
{stop, normal, StateData}
end;
wait_for_starttls_proceed({xmlstreamend, Name}, StateData) ->
wait_for_starttls_proceed({xmlstreamend, _Name}, StateData) ->
?INFO_MSG("wait for starttls proceed: xmlstreamend", []),
{stop, normal, StateData};
@ -593,9 +593,9 @@ wait_for_starttls_proceed(closed, StateData) ->
{stop, normal, StateData}.
reopen_socket({xmlstreamelement, El}, StateData) ->
reopen_socket({xmlstreamelement, _El}, StateData) ->
{next_state, reopen_socket, StateData, ?FSMTIMEOUT};
reopen_socket({xmlstreamend, Name}, StateData) ->
reopen_socket({xmlstreamend, _Name}, StateData) ->
{next_state, reopen_socket, StateData, ?FSMTIMEOUT};
reopen_socket({xmlstreamerror, _}, StateData) ->
{next_state, reopen_socket, StateData, ?FSMTIMEOUT};
@ -607,7 +607,7 @@ reopen_socket(closed, StateData) ->
{next_state, open_socket, StateData, ?FSMTIMEOUT}.
%% This state is use to avoid reconnecting to often to bad sockets
wait_before_retry(Event, StateData) ->
wait_before_retry(_Event, StateData) ->
{next_state, wait_before_retry, StateData, ?FSMTIMEOUT}.
stream_established({xmlstreamelement, El}, StateData) ->
@ -637,7 +637,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
end,
{next_state, stream_established, StateData};
stream_established({xmlstreamend, Name}, StateData) ->
stream_established({xmlstreamend, _Name}, StateData) ->
?INFO_MSG("stream established: ~s -> ~s (xmlstreamend)",
[StateData#state.myname, StateData#state.server]),
{stop, normal, StateData};
@ -670,9 +670,9 @@ stream_established(closed, StateData) ->
%% {stop, Reason, NewStateData} |
%% {stop, Reason, Reply, NewStateData}
%%----------------------------------------------------------------------
%state_name(Event, From, StateData) ->
% Reply = ok,
% {reply, Reply, state_name, StateData}.
%%state_name(Event, From, StateData) ->
%% Reply = ok,
%% {reply, Reply, state_name, StateData}.
%%----------------------------------------------------------------------
%% Func: handle_event/3
@ -680,7 +680,7 @@ stream_established(closed, StateData) ->
%% {next_state, NextStateName, NextStateData, Timeout} |
%% {stop, Reason, NewStateData}
%%----------------------------------------------------------------------
handle_event(Event, StateName, StateData) ->
handle_event(_Event, StateName, StateData) ->
{next_state, StateName, StateData, get_timeout_interval(StateName)}.
%%----------------------------------------------------------------------
@ -692,11 +692,11 @@ handle_event(Event, StateName, StateData) ->
%% {stop, Reason, NewStateData} |
%% {stop, Reason, Reply, NewStateData}
%%----------------------------------------------------------------------
handle_sync_event(Event, From, StateName, StateData) ->
handle_sync_event(_Event, _From, StateName, StateData) ->
Reply = ok,
{reply, Reply, StateName, StateData, get_timeout_interval(StateName)}.
code_change(OldVsn, StateName, StateData, Extra) ->
code_change(_OldVsn, StateName, StateData, _Extra) ->
{ok, StateName, StateData}.
%%----------------------------------------------------------------------
@ -735,7 +735,7 @@ handle_info({timeout, Timer, _}, wait_before_retry,
?INFO_MSG("Reconnect delay expired: Will now retry to connect to ~s when needed.", [StateData#state.server]),
{stop, normal, StateData};
handle_info({timeout, Timer, _}, StateName,
handle_info({timeout, Timer, _}, _StateName,
#state{timer = Timer} = StateData) ->
?INFO_MSG("Closing connection with ~s: timeout", [StateData#state.server]),
{stop, normal, StateData};
@ -783,7 +783,7 @@ send_queue(StateData, Q) ->
{{value, El}, Q1} ->
send_element(StateData, El),
send_queue(StateData, Q1);
{empty, Q1} ->
{empty, _Q1} ->
ok
end.
@ -859,7 +859,7 @@ send_db_request(StateData) ->
case StateData#state.verify of
false ->
ok;
{Pid, Key2, SID} ->
{_Pid, Key2, SID} ->
send_element(StateData,
{xmlelement,
"db:verify",
@ -871,13 +871,13 @@ send_db_request(StateData) ->
{next_state, wait_for_validation, StateData#state{new = New}, ?FSMTIMEOUT*6}.
is_verify_res({xmlelement, Name, Attrs, Els}) when Name == "db:result" ->
is_verify_res({xmlelement, Name, Attrs, _Els}) when Name == "db:result" ->
{result,
xml:get_attr_s("to", Attrs),
xml:get_attr_s("from", Attrs),
xml:get_attr_s("id", Attrs),
xml:get_attr_s("type", Attrs)};
is_verify_res({xmlelement, Name, Attrs, Els}) when Name == "db:verify" ->
is_verify_res({xmlelement, Name, Attrs, _Els}) when Name == "db:verify" ->
{verify,
xml:get_attr_s("to", Attrs),
xml:get_attr_s("from", Attrs),
@ -888,7 +888,7 @@ is_verify_res(_) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SRV support
%% SRV support
-include_lib("kernel/include/inet.hrl").
@ -910,8 +910,8 @@ get_addr_port(Server) ->
[{Server,
ejabberd_config:get_local_option(outgoing_s2s_port)}];
AddrList ->
% Probabilities are not exactly proportional to weights
% for simplicity (higher weigths are overvalued)
%% Probabilities are not exactly proportional to weights
%% for simplicity (higher weigths are overvalued)
{A1, A2, A3} = now(),
random:seed(A1, A2, A3),
case (catch lists:map(

View File

@ -341,7 +341,7 @@ do_route(From, To, Packet) ->
"" ->
case Name of
"presence" ->
{Pass, Subsc} =
{Pass, _Subsc} =
case xml:get_attr_s("type", Attrs) of
"subscribe" ->
Reason = xml:get_path_s(

View File

@ -9,7 +9,7 @@
-module(idna).
-author('alexey@sevcom.net').
%-compile(export_all).
%%-compile(export_all).
-export([domain_utf8_to_ascii/1,
domain_ucs2_to_ascii/1]).
@ -49,7 +49,7 @@ domain_ucs2_to_ascii1(Domain) ->
string:strip(lists:flatmap(fun(P) -> [$. | P] end, ASCIIParts),
left, $.).
% Domain names are already nameprep'ed in ejabberd, so we skiping this step
%% Domain names are already nameprep'ed in ejabberd, so we skiping this step
to_ascii(Name) ->
false = lists:any(
fun(C) when
@ -129,7 +129,7 @@ punycode_encode1(Input, [M | SNonBasic], B, H, L, N, Delta, Bias, Out)
punycode_encode1(
Input, SNonBasic, B, NewH, L, M + 1, NewDelta + 1, NewBias, NewOut);
punycode_encode1(Input, SNonBasic, B, H, L, N, Delta, Bias, Out) ->
punycode_encode1(_Input, _SNonBasic, _B, _H, _L, _N, _Delta, _Bias, Out) ->
lists:reverse(Out).

View File

@ -94,7 +94,7 @@ process_xdb(User, Server, {xmlelement, Name, _Attrs, Els}) ->
end.
xdb_data(User, Server, {xmlcdata, _CData}) ->
xdb_data(_User, _Server, {xmlcdata, _CData}) ->
ok;
xdb_data(User, Server, {xmlelement, _Name, Attrs, _Els} = El) ->
From = jlib:make_jid(User, Server, ""),