mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
smbd: Simplify open_file()
Simplify an if-condition: We have to return NT_STATUS_OBJECT_NAME_INVALID even if we're not creating. In fact, we probably should not end up in open_file() if we're open a Windows file with a wildcard. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
814b37bdcf
commit
884b9926b9
@ -1387,7 +1387,6 @@ static NTSTATUS open_file(struct smb_request *req,
|
||||
}
|
||||
|
||||
if (open_fd) {
|
||||
const char *wild;
|
||||
int ret;
|
||||
|
||||
#if defined(O_NONBLOCK) && defined(S_ISFIFO)
|
||||
@ -1402,19 +1401,22 @@ static NTSTATUS open_file(struct smb_request *req,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Don't create files with Microsoft wildcard characters. */
|
||||
if (fsp_is_alternate_stream(fsp)) {
|
||||
if (!posix_open) {
|
||||
const char *wild = smb_fname->base_name;
|
||||
/*
|
||||
* wildcard characters are allowed in stream names
|
||||
* only test the basefilename
|
||||
* Don't open files with Microsoft wildcard characters.
|
||||
*/
|
||||
wild = fsp->base_fsp->fsp_name->base_name;
|
||||
} else {
|
||||
wild = smb_fname->base_name;
|
||||
}
|
||||
if ((local_flags & O_CREAT) && !file_existed && !posix_open &&
|
||||
ms_has_wild(wild)) {
|
||||
return NT_STATUS_OBJECT_NAME_INVALID;
|
||||
if (fsp_is_alternate_stream(fsp)) {
|
||||
/*
|
||||
* wildcard characters are allowed in stream
|
||||
* names only test the basefilename
|
||||
*/
|
||||
wild = fsp->base_fsp->fsp_name->base_name;
|
||||
}
|
||||
|
||||
if (ms_has_wild(wild)) {
|
||||
return NT_STATUS_OBJECT_NAME_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
/* Can we access this file ? */
|
||||
|
Loading…
Reference in New Issue
Block a user