diff options
author | Samuel Cabrero <scabrero@suse.de> | 2019-01-24 20:25:58 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-10-18 16:07:37 +0000 |
commit | 85de73354d982861cc863b4682a8043c22797faa (patch) | |
tree | 38f79bea60c1a7bdd14bc59cf3a206c016b39110 /source4/rpc_server | |
parent | 55ad4ae7ffcb3221675070b9cb939c29e00f25f4 (diff) | |
download | samba-85de73354d982861cc863b4682a8043c22797faa.tar.gz |
s4:rpc_server: Add transport termination function pointer
As the dcesrv_terminate_connection function will be moved to the shared
rpc server core library, hide the stream_terminate_connection call behind
a function pointer.
The s3 implementation will define its own termination function.
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 16 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.h | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index e125f61cdee..af39a997985 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -2570,9 +2570,6 @@ static void dcesrv_terminate_connection(struct dcesrv_connection *dce_conn, cons { struct dcesrv_context *dce_ctx = dce_conn->dce_ctx; struct dcesrv_auth *a = NULL; - struct stream_connection *srv_conn; - srv_conn = talloc_get_type(dce_conn->transport.private_data, - struct stream_connection); dce_conn->wait_send = NULL; dce_conn->wait_recv = NULL; @@ -2591,7 +2588,8 @@ static void dcesrv_terminate_connection(struct dcesrv_connection *dce_conn, cons char *full_reason = talloc_asprintf(dce_conn, "dcesrv: %s", reason); DLIST_REMOVE(dce_ctx->broken_connections, dce_conn); - stream_terminate_connection(srv_conn, full_reason ? full_reason : reason); + dce_conn->transport.terminate_connection(dce_conn, + full_reason ? full_reason : reason); return; } @@ -2841,6 +2839,7 @@ static void dcesrv_sock_accept(struct stream_connection *srv_conn) dcesrv_conn->transport.private_data = srv_conn; dcesrv_conn->transport.report_output_data = dcesrv_sock_report_output_data; + dcesrv_conn->transport.terminate_connection = dcesrv_transport_terminate_connection; TALLOC_FREE(srv_conn->event.fde); @@ -3475,3 +3474,12 @@ NTSTATUS dcesrv_gensec_prepare(TALLOC_CTX *mem_ctx, NULL, out); } + +void dcesrv_transport_terminate_connection(struct dcesrv_connection *dce_conn, + const char *reason) +{ + struct stream_connection *srv_conn = + talloc_get_type_abort(dce_conn->transport.private_data, + struct stream_connection); + stream_terminate_connection(srv_conn, reason); +} diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 3fc32750b44..0f83fef6d31 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -271,6 +271,8 @@ struct dcesrv_connection { struct { void *private_data; void (*report_output_data)(struct dcesrv_connection *); + void (*terminate_connection)(struct dcesrv_connection *, + const char *); } transport; struct tstream_context *stream; |