summaryrefslogtreecommitdiff
path: root/source3/smbd/pipes.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/pipes.c')
-rw-r--r--source3/smbd/pipes.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 374aa70d0f..e20d049834 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -104,6 +104,47 @@ int reply_open_pipe_and_X(connection_struct *conn,
return chain_reply(inbuf,outbuf,length,bufsize);
}
+/****************************************************************************
+ reply to a write
+
+ This code is basically stolen from reply_write with some
+ wrinkles to handle pipes.
+****************************************************************************/
+int reply_pipe_write(char *inbuf,char *outbuf,int length,int bufsize)
+{
+ pipes_struct *p = get_rpc_pipe_p(inbuf,smb_vwv0);
+ size_t numtowrite = SVAL(inbuf,smb_vwv1);
+ int nwritten = -1;
+ char *data;
+ size_t outsize;
+
+ if (!p) return(ERROR(ERRDOS,ERRbadfid));
+
+ data = smb_buf(inbuf) + 3;
+
+ if (numtowrite == 0)
+ {
+ nwritten = 0;
+ }
+ else
+ {
+ nwritten = write_pipe(p, data, numtowrite);
+ }
+
+ if ((nwritten == 0 && numtowrite != 0) || (nwritten < 0))
+ {
+ return (UNIXERROR(ERRDOS,ERRnoaccess));
+ }
+
+ outsize = set_message(outbuf,1,0,True);
+
+ SSVAL(outbuf,smb_vwv0,nwritten);
+
+ DEBUG(3,("write-IPC pnum=%04x nwritten=%d\n",
+ p->pnum, nwritten));
+
+ return outsize;
+}
/****************************************************************************
reply to a write and X