Re: Bug in getting file attributes with SMB3.1.1 and posix

From: Oleh Nykyforchyn
Date: Wed Feb 19 2025 - 06:19:31 EST


Hi,

I confirm that the patch works flawlessly with samba-4.19.5 AND
4.22.0rc2 (the latest) but NOT with samba-4.21.2 (mounting shares with
ver=3.1.1, posix fails with rc=-32). I was to upgrade samba on all my
computers.
As for me, the issue is resolved.

Best regards

Oleh


пн, 17 лют. 2025 р. о 06:26 Steve French <smfrench@xxxxxxxxx> пише:
>
> Oleh,
> Good catch, and sorry about the delay (email had gotten missed).
>
> Here is a fix (see attached) for the problem you reported. Let me
> know if it also works for you or if you see any problems with it.
>
> This is important fix for SMB3.1.1 POSIX Extensions client implementation.
>
>
> On Wed, Jan 1, 2025 at 11:05 AM Oleh Nykyforchyn <oleh.nyk@xxxxxxxxx> wrote:
> >
> > Hello,
> >
> > I encountered a funny bug when a share is mounted with vers=3.1.1, posix,... If a file size has bits 0x410 = ATTR_DIRECTORY | ATTR_REPARSE = 1040 set, then the file is regarded as a directory and its open fails. A simplest test example is any file 1040 bytes long.
> >
> > The cause of this bug is that Attributes field in smb2_file_all_info struct occupies the same place that EndOfFile field in smb311_posix_qinfo, and sometimes the latter struct is incorrectly processed as if it was the first one. I attach an example patch that solves the problem for me, obviously not ready for submission, but just to show which places in the code are subject to problems. The patch is against linux-6.12.6 kernel, but, AFAICS, nothing has changed since then in relevant places. If I have guessed more or less correctly what the intended functionality is, please feel free to use my patch as a basis for corrections.
> >
> > Best regards
> >
> > Olen Nykyforchyn
>
>
>
> --
> Thanks,
>
> Steve