diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 9e893d0d898..4ede4bc72c1 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -1029,8 +1029,6 @@ static void dcerpc_connection_dead(struct dcecli_connection *conn, NTSTATUS stat TALLOC_FREE(conn->io_trigger); conn->io_trigger_pending = false; - conn->transport.recv_data = NULL; - dcerpc_shutdown_pipe(conn, status); /* all pending requests get the error */ @@ -1077,6 +1075,10 @@ static void dcerpc_recv_data(struct dcecli_connection *conn, DATA_BLOB *blob, NT { struct ncacn_packet pkt; + if (conn->dead) { + return; + } + if (NT_STATUS_IS_OK(status) && blob->length == 0) { status = NT_STATUS_UNEXPECTED_NETWORK_ERROR; } @@ -1192,8 +1194,6 @@ struct tevent_req *dcerpc_bind_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - p->conn->transport.recv_data = dcerpc_recv_data; - /* * we allocate a dcerpc_request so we can be in the same * request queue as normal requests @@ -1531,8 +1531,6 @@ static struct rpc_request *dcerpc_request_send(TALLOC_CTX *mem_ctx, { struct rpc_request *req; - p->conn->transport.recv_data = dcerpc_recv_data; - req = talloc_zero(mem_ctx, struct rpc_request); if (req == NULL) { return NULL; @@ -2080,8 +2078,6 @@ struct tevent_req *dcerpc_alter_context_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - p->conn->transport.recv_data = dcerpc_recv_data; - /* * we allocate a dcerpc_request so we can be in the same * request queue as normal requests @@ -2271,9 +2267,7 @@ static void dcerpc_transport_dead(struct dcecli_connection *c, NTSTATUS status) status = NT_STATUS_END_OF_FILE; } - if (c->transport.recv_data) { - c->transport.recv_data(c, NULL, status); - } + dcerpc_recv_data(c, NULL, status); } @@ -2412,9 +2406,7 @@ static void dcerpc_send_read_done(struct tevent_req *subreq) } } - if (p->transport.recv_data) { - p->transport.recv_data(p, &blob, NT_STATUS_OK); - } + dcerpc_recv_data(p, &blob, NT_STATUS_OK); } struct dcerpc_send_request_state { diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index e50933f56df..7075d8d878b 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -78,10 +78,6 @@ struct dcecli_connection { enum dcerpc_transport_t transport; void *private_data; - /* a callback to the dcerpc code when a full fragment - has been received */ - void (*recv_data)(struct dcecli_connection *, DATA_BLOB *, NTSTATUS status); - struct tstream_context *stream; /** to serialize write events */ struct tevent_queue *write_queue; diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c index f400af188a5..0224fdfb194 100644 --- a/source4/librpc/rpc/dcerpc_smb.c +++ b/source4/librpc/rpc/dcerpc_smb.c @@ -162,8 +162,6 @@ static void dcerpc_pipe_open_smb_done(struct tevent_req *subreq) c->transport.transport = NCACN_NP; c->transport.private_data = NULL; - c->transport.recv_data = NULL; - /* * Windows uses 4280 for ncacn_np, * so we also use it, this is what our diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c index 69eac171d43..9f69c7d3343 100644 --- a/source4/librpc/rpc/dcerpc_sock.c +++ b/source4/librpc/rpc/dcerpc_sock.c @@ -90,8 +90,6 @@ static void continue_socket_connect(struct composite_context *ctx) conn->transport.transport = s->transport; conn->transport.private_data = NULL; - conn->transport.recv_data = NULL; - /* * Windows uses 5840 for ncacn_ip_tcp, * so we also use it (for every transport which uses bsd sockets)