return False;
}
-static NTSTATUS catia_string_replace_allocate(connection_struct *conn,
- const char *name_in,
- char **mapped_name,
- enum vfs_translate_direction direction)
+static int catia_string_replace_allocate(
+ connection_struct *conn,
+ const char *name_in,
+ char **mapped_name,
+ enum vfs_translate_direction direction)
{
struct share_mapping_entry *selected;
int ret;
/* No mappings found. Just use the old name */
*mapped_name = talloc_strdup(talloc_tos(), name_in);
if (!*mapped_name) {
- errno = ENOMEM;
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
- return NT_STATUS_OK;
+ return 0;
}
ret = string_replace_allocate(conn,
talloc_tos(),
mapped_name,
direction);
- if (ret != 0) {
- return map_nt_error_from_unix(ret);
- }
- return NT_STATUS_OK;
+ return ret;
}
static int catia_connect(struct vfs_handle_struct *handle,
{
char *name = NULL;
char *mapped_name;
- NTSTATUS status, ret;
+ NTSTATUS ret;
+ int rc;
/*
* Copy the supplied name and free the memory for mapped_name,
errno = ENOMEM;
return NT_STATUS_NO_MEMORY;
}
- status = catia_string_replace_allocate(handle->conn, name,
- &mapped_name, direction);
+ rc = catia_string_replace_allocate(handle->conn,
+ name,
+ &mapped_name,
+ direction);
TALLOC_FREE(name);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ if (rc != 0) {
+ return map_nt_error_from_unix(rc);
}
ret = SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
const struct catia_cache * const *busy =
(const struct catia_cache * const *)_cc;
struct catia_cache *cc = NULL;
- NTSTATUS status;
bool make_tmp_cache = false;
+ int ret;
*_cc = NULL;
mem_ctx = cc;
}
-
- status = catia_string_replace_allocate(handle->conn,
- fsp->fsp_name->base_name,
- &cc->fname,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = catia_string_replace_allocate(handle->conn,
+ fsp->fsp_name->base_name,
+ &cc->fname,
+ vfs_translate_to_unix);
+ if (ret != 0) {
catia_free_cc(&cc, handle, fsp);
- errno = map_errno_from_nt_status(status);
+ errno = ret;
return -1;
}
talloc_steal(mem_ctx, cc->fname);
if (fsp_is_alternate_stream(fsp)) {
- status = catia_string_replace_allocate(
+ ret = catia_string_replace_allocate(
handle->conn,
fsp->base_fsp->fsp_name->base_name,
&cc->base_fname,
vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
+ if (ret != 0) {
catia_free_cc(&cc, handle, fsp);
- errno = map_errno_from_nt_status(status);
+ errno = ret;
return -1;
}
talloc_steal(mem_ctx, cc->base_fname);
struct smb_filename *smb_fname = NULL;
struct catia_cache *cc = NULL;
char *mapped_name = NULL;
- NTSTATUS status;
int ret;
int saved_errno = 0;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname_in->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname_in->base_name,
+ &mapped_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
struct smb_filename *smb_fname_dst_tmp = NULL;
char *src_name_mapped = NULL;
char *dst_name_mapped = NULL;
- NTSTATUS status;
int ret = -1;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname_src->base_name,
- &src_name_mapped, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname_src->base_name,
+ &src_name_mapped,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
- status = catia_string_replace_allocate(handle->conn,
- smb_fname_dst->base_name,
- &dst_name_mapped, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return -1;
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname_dst->base_name,
+ &dst_name_mapped,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ TALLOC_FREE(src_name_mapped);
+ errno = ret;
+ ret = -1;
+ goto out;
}
/* Setup temporary smb_filename structs. */
smb_fname_src_tmp = cp_smb_filename(ctx, smb_fname_src);
if (smb_fname_src_tmp == NULL) {
errno = ENOMEM;
+ ret = -1;
goto out;
}
smb_fname_dst_tmp = cp_smb_filename(ctx, smb_fname_dst);
if (smb_fname_dst_tmp == NULL) {
errno = ENOMEM;
+ ret = -1;
goto out;
}
char *name = NULL;
char *tmp_base_name;
int ret;
- NTSTATUS status;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
char *name = NULL;
char *tmp_base_name;
int ret;
- NTSTATUS status;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
struct catia_cache *cc = NULL;
struct smb_filename *smb_fname_tmp = NULL;
char *name = NULL;
- NTSTATUS status;
int ret;
ret = CATIA_FETCH_FSP_PRE_NEXT(talloc_tos(), handle, dirfsp, &cc);
return ret;
}
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
goto out;
}
gid_t gid)
{
char *name = NULL;
- NTSTATUS status;
int ret;
int saved_errno;
struct smb_filename *catia_smb_fname = NULL;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
catia_smb_fname = synthetic_smb_fname(talloc_tos(),
mode_t mode)
{
char *name = NULL;
- NTSTATUS status;
int ret;
struct smb_filename *catia_smb_fname = NULL;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
catia_smb_fname = synthetic_smb_fname(talloc_tos(),
{
char *name = NULL;
struct smb_filename *catia_smb_fname = NULL;
- NTSTATUS status;
int ret;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
char *mapped_name = NULL;
struct smb_filename *catia_smb_fname = NULL;
struct smb_filename *return_fname = NULL;
- NTSTATUS status;
+ int ret;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &mapped_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return NULL;
}
struct smb_filename *smb_fname = NULL;
unsigned int num_streams = 0;
struct stream_struct *streams = NULL;
+ int ret;
smb_fname = fsp->fsp_name;
*_num_streams = 0;
*_streams = NULL;
- status = catia_string_replace_allocate(handle->conn,
- smb_fname->base_name,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ ret = catia_string_replace_allocate(handle->conn,
+ smb_fname->base_name,
+ &mapped_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ return map_nt_error_from_unix(ret);
}
status = synthetic_pathref(talloc_tos(),
stream_type += 1;
}
- status = catia_string_replace_allocate(handle->conn,
- stream_name,
- &mapped_name,
- vfs_translate_to_windows);
- if (!NT_STATUS_IS_OK(status)) {
+ ret = catia_string_replace_allocate(handle->conn,
+ stream_name,
+ &mapped_name,
+ vfs_translate_to_windows);
+ if (ret != 0) {
TALLOC_FREE(streams);
- return status;
+ return map_nt_error_from_unix(ret);
}
if (stream_type != NULL) {
size_t size)
{
char *mapped_xattr_name = NULL;
- NTSTATUS status;
ssize_t result;
+ int ret;
- status = catia_string_replace_allocate(handle->conn,
- name, &mapped_xattr_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ name,
+ &mapped_xattr_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
const char *name)
{
char *mapped_name = NULL;
- NTSTATUS status;
int ret;
- status = catia_string_replace_allocate(handle->conn,
- name, &mapped_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ name,
+ &mapped_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
int flags)
{
char *mapped_xattr_name = NULL;
- NTSTATUS status;
int ret;
- status = catia_string_replace_allocate(
- handle->conn, name, &mapped_xattr_name, vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
+ ret = catia_string_replace_allocate(handle->conn,
+ name,
+ &mapped_xattr_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ errno = ret;
return -1;
}
const char *path = smb_fname->base_name;
struct smb_filename *mapped_smb_fname = NULL;
NTSTATUS status;
+ int ret;
- status = catia_string_replace_allocate(handle->conn,
- path,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return status;
+ ret = catia_string_replace_allocate(handle->conn,
+ path,
+ &mapped_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ return map_nt_error_from_unix(ret);
}
mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
mapped_name,
const char *path = smb_fname->base_name;
struct smb_filename *mapped_smb_fname = NULL;
NTSTATUS status;
+ int ret;
- status = catia_string_replace_allocate(handle->conn,
- path,
- &mapped_name,
- vfs_translate_to_unix);
- if (!NT_STATUS_IS_OK(status)) {
- errno = map_errno_from_nt_status(status);
- return status;
+ ret = catia_string_replace_allocate(handle->conn,
+ path,
+ &mapped_name,
+ vfs_translate_to_unix);
+ if (ret != 0) {
+ return map_nt_error_from_unix(ret);
}
mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
mapped_name,