trans2 submcommand endianness

Jeremy Allison jra at samba.org
Tue Jul 26 15:46:08 MDT 2011


On Tue, Jul 26, 2011 at 02:39:17PM -0700, Jeremy Allison wrote:
> On Tue, Jul 26, 2011 at 03:34:38PM -0500, Shirish Pargaonkar wrote:
> > Is this a known/reported issue?
> > 
> > smbclient, during dir operation at the command prompt,
> > instead of sending trans2 subcommand (two bytes) as
> > 0x0001 (01 00), is sending as 0x0100 (00 01) thus
> > changing subcommand from FIND_FIRST2 (1) to Unknown (256)
> > and incurring error NT_STATUS_NOT_IMPLEMENT.
> > 
> > # smbd -V
> > Version 3.6.0rc2-0.9.2-2566-SUSE-CODE11-ppc64
> 
> Sounds like an endian messup. Is this a big-endian
> box ? It's not a known issue, so please log a bug
> asap.

Does the attached patch fix it ?

Jeremy
-------------- next part --------------
diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c
index d74d3d8..59d01b7 100644
--- a/source3/libsmb/clilist.c
+++ b/source3/libsmb/clilist.c
@@ -573,7 +573,7 @@ static struct tevent_req *cli_list_trans_send(TALLOC_CTX *mem_ctx,
 
 	state->max_matches = 1366; /* Match W2k */
 
-	state->setup[0] = TRANSACT2_FINDFIRST;
+	SSVAL(&state->setup[0], 0, TRANSACT2_FINDFIRST);
 
 	nlen = 2*(strlen(mask)+1);
 	state->param = TALLOC_ARRAY(state, uint8_t, 12+nlen+2);
@@ -735,7 +735,7 @@ static void cli_list_trans_done(struct tevent_req *subreq)
 		return;
 	}
 
-	state->setup[0] = TRANSACT2_FINDNEXT;
+	SSVAL(&state->setup[0], 0, TRANSACT2_FINDNEXT);
 
 	nlen = 2*(strlen(state->mask) + 1);
 


More information about the samba-technical mailing list