PATCH: upgrade to SMB3.1.1 from cifs in smbclient, it exposes a bug in smbclient setting attrs

Steve French smfrench at
Thu Jul 13 21:20:33 UTC 2017

When clearing dos attributes (e.g. "setmode file +s" followed by
"setmode file -s" the second operation works when smbclient negotiates
cifs but fails with SMB2 or later since in cifs setting a 0x0 in the
attributes field of setpathinfo is allowed, but in SMB2 and later we
are using SET_INFO (SET_FILE_BASIC_INFO) in which case setting a field
to 0 is a no op.   If we do a "setmode -s" (or setmode -h or setmode
-a etc.) and it results in a dos attribute of zero - we now need to
change the 0 in that field to 0x80 (ATTRIBUTE_NORMAL) otherwise it
will end up that removing the last dos attribute flag is a no op and
leaves the bit set.

One of our tests caught this when running against 4.7rc1 but we can
reproduce this on earlier Samba if you force "client min dialect" to a
later dialect (smb 3.1.1 e.g. instead of its default of cifs)

See MS-FSCC section 2.6

"The following attributes are defined for files and directories. They
can be used in any combination unless noted in the description of the
attribute's meaning. There is no file attribute with the value
0x00000000 because a value of 0x00000000 in the FileAttributes field
means that the file attributes for this file MUST NOT be changed when
setting basic information for the file."


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3-smbclient-Allow-last-dos-attribute-to-be-cleared.patch
Type: application/octet-stream
Size: 2587 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list