• Steve French's avatar
    smb3: fix incorrect mode displayed for read-only files · 2f3017e7
    Steve French authored
    Commands like "chmod 0444" mark a file readonly via the attribute flag
    (when mapping of mode bits into the ACL are not set, or POSIX extensions
    are not negotiated), but they were not reported correctly for stat of
    directories (they were reported ok for files and for "ls").  See example
    below:
    
        root:~# ls /mnt2 -l
        total 12
        drwxr-xr-x 2 root root         0 Sep 21 18:03 normaldir
        -rwxr-xr-x 1 root root         0 Sep 21 23:24 normalfile
        dr-xr-xr-x 2 root root         0 Sep 21 17:55 readonly-dir
        -r-xr-xr-x 1 root root 209716224 Sep 21 18:15 readonly-file
        root:~# stat -c %a /mnt2/readonly-dir
        755
        root:~# stat -c %a /mnt2/readonly-file
        555
    
    This fixes the stat of directories when ATTR_READONLY is set
    (in cases where the mode can not be obtained other ways).
    
        root:~# stat -c %a /mnt2/readonly-dir
        555
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    2f3017e7
inode.c 86.3 KB