r24231: Push allocating InBuffer/OutBuffer into reply_transs
authorVolker Lendecke <vlendec@samba.org>
Sun, 5 Aug 2007 08:47:09 +0000 (08:47 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:29:18 +0000 (12:29 -0500)
(This used to be commit 74ae19cca6dd15b65deffbf464cfd0e485da8611)

source3/smbd/ipc.c
source3/smbd/process.c

index 8b80d8bcc404cd38ad71ff04fbb09233a8ff6b7a..17c27b9957bf7dc769332cbedf71c32bd3709f08 100644 (file)
@@ -703,21 +703,29 @@ void reply_trans(connection_struct *conn, struct smb_request *req)
  Reply to a secondary SMBtrans.
  ****************************************************************************/
 
-int reply_transs(connection_struct *conn, char *inbuf,char *outbuf,
-                int size, int bufsize)
+void reply_transs(connection_struct *conn, struct smb_request *req)
 {
        int outsize = 0;
        unsigned int pcnt,poff,dcnt,doff,pdisp,ddisp;
        struct trans_state *state;
        NTSTATUS result;
+       char *inbuf, *outbuf;
+       int size, bufsize;
 
        START_PROFILE(SMBtranss);
 
+       if (!reply_prep_legacy(req, &inbuf, &outbuf, &size, &bufsize)) {
+               reply_nterror(req, NT_STATUS_NO_MEMORY);
+               END_PROFILE(SMBtranss);
+               return;
+       }
+
        show_msg(inbuf);
 
-       if (SVAL(inbuf, smb_wct) < 10) {
+       if (req->wct < 10) {
+               reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
                END_PROFILE(SMBtranss);
-               return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+               return;
        }
 
        for (state = conn->pending_trans; state != NULL;
@@ -728,8 +736,9 @@ int reply_transs(connection_struct *conn, char *inbuf,char *outbuf,
        }
 
        if ((state == NULL) || (state->cmd != SMBtrans)) {
+               reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
                END_PROFILE(SMBtranss);
-               return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+               return;
        }
 
        /* Revise total_params and total_data in case they have changed
@@ -792,7 +801,7 @@ int reply_transs(connection_struct *conn, char *inbuf,char *outbuf,
        if ((state->received_param < state->total_param) ||
            (state->received_data < state->total_data)) {
                END_PROFILE(SMBtranss);
-               return -1;
+               return;
        }
 
        /* construct_reply_common has done us the favor to pre-fill the
@@ -808,12 +817,13 @@ int reply_transs(connection_struct *conn, char *inbuf,char *outbuf,
        TALLOC_FREE(state);
 
        if ((outsize == 0) || !NT_STATUS_IS_OK(result)) {
+               reply_doserror(req, ERRSRV, ERRnosupport);
                END_PROFILE(SMBtranss);
-               return(ERROR_DOS(ERRSRV,ERRnosupport));
+               return;
        }
        
        END_PROFILE(SMBtranss);
-       return(outsize);
+       return;
 
   bad_param:
 
@@ -822,6 +832,7 @@ int reply_transs(connection_struct *conn, char *inbuf,char *outbuf,
        SAFE_FREE(state->data);
        SAFE_FREE(state->param);
        TALLOC_FREE(state);
+       reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
        END_PROFILE(SMBtranss);
-       return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
+       return;
 }
index f593c5e177ff40be9a7a224d099742902c1b4bdb..d7bde0043a27d466968328dd5e44f34d089131ab 100644 (file)
@@ -726,7 +726,7 @@ static const struct smb_message_struct {
 /* 0x23 */ { "SMBgetattrE",reply_getattrE,NULL,AS_USER },
 /* 0x24 */ { "SMBlockingX",reply_lockingX,NULL,AS_USER },
 /* 0x25 */ { "SMBtrans",NULL,reply_trans,AS_USER | CAN_IPC },
-/* 0x26 */ { "SMBtranss",reply_transs,NULL,AS_USER | CAN_IPC},
+/* 0x26 */ { "SMBtranss",NULL,reply_transs,AS_USER | CAN_IPC},
 /* 0x27 */ { "SMBioctl",reply_ioctl,NULL,0},
 /* 0x28 */ { "SMBioctls",NULL, NULL,AS_USER},
 /* 0x29 */ { "SMBcopy",reply_copy,NULL,AS_USER | NEED_WRITE },