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

s3: smbd: Rename get_ea_value() -> get_ea_value_fsp().

Remove the connection struct and smb_filename parameters.

There are now no more callers of SMB_VFS_GETXATTR().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Jeremy Allison 2021-06-22 17:53:29 -07:00 committed by Ralph Boehme
parent a117624bb1
commit e30094e6c0
3 changed files with 51 additions and 78 deletions

View File

@ -52,12 +52,10 @@ static ssize_t get_xattr_size_fsp(struct files_struct *fsp,
struct ea_struct ea;
ssize_t result;
status = get_ea_value(talloc_tos(),
fsp->conn,
fsp,
NULL,
xattr_name,
&ea);
status = get_ea_value_fsp(talloc_tos(),
fsp,
xattr_name,
&ea);
if (!NT_STATUS_IS_OK(status)) {
return -1;
}
@ -375,14 +373,12 @@ static int streams_xattr_openat(struct vfs_handle_struct *handle,
goto fail;
}
status = get_ea_value(talloc_tos(),
handle->conn,
fsp->base_fsp,
NULL,
xattr_name,
&ea);
status = get_ea_value_fsp(talloc_tos(),
fsp->base_fsp,
xattr_name,
&ea);
DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status)));
DBG_DEBUG("get_ea_value_fsp returned %s\n", nt_errstr(status));
if (!NT_STATUS_IS_OK(status)) {
if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
@ -645,12 +641,10 @@ static int streams_xattr_renameat(vfs_handle_struct *handle,
}
/* Read the old stream from the base file fsp. */
status = get_ea_value(talloc_tos(),
handle->conn,
pathref_src->fsp,
NULL,
src_xattr_name,
&ea);
status = get_ea_value_fsp(talloc_tos(),
pathref_src->fsp,
src_xattr_name,
&ea);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
goto fail;
@ -758,12 +752,10 @@ static NTSTATUS walk_xattr_streams(vfs_handle_struct *handle,
continue;
}
status = get_ea_value(names,
handle->conn,
smb_fname->fsp,
NULL,
names[i],
&ea);
status = get_ea_value_fsp(names,
smb_fname->fsp,
names[i],
&ea);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("Could not get ea %s for file %s: %s\n",
names[i],
@ -976,12 +968,10 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
return -1;
}
status = get_ea_value(talloc_tos(),
handle->conn,
fsp->base_fsp,
NULL,
sio->xattr_name,
&ea);
status = get_ea_value_fsp(talloc_tos(),
fsp->base_fsp,
sio->xattr_name,
&ea);
if (!NT_STATUS_IS_OK(status)) {
return -1;
}
@ -1039,20 +1029,18 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle,
return -1;
}
status = get_ea_value(talloc_tos(),
handle->conn,
fsp->base_fsp,
NULL,
sio->xattr_name,
&ea);
status = get_ea_value_fsp(talloc_tos(),
fsp->base_fsp,
sio->xattr_name,
&ea);
if (!NT_STATUS_IS_OK(status)) {
return -1;
}
length = ea.value.length-1;
DEBUG(10, ("streams_xattr_pread: get_ea_value returned %d bytes\n",
(int)length));
DBG_DEBUG("get_ea_value_fsp returned %d bytes\n",
(int)length);
/* Attempt to read past EOF. */
if (length <= offset) {
@ -1248,12 +1236,10 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle,
return -1;
}
status = get_ea_value(talloc_tos(),
handle->conn,
fsp->base_fsp,
NULL,
sio->xattr_name,
&ea);
status = get_ea_value_fsp(talloc_tos(),
fsp->base_fsp,
sio->xattr_name,
&ea);
if (!NT_STATUS_IS_OK(status)) {
return -1;
}

View File

@ -1199,11 +1199,10 @@ NTSTATUS check_access_fsp(struct files_struct *fsp,
uint32_t access_mask);
uint64_t smb_roundup(connection_struct *conn, uint64_t val);
bool samba_private_attr_name(const char *unix_ea_name);
NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
files_struct *fsp,
const struct smb_filename *smb_fname,
const char *ea_name,
struct ea_struct *pea);
NTSTATUS get_ea_value_fsp(TALLOC_CTX *mem_ctx,
files_struct *fsp,
const char *ea_name,
struct ea_struct *pea);
NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx,
files_struct *fsp,
char ***pnames,

View File

@ -222,18 +222,22 @@ bool samba_private_attr_name(const char *unix_ea_name)
Get one EA value. Fill in a struct ea_struct.
****************************************************************************/
NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx,
connection_struct *conn,
files_struct *fsp,
const struct smb_filename *smb_fname,
const char *ea_name,
struct ea_struct *pea)
NTSTATUS get_ea_value_fsp(TALLOC_CTX *mem_ctx,
files_struct *fsp,
const char *ea_name,
struct ea_struct *pea)
{
/* Get the value of this xattr. Max size is 64k. */
size_t attr_size = 256;
char *val = NULL;
ssize_t sizeret;
size_t max_xattr_size = lp_smbd_max_xattr_size(SNUM(conn));
size_t max_xattr_size = 0;
if (fsp == NULL) {
return NT_STATUS_INVALID_HANDLE;
}
max_xattr_size = lp_smbd_max_xattr_size(SNUM(fsp->conn));
again:
@ -242,21 +246,7 @@ NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
if (fsp) {
sizeret = SMB_VFS_FGETXATTR(fsp, ea_name, val, attr_size);
} else {
if (smb_fname == NULL) {
/*
* fsp == NULL and smb_fname == NULL.
* This check will go away once get_ea_value()
* is completely fsp-based.
*/
return NT_STATUS_INVALID_HANDLE;
}
sizeret = SMB_VFS_GETXATTR(conn, smb_fname,
ea_name, val, attr_size);
}
sizeret = SMB_VFS_FGETXATTR(fsp, ea_name, val, attr_size);
if (sizeret == -1 && errno == ERANGE && attr_size < max_xattr_size) {
attr_size = max_xattr_size;
goto again;
@ -475,12 +465,10 @@ static NTSTATUS get_ea_list_from_fsp(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
status = get_ea_value(listp,
fsp->conn,
fsp,
NULL,
names[i],
&listp->ea);
status = get_ea_value_fsp(listp,
fsp,
names[i],
&listp->ea);
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(listp);