Bug 5186 - Clearing dos attributes with smbc_setxattr do not work
Summary: Clearing dos attributes with smbc_setxattr do not work
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 3.0.28
Hardware: Other Other
: P3 normal
Target Milestone: none
Assignee: Derrell Lipman
QA Contact: Samba QA Contact
Depends on:
Reported: 2008-01-11 03:07 UTC by Henrik (dead mail address)
Modified: 2008-01-24 08:07 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Henrik (dead mail address) 2008-01-11 03:07:51 UTC
I'm trying to use smbc_setxattr to clear a dos attribute from a file.
I.e I can set a hidden attribute by passing 0x02 as MODE to smbc_setxattr. But how would I clear that attribute?

Retrieving attributes from a file with no attributes returns 0x0 as mode but I can't use that as a set value to clear the attributes.

Also tried smbc_removexattr without success.

Comment 1 Derrell Lipman 2008-01-21 15:03:03 UTC
Ok, we're sending the correct packet with attributes value zero.  Windows is ignoring it.  File a bug report with MS. :-)

I looked at how what we do differs from that happens if the same operation is requested from another windows box.  We use SET_PATH_INFO; they open the file and use SET_FILE_INFO on the open handle.  Either there's some semantic difference between the two, or there really is a MS bug.  

In any case, when I get a chance, I'll have to change libsmbclient to use SET_FILE_INFO.  I'm somewhat concerned about doing that.  It will slow things down (some) if we do it in the case of every attribute change.  Of more importance is our current inability to reliably test to ensure that the change hasn't broken anything.  I suspect that I'll check specifically for a setting of mode=0 and treat that specially (using SET_FILE_INFO only for it) until such time as we have a real test suite.

(Henrik, can I enlist you to write a test suite for libsmbclient?  You're one of the more knowledgeable and frequent users of it...)

Comment 2 Jeremy Allison 2008-01-23 12:26:29 UTC
Derrell, instead of sending a attribute value of zero, try sending one with
FILE_ATTRIBUTE_NORMAL (0x080) instead. Windows commonly ignores zero, this might be what is needed to set the attribute in a path-based call.
Comment 3 Derrell Lipman 2008-01-23 19:55:14 UTC
Thanks, Jeremy!  That did it.

Henrik, I've checked it in to v3-2-test: 4c08725a42a8babf0f078fb4b221a96f58deeb50.  It's working for me against W2K.  Would you please verify it against what ever other versions of Windows you have running.


Comment 4 Henrik (dead mail address) 2008-01-24 04:50:01 UTC

Good job Derrell and Jeremy!

Comment 5 Derrell Lipman 2008-01-24 08:07:47 UTC
Thanks for testing, Henrik.  Closing.