mirror of
https://github.com/samba-team/samba.git
synced 2025-03-24 10:50:22 +03:00
smbd: add zero_file_id flag
This flag instructs the SMB layer to report a zero on-disk file identifier. According to [MS-SMB2] 3.3.5.9.9, the reported on-disk file ID SHOULD be unique. However, macOS clients seem to expect it to be unique over time as well, like the HFS+ CNID. Reporting a file ID of 0 seems to instruct the Mac client not to trust the server-reported file ID. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12715 Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 6711522e1e57980e50e245f43167d0daf5a705ad)
This commit is contained in:
parent
2e9450af90
commit
2732b0cb29
@ -864,6 +864,7 @@ struct smbd_server_connection {
|
||||
struct messaging_context *msg_ctx;
|
||||
struct notify_context *notify_ctx;
|
||||
bool using_smb2;
|
||||
bool aapl_zero_file_id; /* Apple-specific */
|
||||
int trans_num;
|
||||
|
||||
size_t num_users;
|
||||
|
@ -1132,6 +1132,7 @@ NTSTATUS check_access(connection_struct *conn,
|
||||
uint32_t access_mask);
|
||||
uint64_t smb_roundup(connection_struct *conn, uint64_t val);
|
||||
uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf);
|
||||
void aapl_force_zero_file_id(struct smbd_server_connection *sconn);
|
||||
bool samba_private_attr_name(const char *unix_ea_name);
|
||||
NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
|
||||
files_struct *fsp, const char *fname,
|
||||
|
@ -143,6 +143,9 @@ uint64_t smb_roundup(connection_struct *conn, uint64_t val)
|
||||
uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf)
|
||||
{
|
||||
uint64_t file_index;
|
||||
if (conn->sconn->aapl_zero_file_id) {
|
||||
return 0;
|
||||
}
|
||||
if (conn->base_share_dev == psbuf->st_ex_dev) {
|
||||
return (uint64_t)psbuf->st_ex_ino;
|
||||
}
|
||||
@ -151,6 +154,17 @@ uint64_t get_FileIndex(connection_struct *conn, const SMB_STRUCT_STAT *psbuf)
|
||||
return file_index;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************
|
||||
Globally (for this connection / multi-channel) disable file-ID
|
||||
calculation. This is required to be global because it serves
|
||||
Macs in AAPL mode, which is globally set.
|
||||
********************************************************************/
|
||||
void aapl_force_zero_file_id(struct smbd_server_connection *sconn)
|
||||
{
|
||||
sconn->aapl_zero_file_id = true;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Utility functions for dealing with extended attributes.
|
||||
****************************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user