1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-02 00:23:50 +03:00

Ensure the CAN_WRITE is checked and prevents O_CREAT and O_TRUNC from

being set. Also prevent an open on a file on a readonly share from
setting delete on close.
Jeremy.
This commit is contained in:
Jeremy Allison
-
parent b69127391b
commit 1f3dcd99bd
2 changed files with 11 additions and 2 deletions

View File

@@ -683,10 +683,10 @@ files_struct *open_file_shared(connection_struct *conn,char *fname, SMB_STRUCT_S
return NULL;
}
if (GET_FILE_CREATE_DISPOSITION(ofun) == FILE_CREATE_IF_NOT_EXIST)
if (CAN_WRITE(conn) && (GET_FILE_CREATE_DISPOSITION(ofun) == FILE_CREATE_IF_NOT_EXIST))
flags2 |= O_CREAT;
if (GET_FILE_OPEN_DISPOSITION(ofun) == FILE_EXISTS_TRUNCATE)
if (CAN_WRITE(conn) && (GET_FILE_OPEN_DISPOSITION(ofun) == FILE_EXISTS_TRUNCATE))
flags2 |= O_TRUNC;
if (GET_FILE_OPEN_DISPOSITION(ofun) == FILE_EXISTS_FAIL)