[linux-cifs-client] massive problems with unix extensions and
possible fix
Stefan Rompf
srompf at isg.de
Wed Dec 1 13:20:24 GMT 2004
Hi,
I tried to use cifsfs 1.24 to connect to a samba 3.0.7 server using unix
extensions. Most file accesses worked, however, when compiling a company
internal software, I experienced all kinds of weird locks, connection losses
etc. I've attached an ethereal dump of the SMB_SET_FILE_UNIX_BASIC packet
before remote closed the connection clearly with a FIN.
As you can see, the cifs client does not initialize the structure, it just
sets some fields. Now samba 3.0.7 tries to use the timestamp, cannot convert
it and this seems to be the failure cause.
This patch helped:
*** cifssmb.c.orig Tue Nov 23 16:05:35 2004
--- cifssmb.c Wed Dec 1 11:31:15 2004
*************** setPermsRetry:
*** 3316,3321 ****
--- 3316,3322 ----
data_offset =
(FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol +
offset);
+ memset(data_offset, 0, sizeof(FILE_UNIX_BASIC_INFO));
pSMB->DataOffset = cpu_to_le16(offset);
pSMB->ParameterOffset = cpu_to_le16(param_offset);
pSMB->SetupCount = 1;
Comments? I think memsets like these are also missing in other places of
cifs-client. To me it seems quite risky to send unitialized structures over
the network hoping that some known server version does not process them.
Stefan
-------------- next part --------------
SMB (Server Message Block Protocol)
SMB Header
Trans2 Request (0x32)
Word Count (WCT): 15
Total Parameter Count: 180
Total Data Count: 100
Max Parameter Count: 2
Max Data Count: 1000
Max Setup Count: 0
Reserved: 00
Flags: 0x0000
Timeout: Return immediately (0)
Reserved: 0000
Parameter Count: 180
Parameter Offset: 68
Data Count: 100
Data Offset: 248
Setup Count: 1
Reserved: 00
Subcommand: SET_PATH_INFO (0x0006)
Byte Count (BCC): 283
Padding: 000000
SET_PATH_INFO Parameters
Level of Interest: Set File Unix Basic (512)
Reserved: 00000000
File Name: \1234\12345678\12345678912345678912345678912345678912345678\12345678912345678912345678
SET_PATH_INFO Data
File size: 8315172550388744192
Number of bytes: 6874592421672660480
Last status change: Time can't be converted
Last access: Time can't be converted
Last modification: Time can't be converted
UID: 18446744073709551615
GID: 18446744073709551615
File type: File (0)
Major device: 0x0000000000000000
Minor device: 0x0000000000000000
Unique ID: 0x666e6963616d5f67
File permissions: 0x00000000000081ed
Num links: 8241419596970943534
More information about the linux-cifs-client
mailing list