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

* src/ejabberd_socket.erl: Added sockname/1 and peername/1

functions
* src/ejabberd_frontend_socket.erl: Likewise
* src/tls/tls.erl: Likewise
* src/ejabberd_zlib/ejabberd_zlib.erl: Likewise

* src/mod_private_odbc.erl: Private storage support using odbc
* src/odbc/pg.sql: Likewise

SVN Revision: 663
This commit is contained in:
Alexey Shchepin 2006-10-19 04:46:24 +00:00
parent 6b08aa6d30
commit cd7595e3f4
6 changed files with 92 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2006-10-17 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_socket.erl: Added sockname/1 and peername/1
functions
* src/ejabberd_frontend_socket.erl: Likewise
* src/tls/tls.erl: Likewise
* src/ejabberd_zlib/ejabberd_zlib.erl: Likewise
* src/mod_private_odbc.erl: Private storage support using odbc
* src/odbc/pg.sql: Likewise
2006-10-17 Mickael Remond <mickael.remond@process-one.net>
* src/ejabberd_auth_ldap.erl: LDAP authentication now allows to

View File

@ -25,7 +25,8 @@
get_sockmod/1,
get_peer_certificate/1,
get_verify_result/1,
close/1]).
close/1,
sockname/1, peername/1]).
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
@ -109,6 +110,12 @@ get_verify_result(FsmRef) ->
close(FsmRef) ->
gen_server:call(FsmRef, close).
sockname(FsmRef) ->
gen_server:call(FsmRef, sockname).
peername(FsmRef) ->
gen_server:call(FsmRef, peername).
%%====================================================================
%% gen_server callbacks
@ -205,6 +212,28 @@ handle_call(close, _From, State) ->
Reply = ok,
{stop, normal, Reply, State};
handle_call(sockname, _From, State) ->
#state{sockmod = SockMod, socket = Socket} = State,
Reply =
case SockMod of
gen_tcp ->
inet:sockname(Socket);
_ ->
SockMod:sockname(Socket)
end,
{reply, Reply, State};
handle_call(peername, _From, State) ->
#state{sockmod = SockMod, socket = Socket} = State,
Reply =
case SockMod of
gen_tcp ->
inet:peername(Socket);
_ ->
SockMod:peername(Socket)
end,
{reply, Reply, State};
handle_call(_Request, _From, State) ->
Reply = ok,
{reply, Reply, State}.

View File

@ -2,7 +2,7 @@
%%% File : ejabberd_socket.erl
%%% Author : Alexey Shchepin <alexey@process-one.net>
%%% Purpose : Socket with zlib and TLS support library
%%% Created : 23 Aug 2006 by Alexey Shchepin <alex@alex.sevcom.net>
%%% Created : 23 Aug 2006 by Alexey Shchepin <alexey@sevcom.net>
%%% Id : $Id$
%%%----------------------------------------------------------------------
@ -22,7 +22,8 @@
get_sockmod/1,
get_peer_certificate/1,
get_verify_result/1,
close/1]).
close/1,
sockname/1, peername/1]).
-record(socket_state, {sockmod, socket, receiver}).
@ -131,6 +132,22 @@ get_verify_result(SocketData) ->
close(SocketData) ->
ejabberd_receiver:close(SocketData#socket_state.receiver).
sockname(#socket_state{sockmod = SockMod, socket = Socket}) ->
case SockMod of
gen_tcp ->
inet:sockname(Socket);
_ ->
SockMod:sockname(Socket)
end.
peername(#socket_state{sockmod = SockMod, socket = Socket}) ->
case SockMod of
gen_tcp ->
inet:peername(Socket);
_ ->
SockMod:peername(Socket)
end.
%%====================================================================
%% Internal functions
%%====================================================================

View File

@ -17,6 +17,7 @@
send/2,
recv/2, recv/3, recv_data/2,
setopts/2,
sockname/1, peername/1,
controlling_process/2,
close/1]).
@ -124,6 +125,22 @@ setopts(#zlibsock{sockmod = SockMod, socket = Socket}, Opts) ->
SockMod:setopts(Socket, Opts)
end.
sockname(#zlibsock{sockmod = SockMod, socket = Socket}) ->
case SockMod of
gen_tcp ->
inet:sockname(Socket);
_ ->
SockMod:sockname(Socket)
end.
peername(#zlibsock{sockmod = SockMod, socket = Socket}) ->
case SockMod of
gen_tcp ->
inet:peername(Socket);
_ ->
SockMod:peername(Socket)
end.
controlling_process(#zlibsock{sockmod = SockMod, socket = Socket}, Pid) ->
SockMod:controlling_process(Socket, Pid).

View File

@ -118,6 +118,14 @@ CREATE TABLE privacy_list_data (
match_presence_out boolean NOT NULL
);
CREATE TABLE private_storage (
username text NOT NULL,
namespace text NOT NULL,
data text NOT NULL
);
CREATE INDEX i_private_storage_username ON private_storage USING btree (username);
CREATE UNIQUE INDEX i_private_storage_username_namespace ON private_storage USING btree (username, namespace);
--- To update from 0.9.8:

View File

@ -17,6 +17,7 @@
send/2,
recv/2, recv/3, recv_data/2,
setopts/2,
sockname/1, peername/1,
controlling_process/2,
close/1,
get_peer_certificate/1,
@ -180,6 +181,12 @@ send(#tlssock{tcpsock = TCPSocket, tlsport = Port}, Packet) ->
setopts(#tlssock{tcpsock = TCPSocket}, Opts) ->
inet:setopts(TCPSocket, Opts).
sockname(#tlssock{tcpsock = TCPSocket}) ->
inet:sockname(TCPSocket).
peername(#tlssock{tcpsock = TCPSocket}) ->
inet:peername(TCPSocket).
controlling_process(#tlssock{tcpsock = TCPSocket}, Pid) ->
gen_tcp:controlling_process(TCPSocket, Pid).