summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/pipes.c33
-rw-r--r--source3/smbd/reply.c16
2 files changed, 25 insertions, 24 deletions
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index cf12b4be4d..7a221fa37e 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -252,11 +252,11 @@ void reply_pipe_write_and_X(struct smb_request *req)
wrinkles to handle pipes.
****************************************************************************/
-int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
+void reply_pipe_read_and_X(struct smb_request *req)
{
- smb_np_struct *p = get_rpc_pipe_p(SVAL(inbuf,smb_vwv2));
- int smb_maxcnt = SVAL(inbuf,smb_vwv5);
- int smb_mincnt = SVAL(inbuf,smb_vwv6);
+ smb_np_struct *p = get_rpc_pipe_p(SVAL(req->inbuf,smb_vwv2));
+ int smb_maxcnt = SVAL(req->inbuf,smb_vwv5);
+ int smb_mincnt = SVAL(req->inbuf,smb_vwv6);
int nread = -1;
char *data;
BOOL unused;
@@ -265,32 +265,35 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
is deliberate, instead we always return the next lump of
data on the pipe */
#if 0
- uint32 smb_offs = IVAL(inbuf,smb_vwv3);
+ uint32 smb_offs = IVAL(req->inbuf,smb_vwv3);
#endif
if (!p) {
- return(ERROR_DOS(ERRDOS,ERRbadfid));
+ reply_doserror(req, ERRDOS, ERRbadfid);
+ return;
}
- set_message(inbuf,outbuf,12,0,True);
- data = smb_buf(outbuf);
+ reply_outbuf(req, 12, smb_maxcnt);
+
+ data = smb_buf(req->outbuf);
nread = read_from_pipe(p, data, smb_maxcnt, &unused);
if (nread < 0) {
- return(UNIXERROR(ERRDOS,ERRnoaccess));
+ reply_doserror(req, ERRDOS, ERRnoaccess);
+ return;
}
+
+ set_message(NULL, (char *)req->outbuf, 12, nread, False);
- SSVAL(outbuf,smb_vwv5,nread);
- SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
- SSVAL(smb_buf(outbuf),-2,nread);
+ SSVAL(req->outbuf,smb_vwv5,nread);
+ SSVAL(req->outbuf,smb_vwv6,smb_offset(data,req->outbuf));
+ SSVAL(smb_buf(req->outbuf),-2,nread);
DEBUG(3,("readX-IPC pnum=%04x min=%d max=%d nread=%d\n",
p->pnum, smb_mincnt, smb_maxcnt, nread));
- /* Ensure we set up the message length to include the data length read. */
- set_message_bcc(inbuf,outbuf,nread);
- return chain_reply(inbuf,&outbuf,length,bufsize);
+ return chain_reply_new(req);
}
/****************************************************************************
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 5d47e532cf..cf30c183fa 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2882,17 +2882,9 @@ void reply_read_and_X(connection_struct *conn, struct smb_request *req)
startpos = IVAL_TO_SMB_OFF_T(req->inbuf,smb_vwv3);
smb_maxcnt = SVAL(req->inbuf,smb_vwv5);
- if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- END_PROFILE(SMBreadX);
- return;
- }
-
/* If it's an IPC, pass off the pipe handler. */
if (IS_IPC(conn)) {
- reply_post_legacy(
- req,
- reply_pipe_read_and_X(inbuf,outbuf,length,bufsize));
+ reply_pipe_read_and_X(req);
END_PROFILE(SMBreadX);
return;
}
@@ -2908,6 +2900,12 @@ void reply_read_and_X(connection_struct *conn, struct smb_request *req)
return;
}
+ if (!reply_prep_legacy(req, &inbuf, &outbuf, &length, &bufsize)) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ END_PROFILE(SMBreadX);
+ return;
+ }
+
set_message(inbuf,outbuf,12,0,True);
if (global_client_caps & CAP_LARGE_READX) {