]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: add dosmode_from_fake_filehandle()
authorRalph Boehme <slow@samba.org>
Fri, 4 Jun 2021 14:31:20 +0000 (16:31 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 9 Jun 2021 19:47:34 +0000 (19:47 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14731

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/fake_file.h
source3/smbd/fake_file.c

index 00ebc88f7a74ec81a6603bbbd03a83785659358e..c267df2518831a12f2e146ae9bda3fa6c7065766 100644 (file)
@@ -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 */
index e786ad67b72bffa3b42a207116de0bd22124d1bb..92ea14a76daed94aa19b5d7715ddb81eefb3c6c2 100644 (file)
@@ -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.
 ****************************************************************************/