svn commit: samba r21183 - in branches/SAMBA_4_0/source: libcli/raw smb_server/smb

vlendec at samba.org vlendec at samba.org
Tue Feb 6 18:16:11 GMT 2007


Author: vlendec
Date: 2007-02-06 18:16:10 +0000 (Tue, 06 Feb 2007)
New Revision: 21183

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21183

Log:
Commit the big/little endian fix for nttrans setup[] handling.

Please check!

For code symmetry reasons, trans2 might also see this fix, but this is left to
the interested reader :-)

Volker

Modified:
   branches/SAMBA_4_0/source/libcli/raw/rawtrans.c
   branches/SAMBA_4_0/source/smb_server/smb/nttrans.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/raw/rawtrans.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/rawtrans.c	2007-02-06 17:29:18 UTC (rev 21182)
+++ branches/SAMBA_4_0/source/libcli/raw/rawtrans.c	2007-02-06 18:16:10 UTC (rev 21183)
@@ -555,7 +555,6 @@
 {
 	struct smbcli_request *req; 
 	uint8_t *outdata, *outparam;
-	int i;
 	int align = 0;
 
 	/* only align if there are parameters or data */
@@ -592,9 +591,8 @@
 	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);
 	}

Modified: branches/SAMBA_4_0/source/smb_server/smb/nttrans.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb/nttrans.c	2007-02-06 17:29:18 UTC (rev 21182)
+++ branches/SAMBA_4_0/source/smb_server/smb/nttrans.c	2007-02-06 18:16:10 UTC (rev 21183)
@@ -570,7 +570,6 @@
 {
 	struct nttrans_op *op;
 	struct smb_nttrans *trans;
-	int i;
 	uint16_t param_ofs, data_ofs;
 	uint16_t param_count, data_count;
 	uint16_t param_total, data_total;
@@ -617,10 +616,10 @@
 		smbsrv_send_error(req, NT_STATUS_NO_MEMORY);
 		return;
 	}
-	for (i=0;i<trans->in.setup_count;i++) {
-		trans->in.setup[i] = SVAL(req->in.vwv, VWV(19+i));
-	}
 
+	memcpy(trans->in.setup, (char *)(req->in.vwv) + VWV(19),
+	       sizeof(uint16_t) * trans->in.setup_count);
+
 	if (!req_pull_blob(req, req->in.hdr + param_ofs, param_count, &trans->in.params) ||
 	    !req_pull_blob(req, req->in.hdr + data_ofs, data_count, &trans->in.data)) {
 		smbsrv_send_error(req, NT_STATUS_FOOBAR);



More information about the samba-cvs mailing list