mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
smbd: add a directory argument to safe_symlink_target_path()
Existing caller passes NULL, no change in behaviour. Prepares for replacing symlink_target_below_conn() in open.c. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15549 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
parent
0515dded4d
commit
fc80c72d65
@ -706,6 +706,7 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx,
|
||||
uint32_t flags);
|
||||
NTSTATUS safe_symlink_target_path(TALLOC_CTX *mem_ctx,
|
||||
const char *connectpath,
|
||||
const char *dir,
|
||||
const char *target,
|
||||
size_t unparsed,
|
||||
char **_relative);
|
||||
|
@ -661,6 +661,7 @@ static char *symlink_target_path(
|
||||
|
||||
NTSTATUS safe_symlink_target_path(TALLOC_CTX *mem_ctx,
|
||||
const char *connectpath,
|
||||
const char *dir,
|
||||
const char *target,
|
||||
size_t unparsed,
|
||||
char **_relative)
|
||||
@ -676,11 +677,22 @@ NTSTATUS safe_symlink_target_path(TALLOC_CTX *mem_ctx,
|
||||
|
||||
if (target[0] == '/') {
|
||||
abs_target = talloc_strdup(mem_ctx, target);
|
||||
} else {
|
||||
} else if (dir == NULL) {
|
||||
abs_target = talloc_asprintf(mem_ctx,
|
||||
"%s/%s",
|
||||
connectpath,
|
||||
target);
|
||||
} else if (dir[0] == '/') {
|
||||
abs_target = talloc_asprintf(mem_ctx,
|
||||
"%s/%s",
|
||||
dir,
|
||||
target);
|
||||
} else {
|
||||
abs_target = talloc_asprintf(mem_ctx,
|
||||
"%s/%s/%s",
|
||||
connectpath,
|
||||
dir,
|
||||
target);
|
||||
}
|
||||
if (abs_target == NULL) {
|
||||
goto fail;
|
||||
@ -1192,6 +1204,7 @@ next:
|
||||
|
||||
status = safe_symlink_target_path(mem_ctx,
|
||||
conn->connectpath,
|
||||
NULL,
|
||||
target,
|
||||
symlink_err->unparsed,
|
||||
&safe_target);
|
||||
|
Loading…
Reference in New Issue
Block a user