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

smbd: Fix following symlinks if basedir != cwd_fsp

Unused so far, but soon we'll call this routine with a basedir that's
somewhere below the share root.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2024-10-23 14:14:39 +02:00 committed by Ralph Boehme
parent 82fd2230a8
commit 99fa20b418

View File

@ -1079,6 +1079,7 @@ NTSTATUS filename_convert_dirfsp(
struct symlink_reparse_struct *lnk = NULL;
NTSTATUS status;
char *target = NULL;
char *base_name = NULL;
char *safe_target = NULL;
size_t symlink_redirects = 0;
int ret;
@ -1146,9 +1147,13 @@ next:
return map_nt_error_from_unix(ret);
}
if (basedir != conn->cwd_fsp) {
base_name = basedir->fsp_name->base_name;
}
status = safe_symlink_target_path(mem_ctx,
conn->connectpath,
NULL,
base_name,
target,
lnk->unparsed_path_length,
&safe_target);
@ -1157,6 +1162,7 @@ next:
return status;
}
name_in = safe_target;
basedir = conn->cwd_fsp;
symlink_redirects += 1;