]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Expand IS_DOS_READONLY() macros
authorVolker Lendecke <vl@samba.org>
Fri, 6 Oct 2023 13:41:47 +0000 (15:41 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 10 Oct 2023 23:23:40 +0000 (23:23 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/dosmode.c
source3/smbd/open.c

index f2b61f24177e7321553b2ae99d95f8bd93d47eea..54108910004bb398872e10c287270648f26842bb 100644 (file)
@@ -986,7 +986,7 @@ int file_set_dosmode(connection_struct *conn,
 
        /* if we previously had any w bits set then leave them alone
                whilst adding in the new w bits, if the new mode is not rdonly */
-       if (!IS_DOS_READONLY(dosmode)) {
+       if (!(dosmode & FILE_ATTRIBUTE_READONLY)) {
                unixmode |= (smb_fname->st.st_ex_mode & (S_IWUSR|S_IWGRP|S_IWOTH));
        }
 
index 0b27f8493c84b8a3a22e027be63b5ab9f87876c5..5a8004d30019715c9264a1b25423a670cb080521 100644 (file)
@@ -464,7 +464,7 @@ static NTSTATUS check_base_file_access(struct files_struct *fsp,
                        return NT_STATUS_ACCESS_DENIED;
                }
                dosattrs = fdos_mode(fsp);
-               if (IS_DOS_READONLY(dosattrs)) {
+               if (dosattrs & FILE_ATTRIBUTE_READONLY) {
                        return NT_STATUS_ACCESS_DENIED;
                }
        }
@@ -3512,7 +3512,7 @@ static NTSTATUS smbd_calculate_maximum_allowed_access_fsp(
        }
 
        dosattrs = fdos_mode(fsp);
-       if (IS_DOS_READONLY(dosattrs) || !CAN_WRITE(fsp->conn)) {
+       if ((dosattrs & FILE_ATTRIBUTE_READONLY) || !CAN_WRITE(fsp->conn)) {
                *p_access_mask &= ~(FILE_GENERIC_WRITE | DELETE_ACCESS);
        }
 
@@ -4088,7 +4088,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
         */
 
        if (((flags & O_ACCMODE) != O_RDONLY) && file_existed &&
-           (!CAN_WRITE(conn) || IS_DOS_READONLY(existing_dos_attributes))) {
+           (!CAN_WRITE(conn) ||
+            (existing_dos_attributes & FILE_ATTRIBUTE_READONLY))) {
                DEBUG(5,("open_file_ntcreate: write access requested for "
                         "file %s on read only %s\n",
                         smb_fname_str_dbg(smb_fname),