[PATCH] Version 2 - Additional fix and test for bug #12899 - smbclient "setmode" no longer works to clear attribute bits due to dialect upgrade
Jeremy Allison
jra at samba.org
Sat Jul 15 17:05:50 UTC 2017
On Sat, Jul 15, 2017 at 09:40:35AM +0200, Stefan Metzmacher wrote:
>
> 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.
Yeah, that's in the ntvfs server, I don't think it
ever implemented the SMB2 semantics here. If it
fails make test I'm planning to just mark it knownfail.
Don't have the resources to support 2 servers :-(.
> 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.
Yeah, but that's code for a later fix :-). In the meantime
smbd actually implements the correct semantics for both
SMB1 and SMB2, I just need to fix the source3 client code
to make the cli_setat() ABI consistent across SMB1 and SMB2.
More on Monday.
Jeremy.
More information about the samba-technical
mailing list