From: Ralph Boehme Date: Thu, 9 Oct 2025 13:17:38 +0000 (+0200) Subject: smbd: move calling fsp_set_gen_id() to fsp_bind_smb() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff60b7538412a76253c51a830da3a204a574d4a0;p=thirdparty%2Fsamba.git smbd: move calling fsp_set_gen_id() to fsp_bind_smb() No change in behaviour. fsp_set_gen_id() sets the primary key for the share_mode_entry of the corresponding open file handle. None of the pathref fsp needs that before being passed to SMB_VFS_CREATE_FILE(). As file_new() calls fsp_bind_smb(), all fsps will get an id when create_file_unixpath() either calls file_new when creating files or it calls fsp_bind_smb() when "converting" an pathref fsp that was passed into SMB_VFS_CREATE_FILE() to an FSA fsp. Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 334810e45f9..779d1f3c611 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -112,6 +112,8 @@ NTSTATUS fsp_bind_smb(struct files_struct *fsp, struct smb_request *req) NTTIME now; NTSTATUS status; + fsp_set_gen_id(fsp); + if (req == NULL) { DBG_DEBUG("INTERNAL_OPEN_ONLY, skipping smbXsrv_open\n"); return NT_STATUS_OK; @@ -160,8 +162,6 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn, return status; } - fsp_set_gen_id(fsp); - /* * Create an smb_filename with "" for the base_name. There are very * few NULL checks, so make sure it's initialized with something. to @@ -422,7 +422,6 @@ static NTSTATUS openat_pathref_fullname( } GetTimeOfDay(&fsp->open_time); - fsp_set_gen_id(fsp); ZERO_STRUCT(conn->sconn->fsp_fi_cache); fsp->fsp_flags.is_pathref = true; @@ -599,7 +598,6 @@ NTSTATUS open_rootdir_pathref_fsp(connection_struct *conn, goto fail; } GetTimeOfDay(&fsp->open_time); - fsp_set_gen_id(fsp); ZERO_STRUCT(conn->sconn->fsp_fi_cache); fsp->fsp_flags.is_pathref = true; @@ -679,7 +677,6 @@ NTSTATUS open_stream_pathref_fsp( } GetTimeOfDay(&fsp->open_time); - fsp_set_gen_id(fsp); ZERO_STRUCT(conn->sconn->fsp_fi_cache); fsp->fsp_flags.is_pathref = true; @@ -1079,7 +1076,6 @@ NTSTATUS openat_pathref_fsp_nosymlink( } GetTimeOfDay(&fsp->open_time); - fsp_set_gen_id(fsp); ZERO_STRUCT(conn->sconn->fsp_fi_cache); fsp->fsp_name = &full_fname; @@ -1552,7 +1548,6 @@ NTSTATUS openat_pathref_fsp_lcomp(struct files_struct *dirfsp, } GetTimeOfDay(&fsp->open_time); - fsp_set_gen_id(fsp); ZERO_STRUCT(conn->sconn->fsp_fi_cache); fsp->fsp_flags.is_pathref = true; @@ -1699,7 +1694,6 @@ NTSTATUS openat_pathref_fsp_dot(TALLOC_CTX *mem_ctx, } GetTimeOfDay(&fsp->open_time); - fsp_set_gen_id(fsp); ZERO_STRUCT(conn->sconn->fsp_fi_cache); fsp->fsp_flags.is_pathref = true;