SMB_COM_READ_ANDX MaxCount != filesize

Sailaja Josyula sailaja at us.ibm.com
Thu Mar 17 02:01:17 GMT 2005


Thanks for your reply Chris.

I need to clarify some aspects.

SMB_COM_READ_ANDX is asking for MaxCount much greater than the filesize. 

If say I have a file of size 68 bytes.  I am seeing the following 
sequence:

  NT_CREATE_ANDX response End_Of_File set to 68 

  follows the first SMB_COM_READ_ANDX with offset = 0; MaxCount = 512
  second SMB_COM_READ_ANDX with offset = 68; MaxCount = 444
  and so on ... some 10 more SMB_COM_READ_ANDX commands follow.


On a regular VFS (Using Windows SMB) the same file is opened with the 
following sequence:

NT_CREATE_ANDX response End_Of_File set to 68
follows the first SMB_COM_READ_ANDX with offset = 0; MaxCount = 68 


Is this to do with the negotiated protocol?  I am not sure what the 
Application uses to get the MaxCount for SMB_COM_READ_ANDX.

Thanks 

Sailaja Josyula
Websphere Odyssey (On Demand Client) Development
IBM Software Group
Phone: 914-784-5472 Tie Line: 863-5472 Fax: 914-784-3833
sailaja at us.ibm.com




"Christopher R. Hertel" <crh at ubiqx.mn.org>
03/16/2005 03:12 PM
 
        To:     Sailaja Josyula/Hawthorne/IBM at IBMUS
        cc:     samba-technical at lists.samba.org
        Subject:        Re: SMB_COM_READ_ANDX MaxCount != filesize


Hmmm...

So if I understand this correctly, the clients (Windows clients, I
presume) are never asking for as many bytes as they could actually read. 
Is the difference consistent?  That is, for small files is MaxCount
always, say, 8 bytes less than you'd expect?

My guess is that some parameter in the initial negotiation is off by a
fixed number of bytes.  If that guess is correct, it's probably a result
of not counting soe field that un-obviously needs to be counted.  SMB
field offsets and such are sometimes a little weird that way.

Chris -)----

On Wed, Mar 16, 2005 at 02:49:35PM -0500, Sailaja Josyula wrote:
> Hi,
> 
> I have written my own SMBserver to run as a VFS.  I have question 
> regarding SMB_COM_READ_ANDX command.
> 
> The MaxCount parameter in the command SMB_COM_READ_ANDX is never set to 
> the filesize. Even though I am setting 
> the End_Of_File parameter correctly in the response to NT_CREATE_ANDX 
> command. 
> 
> In the windows SMB I see that the SMB_COM_READ_ANDX requests come with 
the 
> Count set to the Filesize specified
> in the NT_CREATE_ANDX command.  The MaxCount field not being set 
correctly 
> is causing multiple SMB_COM_READ_ANDX
> commands to be triggered with different offset and Count values, even if 

> the filesize is as small as 8 bytes.
> 
> Is there something I am missing or not setting prior to the 
> SMB_COM_READ_ANDX? How does this parameter get set in
> the SMB_COM_READ_ANDX command.
> 
> The protocol I have negotiated is NT LM 0.12. 
> 
> Thanks
> 
> Sailaja Josyula
> Websphere Portal
> IBM Software Group
> Phone: 914-784-5472 Tie Line: 863-5472 Fax: 914-784-3833
> sailaja at us.ibm.com

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, 
uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org



More information about the samba-technical mailing list