SMB Sequence Yields Write Corruption

David Collier-Brown David.Collier-Brown at Sun.COM
Mon May 2 13:50:38 GMT 2005


The Unix filesystem provided the nulls for you: this is considered
a file with a "hole" from 0 to 5... I have no idea what Windows
does, but I suspect it 's either
1) fail
2) pad will nulls
3) pad with some other character, perhaps space.

--dave

Michael B Allen wrote:
> I've noticed a strange thing (actually a jCIFS user noticed it). Consider
> the following sequence of SMBs (to XP Pro SP1 in this case):
> 
>   NEGOTIATE
>   SESSION_SETUP_ANDX
>   TREE_CONNECT_ANDX
>   NT_CREATE_ANDX       t.txt
>   WRITE_ANDX           "hello1" at offset 0
>   CLOSE                t.txt
>   NT_CREATE_ANDX       foo.txt
>   WRITE_ANDX           "hello2" at offset 6
>   CLOSE                t.txt
>   DISCONNECT
>   LOGOFF
> 
> Now if I dump that file I get:
> 
>   $ hexdump -c /mnt/pub/t.txt
>   0000000  \0  \0  \0  \0  \0  \0   h   e   l   l   o   2
> 
> Where did all these zeros come from?
> 
> If I pause after the first CLOSE and hexdump the file it is what I expect:
> 
>   $ hexdump -c /mnt/pub/t.txt
>   0000000   h   e   l   l   o   1
> 
> Where's the bug?
> 
> Mike
> 
> PS: Captures available on request.
> 

-- 
David Collier-Brown,      | Always do right. This will gratify
Sun Microsystems, Toronto | some people and astonish the rest
davecb at canada.sun.com     |                      -- Mark Twain
(416) 263-5733 (x65733)   |


More information about the samba-technical mailing list