s3/smbd: only use stored dos attributes for open_match_attributes() check
authorRalph Boehme <slow@samba.org>
Thu, 23 Jun 2016 10:24:33 +0000 (12:24 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 28 Jun 2016 11:11:21 +0000 (13:11 +0200)
This changes the way we check for old vs new DOS attributes on open with
overwrite: only check against the DOS attributes actually set by a
client and stored in the DOS attributes xattr.

With this change "hide dot files" and "hide files" continue to work with
"store dos attributes = yes".

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11992

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 36b7cff3188bbc21048c12ec971d9c2ac3666226)

source3/smbd/open.c

index 61b7145fa75b43e664dec3d56958d7f75b9d0bf3..2d5f8d70646d54c8a0ea0fad33bdfc62817c0ef9 100644 (file)
@@ -2517,7 +2517,19 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
        if (!posix_open) {
                new_dos_attributes &= SAMBA_ATTRIBUTES_MASK;
                if (file_existed) {
-                       existing_dos_attributes = dos_mode(conn, smb_fname);
+                       /*
+                        * Only use strored DOS attributes for checks
+                        * against requested attributes (below via
+                        * open_match_attributes()), cf bug #11992
+                        * for details. -slow
+                        */
+                       bool ok;
+                       uint32_t attr = 0;
+
+                       ok = get_ea_dos_attribute(conn, smb_fname, &attr);
+                       if (ok) {
+                               existing_dos_attributes = attr;
+                       }
                }
        }