static ssize_t get_xattr_size_fsp(struct files_struct *fsp,
const char *xattr_name)
{
- NTSTATUS status;
+ int ret;
struct ea_struct ea;
ssize_t result;
- status = get_ea_value_fsp(talloc_tos(),
- fsp,
- xattr_name,
- &ea);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = get_ea_value_fsp(talloc_tos(), fsp, xattr_name, &ea);
+ if (ret != 0) {
return -1;
}
goto fail;
}
- status = get_ea_value_fsp(talloc_tos(),
- fsp->base_fsp,
- xattr_name,
- &ea);
-
- DBG_DEBUG("get_ea_value_fsp returned %s\n", nt_errstr(status));
+ ret = get_ea_value_fsp(talloc_tos(), fsp->base_fsp, xattr_name, &ea);
+ if (ret != 0) {
+ DBG_DEBUG("get_ea_value_fsp returned %s\n", strerror(ret));
+ status = map_nt_error_from_unix(ret);
+ }
if (!NT_STATUS_IS_OK(status)) {
if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
}
/* Read the old stream from the base file fsp. */
- 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);
+ ret = get_ea_value_fsp(talloc_tos(),
+ pathref_src->fsp,
+ src_xattr_name,
+ &ea);
+ if (ret != 0) {
+ errno = ret;
goto fail;
}
for (i=0; i<num_names; i++) {
struct ea_struct ea;
+ int ret;
/*
* We want to check with samba_private_attr_name()
continue;
}
- 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],
- smb_fname->base_name,
- nt_errstr(status)));
+ ret = get_ea_value_fsp(names, smb_fname->fsp, names[i], &ea);
+ if (ret != 0) {
+ DBG_DEBUG("Could not get ea %s for file %s: %s\n",
+ names[i],
+ smb_fname->base_name,
+ strerror(ret));
continue;
}
struct stream_io *sio =
(struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
struct ea_struct ea;
- NTSTATUS status;
int ret;
DEBUG(10, ("streams_xattr_pwrite called for %d bytes\n", (int)n));
return -1;
}
- status = get_ea_value_fsp(talloc_tos(),
- fsp->base_fsp,
- sio->xattr_name,
- &ea);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = get_ea_value_fsp(talloc_tos(),
+ fsp->base_fsp,
+ sio->xattr_name,
+ &ea);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
struct stream_io *sio =
(struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
struct ea_struct ea;
- NTSTATUS status;
+ int ret;
size_t length, overlap;
DEBUG(10, ("streams_xattr_pread: offset=%d, size=%d\n",
return -1;
}
- status = get_ea_value_fsp(talloc_tos(),
- fsp->base_fsp,
- sio->xattr_name,
- &ea);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = get_ea_value_fsp(talloc_tos(),
+ fsp->base_fsp,
+ sio->xattr_name,
+ &ea);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
int ret;
uint8_t *tmp;
struct ea_struct ea;
- NTSTATUS status;
struct stream_io *sio =
(struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
return -1;
}
- status = get_ea_value_fsp(talloc_tos(),
- fsp->base_fsp,
- sio->xattr_name,
- &ea);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = get_ea_value_fsp(talloc_tos(),
+ fsp->base_fsp,
+ sio->xattr_name,
+ &ea);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
uint32_t access_requested);
uint64_t smb_roundup(connection_struct *conn, uint64_t val);
bool samba_private_attr_name(const char *unix_ea_name);
-NTSTATUS get_ea_value_fsp(TALLOC_CTX *mem_ctx,
- files_struct *fsp,
- const char *ea_name,
- struct ea_struct *pea);
+int get_ea_value_fsp(TALLOC_CTX *mem_ctx,
+ files_struct *fsp,
+ const char *ea_name,
+ struct ea_struct *pea);
NTSTATUS get_ea_names_from_fsp(TALLOC_CTX *mem_ctx,
files_struct *fsp,
char ***pnames,
Get one EA value. Fill in a struct ea_struct.
****************************************************************************/
-NTSTATUS get_ea_value_fsp(TALLOC_CTX *mem_ctx,
- files_struct *fsp,
- const char *ea_name,
- struct ea_struct *pea)
+int 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;
bool refuse;
if (fsp == NULL) {
- return NT_STATUS_INVALID_HANDLE;
+ return EINVAL;
}
refuse = refuse_symlink_fsp(fsp);
if (refuse) {
- return NT_STATUS_ACCESS_DENIED;
+ return EACCES;
}
max_xattr_size = lp_smbd_max_xattr_size(SNUM(fsp->conn));
val = talloc_realloc(mem_ctx, val, char, attr_size);
if (!val) {
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
sizeret = SMB_VFS_FGETXATTR(fsp, ea_name, val, attr_size);
}
if (sizeret == -1) {
- return map_nt_error_from_unix(errno);
+ return errno;
}
DBG_DEBUG("EA %s is of length %zd\n", ea_name, sizeret);
}
if (pea->name == NULL) {
TALLOC_FREE(val);
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
pea->value.data = (unsigned char *)val;
pea->value.length = (size_t)sizeret;
- return NT_STATUS_OK;
+ return 0;
}
NTSTATUS get_ea_names_from_fsp(TALLOC_CTX *mem_ctx,
for (i=0; i<num_names; i++) {
struct ea_list *listp;
fstring dos_ea_name;
+ int ret;
/*
* POSIX EA names are divided into several namespaces by
return NT_STATUS_NO_MEMORY;
}
- status = get_ea_value_fsp(listp,
- fsp,
- names[i],
- &listp->ea);
+ ret = get_ea_value_fsp(listp, fsp, names[i], &listp->ea);
- if (!NT_STATUS_IS_OK(status)) {
+ if (ret != 0) {
TALLOC_FREE(listp);
- return status;
+ return map_nt_error_from_unix(ret);
}
if (listp->ea.value.length == 0) {