mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
s3: smbd: Change smb_unix_read_symlink() to use a real directory fsp for SMB_VFS_READLINKAT().
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
This commit is contained in:
parent
92ec8a0097
commit
0cbb940080
@ -4957,6 +4957,9 @@ static NTSTATUS smb_unix_read_symlink(connection_struct *conn,
|
||||
NTSTATUS status;
|
||||
size_t len = 0;
|
||||
int link_len = 0;
|
||||
struct smb_filename *parent_fname = NULL;
|
||||
struct smb_filename *base_name = NULL;
|
||||
|
||||
char *buffer = talloc_array(talloc_tos(), char, PATH_MAX+1);
|
||||
|
||||
if (!buffer) {
|
||||
@ -4971,12 +4974,24 @@ static NTSTATUS smb_unix_read_symlink(connection_struct *conn,
|
||||
return NT_STATUS_DOS(ERRSRV, ERRbadlink);
|
||||
}
|
||||
|
||||
link_len = SMB_VFS_READLINKAT(conn,
|
||||
status = parent_pathref(talloc_tos(),
|
||||
conn->cwd_fsp,
|
||||
smb_fname,
|
||||
&parent_fname,
|
||||
&base_name);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
TALLOC_FREE(buffer);
|
||||
return status;
|
||||
}
|
||||
|
||||
link_len = SMB_VFS_READLINKAT(conn,
|
||||
parent_fname->fsp,
|
||||
base_name,
|
||||
buffer,
|
||||
PATH_MAX);
|
||||
|
||||
TALLOC_FREE(parent_fname);
|
||||
|
||||
if (link_len == -1) {
|
||||
TALLOC_FREE(buffer);
|
||||
return map_nt_error_from_unix(errno);
|
||||
|
Loading…
x
Reference in New Issue
Block a user