summaryrefslogtreecommitdiff
path: root/source3/smbd/pipes.c
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-07 15:22:49 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-07 15:22:49 +0000
commit2fef8f2e87f61043e3f1a2cf7d1f2a4ff9f119ff (patch)
tree38766ed833d7e396b80e4c0086950b6665715df6 /source3/smbd/pipes.c
parent3d601dafe907861dfb9447085e85a1213fe19b91 (diff)
downloadsamba-2fef8f2e87f61043e3f1a2cf7d1f2a4ff9f119ff.tar.gz
samba-2fef8f2e87f61043e3f1a2cf7d1f2a4ff9f119ff.tar.bz2
samba-2fef8f2e87f61043e3f1a2cf7d1f2a4ff9f119ff.zip
dce/rpc
(This used to be commit 34afa638f6f7bb145ec094510ac58f7a22dfc3aa)
Diffstat (limited to 'source3/smbd/pipes.c')
-rw-r--r--source3/smbd/pipes.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 15d395b29a..00eec4e0e3 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -106,6 +106,50 @@ int reply_open_pipe_and_X(connection_struct *conn,
/****************************************************************************
+ reply to a write and X
+
+ This code is basically stolen from reply_write_and_X with some
+ wrinkles to handle pipes.
+****************************************************************************/
+int reply_pipe_write_and_X(char *inbuf,char *outbuf,int length,int bufsize)
+{
+ pipes_struct *p = get_rpc_pipe_p(inbuf,smb_vwv2);
+ uint32 smb_offs = IVAL(inbuf,smb_vwv3);
+ size_t numtowrite = SVAL(inbuf,smb_vwv10);
+ BOOL write_through = BITSETW(inbuf+smb_vwv7, 0);
+ int nwritten = -1;
+ int smb_doff = SVAL(inbuf, smb_vwv11);
+ char *data;
+
+ if (!p) return(ERROR(ERRDOS,ERRbadfid));
+
+ data = smb_buf(inbuf) + smb_doff;
+
+ if (numtowrite == 0)
+ {
+ nwritten = 0;
+ }
+ else
+ {
+ nwritten = write_pipe(p, data, numtowrite);
+ }
+
+ if ((nwritten == 0 && numtowrite != 0) || (nwritten < 0))
+ {
+ return (UNIXERROR(ERRDOS,ERRnoaccess));
+ }
+
+ set_message(outbuf,6,0,True);
+
+ SSVAL(outbuf,smb_vwv2,nwritten);
+
+ DEBUG(3,("writeX-IPC pnum=%04x nwritten=%d\n",
+ p->pnum, nwritten));
+
+ return chain_reply(inbuf,outbuf,length,bufsize);
+}
+
+/****************************************************************************
reply to a read and X
This code is basically stolen from reply_read_and_X with some
@@ -134,11 +178,12 @@ int reply_pipe_read_and_X(char *inbuf,char *outbuf,int length,int bufsize)
SSVAL(outbuf,smb_vwv6,smb_offset(data,outbuf));
SSVAL(smb_buf(outbuf),-2,nread);
- DEBUG(3,("readX pnum=%04x min=%d max=%d nread=%d\n",
+ DEBUG(3,("readX-IPC pnum=%04x min=%d max=%d nread=%d\n",
p->pnum, smb_mincnt, smb_maxcnt, nread));
return chain_reply(inbuf,outbuf,length,bufsize);
}
+
/****************************************************************************
reply to a close
****************************************************************************/