mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix all calls to functions of p1_tls application
This commit is contained in:
parent
66ad9e9722
commit
4dc80dddd4
@ -220,7 +220,7 @@ get_local_fqdn2() ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
hex(S) ->
|
hex(S) ->
|
||||||
sha:to_hexlist(S).
|
p1_sha:to_hexlist(S).
|
||||||
|
|
||||||
proplists_get_bin_value(Key, Pairs, Default) ->
|
proplists_get_bin_value(Key, Pairs, Default) ->
|
||||||
case proplists:get_value(Key, Pairs, Default) of
|
case proplists:get_value(Key, Pairs, Default) of
|
||||||
|
@ -339,7 +339,7 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
|
|||||||
CompressFeature =
|
CompressFeature =
|
||||||
case Zlib andalso
|
case Zlib andalso
|
||||||
((SockMod == gen_tcp) orelse
|
((SockMod == gen_tcp) orelse
|
||||||
(SockMod == tls)) of
|
(SockMod == p1_tls)) of
|
||||||
true ->
|
true ->
|
||||||
[#xmlel{name = <<"compression">>,
|
[#xmlel{name = <<"compression">>,
|
||||||
attrs = [{<<"xmlns">>, ?NS_FEATURE_COMPRESS}],
|
attrs = [{<<"xmlns">>, ?NS_FEATURE_COMPRESS}],
|
||||||
@ -524,7 +524,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
|
|||||||
of
|
of
|
||||||
true ->
|
true ->
|
||||||
DGen = fun (PW) ->
|
DGen = fun (PW) ->
|
||||||
sha:sha(<<(StateData#state.streamid)/binary, PW/binary>>)
|
p1_sha:sha(<<(StateData#state.streamid)/binary, PW/binary>>)
|
||||||
end,
|
end,
|
||||||
case ejabberd_auth:check_password_with_authmodule(U,
|
case ejabberd_auth:check_password_with_authmodule(U,
|
||||||
StateData#state.server,
|
StateData#state.server,
|
||||||
@ -709,7 +709,7 @@ wait_for_feature_request({xmlstreamelement, El},
|
|||||||
tls_enabled = true});
|
tls_enabled = true});
|
||||||
{?NS_COMPRESS, <<"compress">>}
|
{?NS_COMPRESS, <<"compress">>}
|
||||||
when Zlib == true,
|
when Zlib == true,
|
||||||
(SockMod == gen_tcp) or (SockMod == tls) ->
|
(SockMod == gen_tcp) or (SockMod == p1_tls) ->
|
||||||
case xml:get_subtag(El, <<"method">>) of
|
case xml:get_subtag(El, <<"method">>) of
|
||||||
false ->
|
false ->
|
||||||
send_element(StateData,
|
send_element(StateData,
|
||||||
@ -1738,11 +1738,11 @@ get_auth_tags([], U, P, D, R) ->
|
|||||||
get_conn_type(StateData) ->
|
get_conn_type(StateData) ->
|
||||||
case (StateData#state.sockmod):get_sockmod(StateData#state.socket) of
|
case (StateData#state.sockmod):get_sockmod(StateData#state.socket) of
|
||||||
gen_tcp -> c2s;
|
gen_tcp -> c2s;
|
||||||
tls -> c2s_tls;
|
p1_tls -> c2s_tls;
|
||||||
ezlib ->
|
ezlib ->
|
||||||
case ezlib:get_sockmod((StateData#state.socket)#socket_state.socket) of
|
case ezlib:get_sockmod((StateData#state.socket)#socket_state.socket) of
|
||||||
gen_tcp -> c2s_compressed;
|
gen_tcp -> c2s_compressed;
|
||||||
tls -> c2s_compressed_tls
|
p1_tls -> c2s_compressed_tls
|
||||||
end;
|
end;
|
||||||
ejabberd_http_poll -> http_poll;
|
ejabberd_http_poll -> http_poll;
|
||||||
ejabberd_http_bind -> http_bind;
|
ejabberd_http_bind -> http_bind;
|
||||||
|
@ -93,7 +93,7 @@ create_captcha(SID, From, To, Lang, Limiter, Args) ->
|
|||||||
Id = <<(randoms:get_string())/binary>>,
|
Id = <<(randoms:get_string())/binary>>,
|
||||||
B64Image = jlib:encode_base64((Image)),
|
B64Image = jlib:encode_base64((Image)),
|
||||||
JID = jlib:jid_to_string(From),
|
JID = jlib:jid_to_string(From),
|
||||||
CID = <<"sha1+", (sha:sha(Image))/binary,
|
CID = <<"sha1+", (p1_sha:sha(Image))/binary,
|
||||||
"@bob.xmpp.org">>,
|
"@bob.xmpp.org">>,
|
||||||
Data = #xmlel{name = <<"data">>,
|
Data = #xmlel{name = <<"data">>,
|
||||||
attrs =
|
attrs =
|
||||||
@ -185,7 +185,7 @@ create_captcha_x(SID, To, Lang, Limiter, HeadEls,
|
|||||||
{ok, Type, Key, Image} ->
|
{ok, Type, Key, Image} ->
|
||||||
Id = <<(randoms:get_string())/binary>>,
|
Id = <<(randoms:get_string())/binary>>,
|
||||||
B64Image = jlib:encode_base64((Image)),
|
B64Image = jlib:encode_base64((Image)),
|
||||||
CID = <<"sha1+", (sha:sha(Image))/binary,
|
CID = <<"sha1+", (p1_sha:sha(Image))/binary,
|
||||||
"@bob.xmpp.org">>,
|
"@bob.xmpp.org">>,
|
||||||
Data = #xmlel{name = <<"data">>,
|
Data = #xmlel{name = <<"data">>,
|
||||||
attrs =
|
attrs =
|
||||||
|
@ -170,20 +170,20 @@ init([Module, SockMod, Socket, Opts, Receiver]) ->
|
|||||||
%% Description: Handling call messages
|
%% Description: Handling call messages
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
handle_call({starttls, TLSOpts}, _From, State) ->
|
handle_call({starttls, TLSOpts}, _From, State) ->
|
||||||
{ok, TLSSocket} = tls:tcp_to_tls(State#state.socket, TLSOpts),
|
{ok, TLSSocket} = p1_tls:tcp_to_tls(State#state.socket, TLSOpts),
|
||||||
ejabberd_receiver:starttls(State#state.receiver, TLSSocket),
|
ejabberd_receiver:starttls(State#state.receiver, TLSSocket),
|
||||||
Reply = ok,
|
Reply = ok,
|
||||||
{reply, Reply, State#state{socket = TLSSocket, sockmod = tls},
|
{reply, Reply, State#state{socket = TLSSocket, sockmod = p1_tls},
|
||||||
?HIBERNATE_TIMEOUT};
|
?HIBERNATE_TIMEOUT};
|
||||||
|
|
||||||
handle_call({starttls, TLSOpts, Data}, _From, State) ->
|
handle_call({starttls, TLSOpts, Data}, _From, State) ->
|
||||||
{ok, TLSSocket} = tls:tcp_to_tls(State#state.socket, TLSOpts),
|
{ok, TLSSocket} = p1_tls:tcp_to_tls(State#state.socket, TLSOpts),
|
||||||
ejabberd_receiver:starttls(State#state.receiver, TLSSocket),
|
ejabberd_receiver:starttls(State#state.receiver, TLSSocket),
|
||||||
catch (State#state.sockmod):send(
|
catch (State#state.sockmod):send(
|
||||||
State#state.socket, Data),
|
State#state.socket, Data),
|
||||||
Reply = ok,
|
Reply = ok,
|
||||||
{reply, Reply,
|
{reply, Reply,
|
||||||
State#state{socket = TLSSocket, sockmod = tls},
|
State#state{socket = TLSSocket, sockmod = p1_tls},
|
||||||
?HIBERNATE_TIMEOUT};
|
?HIBERNATE_TIMEOUT};
|
||||||
|
|
||||||
handle_call({compress, Data}, _From, State) ->
|
handle_call({compress, Data}, _From, State) ->
|
||||||
@ -210,10 +210,10 @@ handle_call(get_sockmod, _From, State) ->
|
|||||||
Reply = State#state.sockmod,
|
Reply = State#state.sockmod,
|
||||||
{reply, Reply, State, ?HIBERNATE_TIMEOUT};
|
{reply, Reply, State, ?HIBERNATE_TIMEOUT};
|
||||||
handle_call(get_peer_certificate, _From, State) ->
|
handle_call(get_peer_certificate, _From, State) ->
|
||||||
Reply = tls:get_peer_certificate(State#state.socket),
|
Reply = p1_tls:get_peer_certificate(State#state.socket),
|
||||||
{reply, Reply, State, ?HIBERNATE_TIMEOUT};
|
{reply, Reply, State, ?HIBERNATE_TIMEOUT};
|
||||||
handle_call(get_verify_result, _From, State) ->
|
handle_call(get_verify_result, _From, State) ->
|
||||||
Reply = tls:get_verify_result(State#state.socket),
|
Reply = p1_tls:get_verify_result(State#state.socket),
|
||||||
{reply, Reply, State, ?HIBERNATE_TIMEOUT};
|
{reply, Reply, State, ?HIBERNATE_TIMEOUT};
|
||||||
handle_call(close, _From, State) ->
|
handle_call(close, _From, State) ->
|
||||||
ejabberd_receiver:close(State#state.receiver),
|
ejabberd_receiver:close(State#state.receiver),
|
||||||
@ -286,9 +286,9 @@ check_starttls(SockMod, Socket, Receiver, Opts) ->
|
|||||||
end, Opts),
|
end, Opts),
|
||||||
if
|
if
|
||||||
TLSEnabled ->
|
TLSEnabled ->
|
||||||
{ok, TLSSocket} = tls:tcp_to_tls(Socket, TLSOpts),
|
{ok, TLSSocket} = p1_tls:tcp_to_tls(Socket, TLSOpts),
|
||||||
ejabberd_receiver:starttls(Receiver, TLSSocket),
|
ejabberd_receiver:starttls(Receiver, TLSSocket),
|
||||||
{tls, TLSSocket};
|
{p1_tls, TLSSocket};
|
||||||
true ->
|
true ->
|
||||||
{SockMod, Socket}
|
{SockMod, Socket}
|
||||||
end.
|
end.
|
||||||
|
@ -99,9 +99,9 @@ init({SockMod, Socket}, Opts) ->
|
|||||||
TLSOpts = [verify_none | TLSOpts1],
|
TLSOpts = [verify_none | TLSOpts1],
|
||||||
{SockMod1, Socket1} = if TLSEnabled ->
|
{SockMod1, Socket1} = if TLSEnabled ->
|
||||||
inet:setopts(Socket, [{recbuf, 8192}]),
|
inet:setopts(Socket, [{recbuf, 8192}]),
|
||||||
{ok, TLSSocket} = tls:tcp_to_tls(Socket,
|
{ok, TLSSocket} = p1_tls:tcp_to_tls(Socket,
|
||||||
TLSOpts),
|
TLSOpts),
|
||||||
{tls, TLSSocket};
|
{p1_tls, TLSSocket};
|
||||||
true -> {SockMod, Socket}
|
true -> {SockMod, Socket}
|
||||||
end,
|
end,
|
||||||
case SockMod1 of
|
case SockMod1 of
|
||||||
@ -326,8 +326,8 @@ get_transfer_protocol(SockMod, HostPort) ->
|
|||||||
{gen_tcp, []} -> {Host, 80, http};
|
{gen_tcp, []} -> {Host, 80, http};
|
||||||
{gen_tcp, [Port]} ->
|
{gen_tcp, [Port]} ->
|
||||||
{Host, jlib:binary_to_integer(Port), http};
|
{Host, jlib:binary_to_integer(Port), http};
|
||||||
{tls, []} -> {Host, 443, https};
|
{p1_tls, []} -> {Host, 443, https};
|
||||||
{tls, [Port]} ->
|
{p1_tls, [Port]} ->
|
||||||
{Host, jlib:binary_to_integer(Port), https}
|
{Host, jlib:binary_to_integer(Port), https}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ process_request(Data, IP) ->
|
|||||||
"dressing' xmlns='",
|
"dressing' xmlns='",
|
||||||
(?NS_HTTP_BIND)/binary, "'/>">>};
|
(?NS_HTTP_BIND)/binary, "'/>">>};
|
||||||
XmppDomain ->
|
XmppDomain ->
|
||||||
Sid = sha:sha(term_to_binary({now(), make_ref()})),
|
Sid = p1_sha:sha(term_to_binary({now(), make_ref()})),
|
||||||
case start(XmppDomain, Sid, <<"">>, IP) of
|
case start(XmppDomain, Sid, <<"">>, IP) of
|
||||||
{error, _} ->
|
{error, _} ->
|
||||||
{500, ?HEADER,
|
{500, ?HEADER,
|
||||||
@ -615,7 +615,7 @@ process_http_put(#http_put{rid = Rid, attrs = Attrs,
|
|||||||
case StateData#state.key of
|
case StateData#state.key of
|
||||||
<<"">> -> true;
|
<<"">> -> true;
|
||||||
OldKey ->
|
OldKey ->
|
||||||
NextKey = sha:sha(Key),
|
NextKey = p1_sha:sha(Key),
|
||||||
?DEBUG("Key/OldKey/NextKey: ~s/~s/~s",
|
?DEBUG("Key/OldKey/NextKey: ~s/~s/~s",
|
||||||
[Key, OldKey, NextKey]),
|
[Key, OldKey, NextKey]),
|
||||||
if OldKey == NextKey -> true;
|
if OldKey == NextKey -> true;
|
||||||
|
@ -112,7 +112,7 @@ process([],
|
|||||||
{ok, ID1, Key, NewKey, Packet} ->
|
{ok, ID1, Key, NewKey, Packet} ->
|
||||||
ID = if
|
ID = if
|
||||||
(ID1 == <<"0">>) or (ID1 == <<"mobile">>) ->
|
(ID1 == <<"0">>) or (ID1 == <<"mobile">>) ->
|
||||||
NewID = sha:sha(term_to_binary({now(), make_ref()})),
|
NewID = p1_sha:sha(term_to_binary({now(), make_ref()})),
|
||||||
{ok, Pid} = start(NewID, <<"">>, IP),
|
{ok, Pid} = start(NewID, <<"">>, IP),
|
||||||
mnesia:transaction(
|
mnesia:transaction(
|
||||||
fun() ->
|
fun() ->
|
||||||
|
@ -49,8 +49,8 @@
|
|||||||
-include("logger.hrl").
|
-include("logger.hrl").
|
||||||
|
|
||||||
-record(state,
|
-record(state,
|
||||||
{socket :: inet:socket() | tls:tls_socket() | ezlib:zlib_socket(),
|
{socket :: inet:socket() | p1_tls:tls_socket() | ezlib:zlib_socket(),
|
||||||
sock_mod = gen_tcp :: gen_tcp | tls | ezlib,
|
sock_mod = gen_tcp :: gen_tcp | p1_tls | ezlib,
|
||||||
shaper_state = none :: shaper:shaper(),
|
shaper_state = none :: shaper:shaper(),
|
||||||
c2s_pid :: pid(),
|
c2s_pid :: pid(),
|
||||||
max_stanza_size = infinity :: non_neg_integer() | infinity,
|
max_stanza_size = infinity :: non_neg_integer() | infinity,
|
||||||
@ -102,7 +102,7 @@ change_shaper(Pid, Shaper) ->
|
|||||||
|
|
||||||
reset_stream(Pid) -> do_call(Pid, reset_stream).
|
reset_stream(Pid) -> do_call(Pid, reset_stream).
|
||||||
|
|
||||||
-spec starttls(pid(), iodata()) -> {ok, tls:tls_socket()} | {error, any()}.
|
-spec starttls(pid(), iodata()) -> {ok, p1_tls:tls_socket()} | {error, any()}.
|
||||||
|
|
||||||
starttls(Pid, TLSSocket) ->
|
starttls(Pid, TLSSocket) ->
|
||||||
do_call(Pid, {starttls, TLSSocket}).
|
do_call(Pid, {starttls, TLSSocket}).
|
||||||
@ -163,9 +163,9 @@ handle_call({starttls, TLSSocket}, _From,
|
|||||||
NewXMLStreamState = xml_stream:new(C2SPid,
|
NewXMLStreamState = xml_stream:new(C2SPid,
|
||||||
MaxStanzaSize),
|
MaxStanzaSize),
|
||||||
NewState = State#state{socket = TLSSocket,
|
NewState = State#state{socket = TLSSocket,
|
||||||
sock_mod = tls,
|
sock_mod = p1_tls,
|
||||||
xml_stream_state = NewXMLStreamState},
|
xml_stream_state = NewXMLStreamState},
|
||||||
case tls:recv_data(TLSSocket, <<"">>) of
|
case p1_tls:recv_data(TLSSocket, <<"">>) of
|
||||||
{ok, TLSData} ->
|
{ok, TLSData} ->
|
||||||
{reply, ok, process_data(TLSData, NewState), ?HIBERNATE_TIMEOUT};
|
{reply, ok, process_data(TLSData, NewState), ?HIBERNATE_TIMEOUT};
|
||||||
{error, _Reason} ->
|
{error, _Reason} ->
|
||||||
@ -239,8 +239,8 @@ handle_info({Tag, _TCPSocket, Data},
|
|||||||
when (Tag == tcp) or (Tag == ssl) or
|
when (Tag == tcp) or (Tag == ssl) or
|
||||||
(Tag == ejabberd_xml) ->
|
(Tag == ejabberd_xml) ->
|
||||||
case SockMod of
|
case SockMod of
|
||||||
tls ->
|
p1_tls ->
|
||||||
case tls:recv_data(Socket, Data) of
|
case p1_tls:recv_data(Socket, Data) of
|
||||||
{ok, TLSData} ->
|
{ok, TLSData} ->
|
||||||
{noreply, process_data(TLSData, State),
|
{noreply, process_data(TLSData, State),
|
||||||
?HIBERNATE_TIMEOUT};
|
?HIBERNATE_TIMEOUT};
|
||||||
|
@ -249,7 +249,7 @@ wait_for_stream({xmlstreamstart, _Name, Attrs},
|
|||||||
end,
|
end,
|
||||||
case SASL of
|
case SASL of
|
||||||
{error_cert_verif, CertVerifyResult, Certificate} ->
|
{error_cert_verif, CertVerifyResult, Certificate} ->
|
||||||
CertError = tls:get_cert_verify_string(CertVerifyResult,
|
CertError = p1_tls:get_cert_verify_string(CertVerifyResult,
|
||||||
Certificate),
|
Certificate),
|
||||||
RemoteServer = xml:get_attr_s(<<"from">>, Attrs),
|
RemoteServer = xml:get_attr_s(<<"from">>, Attrs),
|
||||||
?INFO_MSG("Closing s2s connection: ~s <--> ~s (~s)",
|
?INFO_MSG("Closing s2s connection: ~s <--> ~s (~s)",
|
||||||
|
@ -197,7 +197,7 @@ wait_for_handshake({xmlstreamelement, El}, StateData) ->
|
|||||||
#xmlel{name = Name, children = Els} = El,
|
#xmlel{name = Name, children = Els} = El,
|
||||||
case {Name, xml:get_cdata(Els)} of
|
case {Name, xml:get_cdata(Els)} of
|
||||||
{<<"handshake">>, Digest} ->
|
{<<"handshake">>, Digest} ->
|
||||||
case sha:sha(<<(StateData#state.streamid)/binary,
|
case p1_sha:sha(<<(StateData#state.streamid)/binary,
|
||||||
(StateData#state.password)/binary>>)
|
(StateData#state.password)/binary>>)
|
||||||
of
|
of
|
||||||
Digest ->
|
Digest ->
|
||||||
|
@ -53,10 +53,10 @@
|
|||||||
|
|
||||||
-type sockmod() :: ejabberd_http_poll |
|
-type sockmod() :: ejabberd_http_poll |
|
||||||
ejabberd_http_bind |
|
ejabberd_http_bind |
|
||||||
gen_tcp | tls | ezlib.
|
gen_tcp | p1_tls | ezlib.
|
||||||
-type receiver() :: pid () | atom().
|
-type receiver() :: pid () | atom().
|
||||||
-type socket() :: pid() | inet:socket() |
|
-type socket() :: pid() | inet:socket() |
|
||||||
tls:tls_socket() |
|
p1_tls:tls_socket() |
|
||||||
ezlib:zlib_socket() |
|
ezlib:zlib_socket() |
|
||||||
ejabberd_http_bind:bind_socket() |
|
ejabberd_http_bind:bind_socket() |
|
||||||
ejabberd_http_poll:poll_socket().
|
ejabberd_http_poll:poll_socket().
|
||||||
@ -150,15 +150,15 @@ connect(Addr, Port, Opts, Timeout) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
starttls(SocketData, TLSOpts) ->
|
starttls(SocketData, TLSOpts) ->
|
||||||
{ok, TLSSocket} = tls:tcp_to_tls(SocketData#socket_state.socket, TLSOpts),
|
{ok, TLSSocket} = p1_tls:tcp_to_tls(SocketData#socket_state.socket, TLSOpts),
|
||||||
ejabberd_receiver:starttls(SocketData#socket_state.receiver, TLSSocket),
|
ejabberd_receiver:starttls(SocketData#socket_state.receiver, TLSSocket),
|
||||||
SocketData#socket_state{socket = TLSSocket, sockmod = tls}.
|
SocketData#socket_state{socket = TLSSocket, sockmod = p1_tls}.
|
||||||
|
|
||||||
starttls(SocketData, TLSOpts, Data) ->
|
starttls(SocketData, TLSOpts, Data) ->
|
||||||
{ok, TLSSocket} = tls:tcp_to_tls(SocketData#socket_state.socket, TLSOpts),
|
{ok, TLSSocket} = p1_tls:tcp_to_tls(SocketData#socket_state.socket, TLSOpts),
|
||||||
ejabberd_receiver:starttls(SocketData#socket_state.receiver, TLSSocket),
|
ejabberd_receiver:starttls(SocketData#socket_state.receiver, TLSSocket),
|
||||||
send(SocketData, Data),
|
send(SocketData, Data),
|
||||||
SocketData#socket_state{socket = TLSSocket, sockmod = tls}.
|
SocketData#socket_state{socket = TLSSocket, sockmod = p1_tls}.
|
||||||
|
|
||||||
compress(SocketData) -> compress(SocketData, undefined).
|
compress(SocketData) -> compress(SocketData, undefined).
|
||||||
|
|
||||||
@ -221,10 +221,10 @@ get_sockmod(SocketData) ->
|
|||||||
SocketData#socket_state.sockmod.
|
SocketData#socket_state.sockmod.
|
||||||
|
|
||||||
get_peer_certificate(SocketData) ->
|
get_peer_certificate(SocketData) ->
|
||||||
tls:get_peer_certificate(SocketData#socket_state.socket).
|
p1_tls:get_peer_certificate(SocketData#socket_state.socket).
|
||||||
|
|
||||||
get_verify_result(SocketData) ->
|
get_verify_result(SocketData) ->
|
||||||
tls:get_verify_result(SocketData#socket_state.socket).
|
p1_tls:get_verify_result(SocketData#socket_state.socket).
|
||||||
|
|
||||||
close(SocketData) ->
|
close(SocketData) ->
|
||||||
ejabberd_receiver:close(SocketData#socket_state.receiver).
|
ejabberd_receiver:close(SocketData#socket_state.receiver).
|
||||||
|
@ -469,10 +469,10 @@ make_disco_hash(DiscoEls, Algo) ->
|
|||||||
jlib:encode_base64(case Algo of
|
jlib:encode_base64(case Algo of
|
||||||
md5 -> crypto:md5(Concat);
|
md5 -> crypto:md5(Concat);
|
||||||
sha1 -> crypto:sha(Concat);
|
sha1 -> crypto:sha(Concat);
|
||||||
sha224 -> sha:sha224(Concat);
|
sha224 -> p1_sha:sha224(Concat);
|
||||||
sha256 -> sha:sha256(Concat);
|
sha256 -> p1_sha:sha256(Concat);
|
||||||
sha384 -> sha:sha384(Concat);
|
sha384 -> p1_sha:sha384(Concat);
|
||||||
sha512 -> sha:sha512(Concat)
|
sha512 -> p1_sha:sha512(Concat)
|
||||||
end).
|
end).
|
||||||
|
|
||||||
check_hash(Caps, Els) ->
|
check_hash(Caps, Els) ->
|
||||||
|
@ -818,7 +818,7 @@ flush() -> receive _ -> flush() after 0 -> ok end.
|
|||||||
|
|
||||||
iq_get_unique(From) ->
|
iq_get_unique(From) ->
|
||||||
{xmlcdata,
|
{xmlcdata,
|
||||||
sha:sha(term_to_binary([From, now(),
|
p1_sha:sha(term_to_binary([From, now(),
|
||||||
randoms:get_string()]))}.
|
randoms:get_string()]))}.
|
||||||
|
|
||||||
get_nick(ServerHost, Host, From) ->
|
get_nick(ServerHost, Host, From) ->
|
||||||
|
@ -190,7 +190,7 @@ process_iq(InitiatorJID,
|
|||||||
jlib:jid_to_string(jlib:jid_tolower(TargetJID)),
|
jlib:jid_to_string(jlib:jid_tolower(TargetJID)),
|
||||||
Initiator =
|
Initiator =
|
||||||
jlib:jid_to_string(jlib:jid_tolower(InitiatorJID)),
|
jlib:jid_to_string(jlib:jid_tolower(InitiatorJID)),
|
||||||
SHA1 = sha:sha(<<SID/binary, Initiator/binary, Target/binary>>),
|
SHA1 = p1_sha:sha(<<SID/binary, Initiator/binary, Target/binary>>),
|
||||||
case mod_proxy65_sm:activate_stream(SHA1, InitiatorJID,
|
case mod_proxy65_sm:activate_stream(SHA1, InitiatorJID,
|
||||||
TargetJID, ServerHost)
|
TargetJID, ServerHost)
|
||||||
of
|
of
|
||||||
|
@ -147,7 +147,7 @@ process_local_iq(From, To, #iq{type = Type} = IQ) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
roster_hash(Items) ->
|
roster_hash(Items) ->
|
||||||
sha:sha(term_to_binary(lists:sort([R#roster{groups =
|
p1_sha:sha(term_to_binary(lists:sort([R#roster{groups =
|
||||||
lists:sort(Grs)}
|
lists:sort(Grs)}
|
||||||
|| R = #roster{groups = Grs}
|
|| R = #roster{groups = Grs}
|
||||||
<- Items]))).
|
<- Items]))).
|
||||||
@ -211,7 +211,7 @@ write_roster_version_t(LUser, LServer) ->
|
|||||||
write_roster_version(LUser, LServer, true).
|
write_roster_version(LUser, LServer, true).
|
||||||
|
|
||||||
write_roster_version(LUser, LServer, InTransaction) ->
|
write_roster_version(LUser, LServer, InTransaction) ->
|
||||||
Ver = sha:sha(term_to_binary(now())),
|
Ver = p1_sha:sha(term_to_binary(now())),
|
||||||
write_roster_version(LUser, LServer, InTransaction, Ver,
|
write_roster_version(LUser, LServer, InTransaction, Ver,
|
||||||
gen_mod:db_type(LServer, ?MODULE)),
|
gen_mod:db_type(LServer, ?MODULE)),
|
||||||
Ver.
|
Ver.
|
||||||
|
@ -70,7 +70,7 @@ vcard_set(LUser, LServer, VCARD) ->
|
|||||||
<<>> -> remove_xupdate(LUser, LServer);
|
<<>> -> remove_xupdate(LUser, LServer);
|
||||||
BinVal ->
|
BinVal ->
|
||||||
add_xupdate(LUser, LServer,
|
add_xupdate(LUser, LServer,
|
||||||
sha:sha(jlib:decode_base64(BinVal)))
|
p1_sha:sha(jlib:decode_base64(BinVal)))
|
||||||
end,
|
end,
|
||||||
ejabberd_sm:force_update_presence(US).
|
ejabberd_sm:force_update_presence(US).
|
||||||
|
|
||||||
|
@ -1096,7 +1096,7 @@ sasl_new(<<"DIGEST-MD5">>, User, Server, Password) ->
|
|||||||
end}.
|
end}.
|
||||||
|
|
||||||
hex(S) ->
|
hex(S) ->
|
||||||
sha:to_hexlist(S).
|
p1_sha:to_hexlist(S).
|
||||||
|
|
||||||
response(User, Passwd, Nonce, AuthzId, Realm, CNonce,
|
response(User, Passwd, Nonce, AuthzId, Realm, CNonce,
|
||||||
DigestURI, NC, QOP, A2Prefix) ->
|
DigestURI, NC, QOP, A2Prefix) ->
|
||||||
@ -1188,7 +1188,7 @@ make_iq_result(#iq{from = From} = IQ) ->
|
|||||||
|
|
||||||
socks5_connect(#streamhost{host = Host, port = Port},
|
socks5_connect(#streamhost{host = Host, port = Port},
|
||||||
{SID, JID1, JID2}) ->
|
{SID, JID1, JID2}) ->
|
||||||
Hash = sha:sha([SID, jlib:jid_to_string(JID1), jlib:jid_to_string(JID2)]),
|
Hash = p1_sha:sha([SID, jlib:jid_to_string(JID1), jlib:jid_to_string(JID2)]),
|
||||||
{ok, Sock} = gen_tcp:connect(binary_to_list(Host), Port,
|
{ok, Sock} = gen_tcp:connect(binary_to_list(Host), Port,
|
||||||
[binary, {active, false}]),
|
[binary, {active, false}]),
|
||||||
Init = <<?VERSION_5, 1, ?AUTH_ANONYMOUS>>,
|
Init = <<?VERSION_5, 1, ?AUTH_ANONYMOUS>>,
|
||||||
|
Loading…
Reference in New Issue
Block a user