NTSTATUS smb1cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, uint16_t *recv_flags2, uint16_t **setup, uint8_t min_setup, uint8_t *num_setup, uint8_t **param, uint32_t min_param, uint32_t *num_param, uint8_t **data, uint32_t min_data, uint32_t *num_data) { struct smb1cli_trans_state *state = tevent_req_data(req, struct smb1cli_trans_state); NTSTATUS status; smb1cli_trans_cleanup_primary(state); if (tevent_req_is_nterror(req, &status)) { if (!NT_STATUS_IS_ERR(status)) { status = NT_STATUS_INVALID_NETWORK_RESPONSE; } tevent_req_received(req); return status; } if ((state->num_rsetup < min_setup) || (state->rparam.total < min_param) || (state->rdata.total < min_data)) { tevent_req_received(req); return NT_STATUS_INVALID_NETWORK_RESPONSE; } if (recv_flags2 != NULL) { *recv_flags2 = state->recv_flags2; } if (setup != NULL) { *setup = talloc_move(mem_ctx, &state->rsetup); *num_setup = state->num_rsetup; } else { TALLOC_FREE(state->rsetup); } if (param != NULL) { *param = talloc_move(mem_ctx, &state->rparam.data); *num_param = state->rparam.total; } else { TALLOC_FREE(state->rparam.data); } if (data != NULL) { *data = talloc_move(mem_ctx, &state->rdata.data); *num_data = state->rdata.total; } else { TALLOC_FREE(state->rdata.data); } status = state->status; tevent_req_received(req); return status; }
static NTSTATUS smbd_smb2_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *out_data, uint32_t *out_remaining) { NTSTATUS status; struct smbd_smb2_read_state *state = tevent_req_data(req, struct smbd_smb2_read_state); if (tevent_req_is_nterror(req, &status)) { tevent_req_received(req); return status; } *out_data = state->out_data; talloc_steal(mem_ctx, out_data->data); *out_remaining = state->out_remaining; if (state->out_headers.length > 0) { talloc_steal(mem_ctx, state); talloc_set_destructor(state, smb2_smb2_read_state_deny_destructor); tevent_req_received(req); state->smb2req->queue_entry.sendfile_header = &state->out_headers; talloc_set_destructor(state, smb2_sendfile_send_data); } else { tevent_req_received(req); } return NT_STATUS_OK; }
static NTSTATUS smbd_smb2_ioctl_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *out_output, bool *disconnect) { NTSTATUS status = NT_STATUS_OK; struct smbd_smb2_ioctl_state *state = tevent_req_data(req, struct smbd_smb2_ioctl_state); enum tevent_req_state req_state; uint64_t err; *disconnect = state->disconnect; if ((tevent_req_is_error(req, &req_state, &err) == false) || (req_state == TEVENT_REQ_USER_ERROR)) { /* * Return output buffer to caller if the ioctl was successfully * processed, even if a user error occurred. Some ioctls return * data on failure. */ *out_output = state->out_output; talloc_steal(mem_ctx, out_output->data); } tevent_req_is_nterror(req, &status); tevent_req_received(req); return status; }
NTSTATUS tevent_req_simple_recv_ntstatus(struct tevent_req *req) { NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { return status; } return NT_STATUS_OK; }
NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd) { struct open_socket_out_state *state = tevent_req_data(req, struct open_socket_out_state); NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { return status; } *pfd = state->fd; state->fd = -1; return NT_STATUS_OK; }
static NTSTATUS smbd_smb2_notify_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *out_output_buffer) { NTSTATUS status; struct smbd_smb2_notify_state *state = tevent_req_data(req, struct smbd_smb2_notify_state); if (tevent_req_is_nterror(req, &status)) { tevent_req_received(req); return status; } *out_output_buffer = state->out_output_buffer; talloc_steal(mem_ctx, out_output_buffer->data); tevent_req_received(req); return NT_STATUS_OK; }
static NTSTATUS smbd_smb2_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, DATA_BLOB *out_data, uint32_t *out_remaining) { NTSTATUS status; struct smbd_smb2_read_state *state = tevent_req_data(req, struct smbd_smb2_read_state); if (tevent_req_is_nterror(req, &status)) { tevent_req_received(req); return status; } *out_data = state->out_data; talloc_steal(mem_ctx, out_data->data); *out_remaining = state->out_remaining; tevent_req_received(req); return NT_STATUS_OK; }
NTSTATUS cli_trans_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, uint16_t **setup, uint8_t *num_setup, uint8_t **param, uint32_t *num_param, uint8_t **data, uint32_t *num_data) { struct cli_trans_state *state = tevent_req_data( req, struct cli_trans_state); NTSTATUS status; if (tevent_req_is_nterror(req, &status)) { return status; } if (setup != NULL) { *setup = talloc_move(mem_ctx, &state->rsetup); *num_setup = state->num_rsetup; } else { TALLOC_FREE(state->rsetup); } if (param != NULL) { *param = talloc_move(mem_ctx, &state->rparam.data); *num_param = state->rparam.total; } else { TALLOC_FREE(state->rparam.data); } if (data != NULL) { *data = talloc_move(mem_ctx, &state->rdata.data); *num_data = state->rdata.total; } else { TALLOC_FREE(state->rdata.data); } return NT_STATUS_OK; }