[PATCH] Version 2 - Additional fix and test for bug #12899 - smbclient "setmode" no longer works to clear attribute bits due to dialect upgrade

Stefan Metzmacher metze at samba.org
Sat Jul 15 07:40:35 UTC 2017


Am 15.07.2017 um 08:27 schrieb Jeremy Allison:
> On Sat, Jul 15, 2017 at 08:15:26AM +0200, Ralph Böhme wrote:
>> Hi Jeremy,
>>
>> just replying so you're not just talking to self. ;)
>>
>> On Fri, Jul 14, 2017 at 10:46:15PM -0700, Jeremy Allison wrote:
>>> Sounds like a plan - should get this done on Monday !
>>
>> Yes, sounds good.
> 
> Thanks, was getting lonely :-).

I just found:

commit ef4475adc4b8da0e3acfe6d70b2afa94a1e500cd
Author:     Stefan Metzmacher <metze at samba.org>
AuthorDate: Fri Jun 30 08:16:59 2006 +0000
Commit:     Gerald (Jerry) Carter <jerry at samba.org>
CommitDate: Wed Oct 10 14:09:39 2007 -0500

    r16706: for RAW_SFILEINFO_SETATTR attrib == 0 means set it to
FILE_ATTRIB_NORMAL
    and attrib == FILE_ATTRIB_NORMAL means no change...

    but for RAW_SFILEINFO_BASIC_INFORMATION attrib == 0 means no change

    metze
    (This used to be commit e1945feda09a56b6f55bd0f7ab591f3bd069be67)
---
 source4/ntvfs/posix/pvfs_setfileinfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/source4/ntvfs/posix/pvfs_setfileinfo.c
b/source4/ntvfs/posix/pvfs_setfileinfo.c
index 2665b9e..6c7c6dc 100644
--- a/source4/ntvfs/posix/pvfs_setfileinfo.c
+++ b/source4/ntvfs/posix/pvfs_setfileinfo.c
@@ -493,7 +493,9 @@ NTSTATUS pvfs_setpathinfo(struct
ntvfs_module_context *ntvfs,
                if (!null_time(info->setattr.in.write_time)) {
                        unix_to_nt_time(&newstats.dos.write_time,
info->setattr.in.write_time);
                }
-               if (info->setattr.in.attrib != FILE_ATTRIBUTE_NORMAL) {
+               if (info->setattr.in.attrib == 0) {
+                       newstats.dos.attrib = FILE_ATTRIBUTE_NORMAL;
+               } else if (info->setattr.in.attrib !=
FILE_ATTRIBUTE_NORMAL) {
                        newstats.dos.attrib = info->setattr.in.attrib;
                }
                break;

I guess this implemented this difference.

Maybe we should unify some more code from smb_set_file_dosmode() and
reply_setatr(), I think they should only handle the
FILE_ATTRIBUTE_NORMAL difference and otherwise let file_set_dosmode()
the common logic.

I guess we should be able to move the FILE_ATTRIBUTE_DIRECTORY
logic to file_set_dosmode().

And also the /* check the mode isn't different, before changing it */
logic would simply some callers of file_set_dosmode() and also
doesn't hurt all other callers.

metze





-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170715/1d513375/signature.sig>


More information about the samba-technical mailing list