From 51b0fd0c566ff6bf112ab9752d9b105a6bb786a8 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 4 Jun 2021 16:31:20 +0200 Subject: [PATCH] smbd: add dosmode_from_fake_filehandle() BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/include/fake_file.h | 1 + source3/smbd/fake_file.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/source3/include/fake_file.h b/source3/include/fake_file.h index 00ebc88f7a7..c267df25188 100644 --- a/source3/include/fake_file.h +++ b/source3/include/fake_file.h @@ -47,5 +47,6 @@ NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn, uint32_t access_mask, files_struct **result); NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp); +uint32_t dosmode_from_fake_filehandle(const struct fake_file_handle *ffh); #endif /* _FAKE_FILE_H */ diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c index e786ad67b72..92ea14a76da 100644 --- a/source3/smbd/fake_file.c +++ b/source3/smbd/fake_file.c @@ -115,6 +115,21 @@ enum FAKE_FILE_TYPE is_fake_file(const struct smb_filename *smb_fname) return ret; } +uint32_t dosmode_from_fake_filehandle(const struct fake_file_handle *ffh) +{ + if (ffh->type != FAKE_FILE_TYPE_QUOTA) { + DBG_ERR("Unexpected fake_file_handle: %d\n", ffh->type); + log_stack_trace(); + return FILE_ATTRIBUTE_NORMAL; + } + + /* This is what Windows 2016 returns */ + return FILE_ATTRIBUTE_HIDDEN + | FILE_ATTRIBUTE_SYSTEM + | FILE_ATTRIBUTE_DIRECTORY + | FILE_ATTRIBUTE_ARCHIVE; +} + /**************************************************************************** Open a fake quota file with a share mode. ****************************************************************************/ -- 2.47.3