25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

* src/ejabberd_socket.erl: All XML socket operations moved here

* src/ejabberd_s2s_in.erl: Likewise

SVN Revision: 600
This commit is contained in:
Alexey Shchepin 2006-09-05 04:36:01 +00:00
parent 4d7cc9301a
commit 0fe9caa304
2 changed files with 14 additions and 4 deletions

View File

@ -140,9 +140,10 @@ wait_for_stream({xmlstreamstart, _Name, Attrs}, StateData) ->
SASL = SASL =
if if
StateData#state.tls_enabled -> StateData#state.tls_enabled ->
case tls:get_peer_certificate(StateData#state.socket) of case ejabberd_socket:get_peer_certificate(
StateData#state.socket) of
{ok, _Cert} -> {ok, _Cert} ->
case tls:get_verify_result( case ejabberd_socket:get_verify_result(
StateData#state.socket) of StateData#state.socket) of
0 -> 0 ->
[{xmlelement, "mechanisms", [{xmlelement, "mechanisms",
@ -222,9 +223,10 @@ wait_for_feature_request({xmlstreamelement, El}, StateData) ->
Auth = jlib:decode_base64(xml:get_cdata(Els)), Auth = jlib:decode_base64(xml:get_cdata(Els)),
AuthDomain = jlib:nameprep(Auth), AuthDomain = jlib:nameprep(Auth),
AuthRes = AuthRes =
case tls:get_peer_certificate(StateData#state.socket) of case ejabberd_socket:get_peer_certificate(
StateData#state.socket) of
{ok, Cert} -> {ok, Cert} ->
case tls:get_verify_result( case ejabberd_socket:get_verify_result(
StateData#state.socket) of StateData#state.socket) of
0 -> 0 ->
case AuthDomain of case AuthDomain of

View File

@ -18,6 +18,8 @@
send/2, send/2,
change_shaper/2, change_shaper/2,
get_sockmod/1, get_sockmod/1,
get_peer_certificate/1,
get_verify_result/1,
close/1]). close/1]).
-record(socket_state, {sockmod, socket, receiver}). -record(socket_state, {sockmod, socket, receiver}).
@ -93,6 +95,12 @@ change_shaper(SocketData, Shaper) ->
get_sockmod(SocketData) -> get_sockmod(SocketData) ->
SocketData#socket_state.sockmod. SocketData#socket_state.sockmod.
get_peer_certificate(SocketData) ->
tls:get_peer_certificate(SocketData#socket_state.socket).
get_verify_result(SocketData) ->
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).