s4:rpc_server: remember the local and remote address
authorStefan Metzmacher <metze@samba.org>
Mon, 26 Apr 2010 11:06:07 +0000 (13:06 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 27 Apr 2010 11:00:25 +0000 (13:00 +0200)
metze

source4/rpc_server/dcerpc_server.c
source4/rpc_server/dcerpc_server.h
source4/rpc_server/service_rpc.c

index bc06c065dae54d8583070ffc533fce005773e322..c9474233cb8e473d2e89a88dc029559f0ab2e3d4 100644 (file)
@@ -1139,6 +1139,16 @@ static int dcesrv_call_dequeue(struct dcesrv_call_state *call)
        return 0;
 }
 
+_PUBLIC_ const struct tsocket_address *dcesrv_connection_get_local_address(struct dcesrv_connection *conn)
+{
+       return conn->local_address;
+}
+
+_PUBLIC_ const struct tsocket_address *dcesrv_connection_get_remote_address(struct dcesrv_connection *conn)
+{
+       return conn->remote_address;
+}
+
 /*
   process some input to a dcerpc endpoint server.
 */
index 0628730f263af70057708475511a74804e29a406..7e82548395e15d8feaacbc38f227a945d6ddbfee 100644 (file)
@@ -224,6 +224,9 @@ struct dcesrv_connection {
 
        struct tstream_context *stream;
        struct tevent_queue *send_queue;
+
+       const struct tsocket_address *local_address;
+       const struct tsocket_address *remote_address;
 };
 
 
@@ -334,6 +337,8 @@ struct dcesrv_handle *dcesrv_handle_fetch(
 struct socket_address *dcesrv_connection_get_my_addr(struct dcesrv_connection *conn, TALLOC_CTX *mem_ctx);
 
 struct socket_address *dcesrv_connection_get_peer_addr(struct dcesrv_connection *conn, TALLOC_CTX *mem_ctx);
+const struct tsocket_address *dcesrv_connection_get_local_address(struct dcesrv_connection *conn);
+const struct tsocket_address *dcesrv_connection_get_remote_address(struct dcesrv_connection *conn);
 
 NTSTATUS dcesrv_fetch_session_key(struct dcesrv_connection *p, DATA_BLOB *session_key);
 
index 6485d9ef97d075cf928925e1e2892574a4b52a93..0cc930ebc5f55466c468f95803ceb397ae407d9f 100644 (file)
@@ -403,6 +403,9 @@ static void dcesrv_sock_accept(struct stream_connection *srv_conn)
                return;
        }
 
+       dcesrv_conn->local_address = srv_conn->local_address;
+       dcesrv_conn->remote_address = srv_conn->remote_address;
+
        srv_conn->private_data = dcesrv_conn;
 
        irpc_add_name(srv_conn->msg_ctx, "rpc_server");