[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
[samba.git] / source / smbd / pipes.c
index e8a496ffa785b1b328356e28b7fa0e98cad0610e..da43a2976773f3dcb00162f300e58f27a19ab96f 100644 (file)
@@ -55,15 +55,21 @@ extern struct pipe_id_info pipe_names[];
 
 void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
 {
-       pstring fname;
-       pstring pipe_name;
+       const char *fname = NULL;
+       char *pipe_name = NULL;
        smb_np_struct *p;
        int size=0,fmode=0,mtime=0,rmode=0;
        int i;
+       TALLOC_CTX *ctx = talloc_tos();
 
        /* XXXX we need to handle passed times, sattr and flags */
-       srvstr_pull_buf(req->inbuf, req->flags2, pipe_name,
-                       smb_buf(req->inbuf), sizeof(pipe_name), STR_TERMINATE);
+       srvstr_pull_buf_talloc(ctx, req->inbuf, req->flags2, &pipe_name,
+                       smb_buf(req->inbuf), STR_TERMINATE);
+       if (!pipe_name) {
+               reply_botherror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND,
+                               ERRDOS, ERRbadpipe);
+               return;
+       }
 
        /* If the name doesn't start \PIPE\ then this is directed */
        /* at a mailslot or something we really, really don't understand, */
@@ -89,7 +95,7 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
        }
 
        /* Strip \PIPE\ off the name. */
-       pstrcpy(fname, pipe_name + PIPELEN);
+       fname = pipe_name + PIPELEN;
 
 #if 0
        /*
@@ -130,7 +136,7 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
        SSVAL(req->outbuf,smb_vwv8,rmode);
        SSVAL(req->outbuf,smb_vwv11,0x0001);
 
-       chain_reply_new(req);
+       chain_reply(req);
        return;
 }
 
@@ -244,7 +250,7 @@ void reply_pipe_write_and_X(struct smb_request *req)
   
        DEBUG(3,("writeX-IPC pnum=%04x nwritten=%d\n", p->pnum, nwritten));
 
-       chain_reply_new(req);
+       chain_reply(req);
 }
 
 /****************************************************************************
@@ -285,7 +291,7 @@ void reply_pipe_read_and_X(struct smb_request *req)
                return;
        }
 
-       set_message(NULL, (char *)req->outbuf, 12, nread, False);
+       set_message((char *)req->outbuf, 12, nread, False);
   
        SSVAL(req->outbuf,smb_vwv5,nread);
        SSVAL(req->outbuf,smb_vwv6,smb_offset(data,req->outbuf));
@@ -294,7 +300,7 @@ void reply_pipe_read_and_X(struct smb_request *req)
        DEBUG(3,("readX-IPC pnum=%04x min=%d max=%d nread=%d\n",
                 p->pnum, smb_mincnt, smb_maxcnt, nread));
 
-       chain_reply_new(req);
+       chain_reply(req);
 }
 
 /****************************************************************************