1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

s3: smbd: Allow rmdir_internals() to cope with veto'ed symlinks.

We are only dealing with VETO'ed objects
here. If it's a symlink, just delete the
link without caring what it is pointing
to as this operation is safe.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2021-06-03 11:15:50 -07:00 committed by Ralph Boehme
parent 452dbd10d9
commit bf36c88516

View File

@ -1125,25 +1125,44 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, struct files_struct *fsp)
goto err_break;
}
status = synthetic_pathref(talloc_tos(),
dirfsp,
dname,
NULL,
&smb_dname_full->st,
smb_dname->twrp,
smb_dname->flags,
&direntry_fname);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
goto err_break;
}
/*
* We are only dealing with VETO'ed objects
* here. If it's a symlink, just delete the
* link without caring what it is pointing
* to.
*/
if (S_ISLNK(smb_dname_full->st.st_ex_mode)) {
direntry_fname = synthetic_smb_fname(talloc_tos(),
dname,
NULL,
&smb_dname_full->st,
smb_dname->twrp,
smb_dname->flags);
if (direntry_fname == NULL) {
errno = ENOMEM;
goto err_break;
}
} else {
status = synthetic_pathref(talloc_tos(),
dirfsp,
dname,
NULL,
&smb_dname_full->st,
smb_dname->twrp,
smb_dname->flags,
&direntry_fname);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
goto err_break;
}
if (!is_visible_fsp(direntry_fname->fsp, false)) {
TALLOC_FREE(fullname);
TALLOC_FREE(smb_dname_full);
TALLOC_FREE(talloced);
TALLOC_FREE(direntry_fname);
continue;
if (!is_visible_fsp(direntry_fname->fsp, false)) {
TALLOC_FREE(fullname);
TALLOC_FREE(smb_dname_full);
TALLOC_FREE(talloced);
TALLOC_FREE(direntry_fname);
continue;
}
}
unlink_flags = 0;