mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
s4:librpc/rpc: use tevent_req_defer_callback() in dcerpc_alter_context_*
metze
This commit is contained in:
parent
6d631e52cf
commit
cd1d5a29d4
@ -1940,6 +1940,7 @@ uint32_t dcerpc_auth_level(struct dcecli_connection *c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct dcerpc_alter_context_state {
|
struct dcerpc_alter_context_state {
|
||||||
|
struct tevent_context *ev;
|
||||||
struct dcerpc_pipe *p;
|
struct dcerpc_pipe *p;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1967,6 +1968,7 @@ struct tevent_req *dcerpc_alter_context_send(TALLOC_CTX *mem_ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
state->ev = ev;
|
||||||
state->p = p;
|
state->p = p;
|
||||||
|
|
||||||
p->syntax = *syntax;
|
p->syntax = *syntax;
|
||||||
@ -2045,10 +2047,25 @@ static void dcerpc_alter_context_fail_handler(struct rpc_request *subreq)
|
|||||||
struct tevent_req *req =
|
struct tevent_req *req =
|
||||||
talloc_get_type_abort(subreq->async.private_data,
|
talloc_get_type_abort(subreq->async.private_data,
|
||||||
struct tevent_req);
|
struct tevent_req);
|
||||||
|
struct dcerpc_alter_context_state *state =
|
||||||
|
tevent_req_data(req,
|
||||||
|
struct dcerpc_alter_context_state);
|
||||||
NTSTATUS status = subreq->status;
|
NTSTATUS status = subreq->status;
|
||||||
|
|
||||||
TALLOC_FREE(subreq);
|
TALLOC_FREE(subreq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We trigger the callback in the next event run
|
||||||
|
* because the code in this file might trigger
|
||||||
|
* multiple request callbacks from within a single
|
||||||
|
* while loop.
|
||||||
|
*
|
||||||
|
* In order to avoid segfaults from within
|
||||||
|
* dcerpc_connection_dead() we call
|
||||||
|
* tevent_req_defer_callback().
|
||||||
|
*/
|
||||||
|
tevent_req_defer_callback(req, state->ev);
|
||||||
|
|
||||||
tevent_req_nterror(req, status);
|
tevent_req_nterror(req, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2072,6 +2089,18 @@ static void dcerpc_alter_context_recv_handler(struct rpc_request *subreq,
|
|||||||
talloc_steal(state, raw_packet->data);
|
talloc_steal(state, raw_packet->data);
|
||||||
TALLOC_FREE(subreq);
|
TALLOC_FREE(subreq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We trigger the callback in the next event run
|
||||||
|
* because the code in this file might trigger
|
||||||
|
* multiple request callbacks from within a single
|
||||||
|
* while loop.
|
||||||
|
*
|
||||||
|
* In order to avoid segfaults from within
|
||||||
|
* dcerpc_connection_dead() we call
|
||||||
|
* tevent_req_defer_callback().
|
||||||
|
*/
|
||||||
|
tevent_req_defer_callback(req, state->ev);
|
||||||
|
|
||||||
if (pkt->ptype == DCERPC_PKT_ALTER_RESP &&
|
if (pkt->ptype == DCERPC_PKT_ALTER_RESP &&
|
||||||
pkt->u.alter_resp.num_results == 1 &&
|
pkt->u.alter_resp.num_results == 1 &&
|
||||||
pkt->u.alter_resp.ctx_list[0].result != 0) {
|
pkt->u.alter_resp.ctx_list[0].result != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user