From d595d2e5af1a6b85d069ce621a85648d1213c360 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 23 May 2012 15:23:23 +0200 Subject: s3:smbd: use nt_status_np_pipe for smb1 metze --- source3/smbd/ipc.c | 31 ++++++++++++++++++++++++------- source3/smbd/pipes.c | 2 ++ source3/smbd/smb2_ioctl.c | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) (limited to 'source3') diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index c795d289ea..3d9b174cf9 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -301,11 +301,23 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq) status = np_write_recv(subreq, &nwritten); TALLOC_FREE(subreq); - if (!NT_STATUS_IS_OK(status) || (nwritten != state->num_data)) { - DEBUG(10, ("Could not write to pipe: %s (%d/%d)\n", - nt_errstr(status), (int)state->num_data, - (int)nwritten)); - reply_nterror(req, NT_STATUS_PIPE_NOT_AVAILABLE); + if (!NT_STATUS_IS_OK(status)) { + NTSTATUS old = status; + status = nt_status_np_pipe(old); + + DEBUG(10, ("Could not write to pipe: %s%s%s\n", + nt_errstr(old), + NT_STATUS_EQUAL(old, status)?"":" => ", + NT_STATUS_EQUAL(old, status)?"":nt_errstr(status))); + reply_nterror(req, status); + goto send; + } + if (nwritten != state->num_data) { + status = NT_STATUS_PIPE_NOT_AVAILABLE; + DEBUG(10, ("Could not write to pipe: (%d/%d) => %s\n", + (int)state->num_data, + (int)nwritten, nt_errstr(status))); + reply_nterror(req, status); goto send; } @@ -351,8 +363,13 @@ static void api_dcerpc_cmd_read_done(struct tevent_req *subreq) TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { - DEBUG(10, ("Could not read from to pipe: %s\n", - nt_errstr(status))); + NTSTATUS old = status; + status = nt_status_np_pipe(old); + + DEBUG(10, ("Could not read from to pipe: %s%s%s\n", + nt_errstr(old), + NT_STATUS_EQUAL(old, status)?"":" => ", + NT_STATUS_EQUAL(old, status)?"":nt_errstr(status))); reply_nterror(req, status); if (!srv_send_smb(req->sconn, (char *)req->outbuf, diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index c3a5cb3c03..f9e3618cb4 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -454,6 +454,8 @@ static void pipe_read_andx_done(struct tevent_req *subreq) status = np_read_recv(subreq, &nread, &is_data_outstanding); TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { + NTSTATUS old = status; + status = nt_status_np_pipe(old); reply_nterror(req, status); goto done; } diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c index 37acf11767..8840167508 100644 --- a/source3/smbd/smb2_ioctl.c +++ b/source3/smbd/smb2_ioctl.c @@ -616,6 +616,8 @@ static void smbd_smb2_ioctl_pipe_write_done(struct tevent_req *subreq) TALLOC_FREE(subreq); if (!NT_STATUS_IS_OK(status)) { + NTSTATUS old = status; + status = nt_status_np_pipe(old); tevent_req_nterror(req, status); return; } -- cgit