mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
smbd: use fsp_get_pathref_fd() for "internal" xattr functions
We're using xattr data storage for internal reasons in these places, so in all places it's safe to use a possibly root opened fd. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
bc908ea3f2
commit
5648662b2f
@ -46,7 +46,7 @@ static ssize_t getxattr_do(vfs_handle_struct *handle,
|
||||
int saved_errno = 0;
|
||||
|
||||
become_root();
|
||||
if (fsp && fsp->fh->fd != -1) {
|
||||
if (fsp && fsp_get_pathref_fd(fsp) != -1) {
|
||||
sizeret = SMB_VFS_FGETXATTR(fsp, xattr_name, val, size);
|
||||
} else {
|
||||
sizeret = SMB_VFS_GETXATTR(handle->conn, smb_fname,
|
||||
@ -196,7 +196,7 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
|
||||
(unsigned int)pblob->length, fsp_str_dbg(fsp)));
|
||||
|
||||
become_root();
|
||||
if (fsp->fh->fd != -1) {
|
||||
if (fsp_get_pathref_fd(fsp) != -1) {
|
||||
ret = SMB_VFS_FSETXATTR(fsp, XATTR_NTACL_NAME,
|
||||
pblob->data, pblob->length, 0);
|
||||
} else {
|
||||
|
@ -133,7 +133,7 @@ static NTSTATUS nfs4acl_get_blob(struct vfs_handle_struct *handle,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (fsp != NULL && fsp->fh->fd != -1) {
|
||||
if (fsp != NULL && fsp_get_pathref_fd(fsp) != -1) {
|
||||
length = SMB_VFS_NEXT_FGETXATTR(handle,
|
||||
fsp,
|
||||
config->xattr_name,
|
||||
@ -335,7 +335,7 @@ static bool nfs4acl_smb4acl_set_fn(vfs_handle_struct *handle,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fsp->fh->fd != -1) {
|
||||
if (fsp_get_pathref_fd(fsp) != -1) {
|
||||
ret = SMB_VFS_NEXT_FSETXATTR(handle, fsp, config->xattr_name,
|
||||
blob.data, blob.length, 0);
|
||||
} else {
|
||||
|
@ -271,7 +271,7 @@ static void store_inheritance_attributes(files_struct *fsp,
|
||||
pai_buf = create_pai_buf_v2(file_ace_list, dir_ace_list,
|
||||
sd_type, &store_size);
|
||||
|
||||
if (fsp->fh->fd != -1) {
|
||||
if (fsp_get_pathref_fd(fsp) != -1) {
|
||||
ret = SMB_VFS_FSETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME,
|
||||
pai_buf, store_size, 0);
|
||||
} else {
|
||||
@ -624,7 +624,7 @@ static struct pai_val *fload_inherited_info(files_struct *fsp)
|
||||
}
|
||||
|
||||
do {
|
||||
if (fsp->fh->fd != -1) {
|
||||
if (fsp_get_pathref_fd(fsp) != -1) {
|
||||
ret = SMB_VFS_FGETXATTR(fsp, SAMBA_POSIX_INHERITANCE_EA_NAME,
|
||||
pai_buf, pai_buf_size);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user