r23792: convert Samba4 to GPLv3
[kai/samba.git] / source4 / libcli / raw / rawtrans.c
index cd309e0736bb9b861f8599b3d444b3e763dc1938..fe26a713109fff745fda9550f4b78f60ca7ee7e8 100644 (file)
@@ -6,7 +6,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -15,8 +15,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -449,15 +448,14 @@ NTSTATUS smb_raw_nttrans_recv(struct smbcli_request *req,
        SMBCLI_CHECK_WCT(req, 18 + parms->out.setup_count);
 
        if (parms->out.setup_count > 0) {
-               int i;
-               parms->out.setup = talloc_array(mem_ctx, uint16_t, parms->out.setup_count);
+               parms->out.setup = talloc_array(mem_ctx, uint8_t, 
+                                               parms->out.setup_count*2);
                if (!parms->out.setup) {
                        req->status = NT_STATUS_NO_MEMORY;
                        return smbcli_request_destroy(req);
                }
-               for (i=0;i<parms->out.setup_count;i++) {
-                       parms->out.setup[i] = SVAL(req->in.vwv, VWV(18+i));
-               }
+               memcpy(parms->out.setup, VWV(18) + (uint8_t *)req->out.vwv,
+                      sizeof(uint16_t) * parms->out.setup_count);
        }
        
        while (recvd_data < total_data || 
@@ -555,7 +553,6 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree,
 {
        struct smbcli_request *req; 
        uint8_t *outdata, *outparam;
-       int i;
        int align = 0;
 
        /* only align if there are parameters or data */
@@ -592,9 +589,8 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree,
        SIVAL(req->out.vwv, 31, PTR_DIFF(outdata,req->out.hdr));
        SCVAL(req->out.vwv, 35, parms->in.setup_count);
        SSVAL(req->out.vwv, 36, parms->in.function);
-       for (i=0;i<parms->in.setup_count;i++) {
-               SSVAL(req->out.vwv,VWV(19+i),parms->in.setup[i]);
-       }
+       memcpy(req->out.vwv + VWV(19), parms->in.setup,
+              sizeof(uint16_t) * parms->in.setup_count);
        if (parms->in.params.length) {
                memcpy(outparam, parms->in.params.data, parms->in.params.length);
        }