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.
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...)
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.
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.
Good job Derrell and Jeremy!
Thanks for testing, Henrik. Closing.