1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-21 18:04:06 +03:00

smbd: Pass "create_options" to filename_create_ucf_flags()

OPEN_REPARSE_POINT will trigger symlinks not being followed but
returned, even if we have "follow symlinks = yes". Prepare for setting
UCF_LCOMP_LNK_OK for this case in a central place.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2024-02-02 21:16:46 +01:00 committed by Ralph Boehme
parent fee31b6cb2
commit ec64f81df9
5 changed files with 27 additions and 12 deletions

View File

@ -57,7 +57,9 @@ uint32_t ucf_flags_from_smb_request(struct smb_request *req)
return ucf_flags;
}
uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition)
uint32_t filename_create_ucf_flags(struct smb_request *req,
uint32_t create_disposition,
uint32_t create_options)
{
uint32_t ucf_flags = 0;

View File

@ -288,7 +288,9 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug
/* The following definitions come from smbd/filename.c */
uint32_t ucf_flags_from_smb_request(struct smb_request *req);
uint32_t filename_create_ucf_flags(struct smb_request *req, uint32_t create_disposition);
uint32_t filename_create_ucf_flags(struct smb_request *req,
uint32_t create_disposition,
uint32_t create_options);
NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname,
uint32_t ucf_flags,
NTTIME twrp);

View File

@ -626,7 +626,9 @@ void reply_ntcreate_and_X(struct smb_request *req)
fname = new_fname;
}
ucf_flags = filename_create_ucf_flags(req, create_disposition);
ucf_flags = filename_create_ucf_flags(req,
create_disposition,
create_options);
if (ucf_flags & UCF_GMT_PATHNAME) {
extract_snapshot_token(fname, &twrp);
}
@ -1087,7 +1089,9 @@ static void call_nt_transact_create(connection_struct *conn,
fname = new_fname;
}
ucf_flags = filename_create_ucf_flags(req, create_disposition);
ucf_flags = filename_create_ucf_flags(req,
create_disposition,
create_options);
if (ucf_flags & UCF_GMT_PATHNAME) {
extract_snapshot_token(fname, &twrp);
}

View File

@ -1789,7 +1789,9 @@ void reply_open(struct smb_request *req)
goto out;
}
ucf_flags = filename_create_ucf_flags(req, create_disposition);
ucf_flags = filename_create_ucf_flags(req,
create_disposition,
create_options);
if (ucf_flags & UCF_GMT_PATHNAME) {
extract_snapshot_token(fname, &twrp);
@ -1990,7 +1992,9 @@ void reply_open_and_X(struct smb_request *req)
goto out;
}
ucf_flags = filename_create_ucf_flags(req, create_disposition);
ucf_flags = filename_create_ucf_flags(req,
create_disposition,
create_options);
if (ucf_flags & UCF_GMT_PATHNAME) {
extract_snapshot_token(fname, &twrp);
@ -2428,7 +2432,9 @@ void reply_mknew(struct smb_request *req)
goto out;
}
ucf_flags = filename_create_ucf_flags(req, create_disposition);
ucf_flags = filename_create_ucf_flags(req,
create_disposition,
create_options);
if (ucf_flags & UCF_GMT_PATHNAME) {
extract_snapshot_token(fname, &twrp);
}
@ -2583,7 +2589,7 @@ void reply_ctemp(struct smb_request *req)
goto out;
}
ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
ucf_flags = filename_create_ucf_flags(req, FILE_CREATE, 0);
if (ucf_flags & UCF_GMT_PATHNAME) {
extract_snapshot_token(fname, &twrp);
}
@ -6179,7 +6185,7 @@ void reply_mkdir(struct smb_request *req)
goto out;
}
ucf_flags = filename_create_ucf_flags(req, FILE_CREATE);
ucf_flags = filename_create_ucf_flags(req, FILE_CREATE, 0);
if (ucf_flags & UCF_GMT_PATHNAME) {
extract_snapshot_token(directory, &twrp);
}

View File

@ -520,7 +520,7 @@ static NTSTATUS smbd_smb2_create_durable_lease_check(struct smb_request *smb1req
return status;
}
ucf_flags = filename_create_ucf_flags(smb1req, FILE_OPEN);
ucf_flags = filename_create_ucf_flags(smb1req, FILE_OPEN, 0);
status = filename_convert_dirfsp(talloc_tos(),
fsp->conn,
filename,
@ -1063,8 +1063,9 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, state->ev);
}
ucf_flags = filename_create_ucf_flags(
smb1req, state->in_create_disposition);
ucf_flags = filename_create_ucf_flags(smb1req,
state->in_create_disposition,
state->in_create_options);
status = filename_convert_dirfsp(
req,