static void smbd_smb2_read_pipe_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct smbd_smb2_read_state *state = tevent_req_data(req, struct smbd_smb2_read_state); NTSTATUS status; ssize_t nread = -1; bool is_data_outstanding; status = np_read_recv(subreq, &nread, &is_data_outstanding); TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { tevent_req_nterror(req, status); return; } if (nread == 0 && state->out_data.length != 0) { tevent_req_nterror(req, NT_STATUS_END_OF_FILE); return; } state->out_data.length = nread; state->out_remaining = 0; /* * TODO: add STATUS_BUFFER_OVERFLOW handling, once we also * handle it in SMB1 pipe_read_andx_done(). */ tevent_req_done(req); }
static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct smbd_smb2_ioctl_state *state = tevent_req_data(req, struct smbd_smb2_ioctl_state); NTSTATUS status; ssize_t nread = -1; bool is_data_outstanding = false; status = np_read_recv(subreq, &nread, &is_data_outstanding); DEBUG(10,("smbd_smb2_ioctl_pipe_read_done: np_read_recv nread = %d " "is_data_outstanding = %d, status = %s\n", (int)nread, (int)is_data_outstanding, nt_errstr(status) )); TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { tevent_req_nterror(req, status); return; } state->out_output.length = nread; if (is_data_outstanding) { tevent_req_nterror(req, STATUS_BUFFER_OVERFLOW); return; } tevent_req_done(req); }