summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_catia.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/modules/vfs_catia.c')
-rw-r--r--source3/modules/vfs_catia.c190
1 files changed, 37 insertions, 153 deletions
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index c0bb5ef86a..b9f241e240 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -10,7 +10,6 @@
*
* Copyright (C) Volker Lendecke, 2005
* Copyright (C) Aravind Srinivasan, 2009
- * Copyright (C) Guenter Kukkukk, 2013
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,11 +29,6 @@
#include "includes.h"
#include "smbd/smbd.h"
-static int vfs_catia_debug_level = DBGC_VFS;
-
-#undef DBGC_CLASS
-#define DBGC_CLASS vfs_catia_debug_level
-
#define GLOBAL_SNUM 0xFFFFFFF
#define MAP_SIZE 0xFF
#define MAP_NUM 0x101 /* max unicode charval / MAP_SIZE */
@@ -267,14 +261,14 @@ static NTSTATUS catia_string_replace_allocate(connection_struct *conn,
return NT_STATUS_OK;
}
-static SMB_STRUCT_DIR *catia_opendir(vfs_handle_struct *handle,
+static DIR *catia_opendir(vfs_handle_struct *handle,
const char *fname,
const char *mask,
uint32 attr)
{
char *name_mapped = NULL;
NTSTATUS status;
- SMB_STRUCT_DIR *ret;
+ DIR *ret;
status = catia_string_replace_allocate(handle->conn, fname,
&name_mapped, vfs_translate_to_unix);
@@ -301,7 +295,7 @@ static NTSTATUS catia_translate_name(struct vfs_handle_struct *handle,
{
char *name = NULL;
char *mapped_name;
- NTSTATUS status, ret;
+ NTSTATUS ret;
/*
* Copy the supplied name and free the memory for mapped_name,
@@ -314,12 +308,12 @@ static NTSTATUS catia_translate_name(struct vfs_handle_struct *handle,
errno = ENOMEM;
return NT_STATUS_NO_MEMORY;
}
- status = catia_string_replace_allocate(handle->conn, name,
+ ret = catia_string_replace_allocate(handle->conn, name,
&mapped_name, direction);
TALLOC_FREE(name);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
+ if (!NT_STATUS_IS_OK(ret)) {
+ return ret;
}
ret = SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction,
@@ -327,8 +321,6 @@ static NTSTATUS catia_translate_name(struct vfs_handle_struct *handle,
if (NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) {
*pmapped_name = talloc_move(mem_ctx, &mapped_name);
- /* we need to return the former translation result here */
- ret = status;
} else {
TALLOC_FREE(mapped_name);
}
@@ -711,6 +703,7 @@ static NTSTATUS
catia_get_nt_acl(struct vfs_handle_struct *handle,
const char *path,
uint32 security_info,
+ TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc)
{
char *mapped_name = NULL;
@@ -723,7 +716,7 @@ catia_get_nt_acl(struct vfs_handle_struct *handle,
return status;
}
status = SMB_VFS_NEXT_GET_NT_ACL(handle, mapped_name,
- security_info, ppdesc);
+ security_info, mem_ctx, ppdesc);
TALLOC_FREE(mapped_name);
return status;
@@ -753,7 +746,8 @@ catia_chmod_acl(vfs_handle_struct *handle,
static SMB_ACL_T
catia_sys_acl_get_file(vfs_handle_struct *handle,
const char *path,
- SMB_ACL_TYPE_T type)
+ SMB_ACL_TYPE_T type,
+ TALLOC_CTX *mem_ctx)
{
char *mapped_name = NULL;
NTSTATUS status;
@@ -766,7 +760,7 @@ catia_sys_acl_get_file(vfs_handle_struct *handle,
return NULL;
}
- ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_name, type);
+ ret = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, mapped_name, type, mem_ctx);
TALLOC_FREE(mapped_name);
return ret;
@@ -839,28 +833,6 @@ catia_getxattr(vfs_handle_struct *handle, const char *path,
}
static ssize_t
-catia_lgetxattr(vfs_handle_struct *handle, const char *path,
- const char *name, void *value, size_t size)
-{
- char *mapped_name = NULL;
- NTSTATUS status;
- ssize_t 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);
- return -1;
- }
-
-
- ret = SMB_VFS_NEXT_LGETXATTR(handle, path, mapped_name, value, size);
- TALLOC_FREE(mapped_name);
-
- return ret;
-}
-
-static ssize_t
catia_listxattr(vfs_handle_struct *handle, const char *path,
char *list, size_t size)
{
@@ -882,28 +854,6 @@ catia_listxattr(vfs_handle_struct *handle, const char *path,
return ret;
}
-static ssize_t
-catia_llistxattr(vfs_handle_struct *handle, const char *path,
- char *list, size_t size)
-{
- char *mapped_name = NULL;
- NTSTATUS status;
- ssize_t 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 -1;
- }
-
-
- ret = SMB_VFS_NEXT_LLISTXATTR(handle, mapped_name, list, size);
- TALLOC_FREE(mapped_name);
-
- return ret;
-}
-
static int
catia_removexattr(vfs_handle_struct *handle, const char *path,
const char *name)
@@ -927,28 +877,6 @@ catia_removexattr(vfs_handle_struct *handle, const char *path,
}
static int
-catia_lremovexattr(vfs_handle_struct *handle, const char *path,
- const char *name)
-{
- char *mapped_name = NULL;
- NTSTATUS status;
- ssize_t 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);
- return -1;
- }
-
-
- ret = SMB_VFS_NEXT_LREMOVEXATTR(handle, path, mapped_name);
- TALLOC_FREE(mapped_name);
-
- return ret;
-}
-
-static int
catia_setxattr(vfs_handle_struct *handle, const char *path,
const char *name, const void *value, size_t size,
int flags)
@@ -971,80 +899,36 @@ catia_setxattr(vfs_handle_struct *handle, const char *path,
return ret;
}
-static int
-catia_lsetxattr(vfs_handle_struct *handle, const char *path,
- const char *name, const void *value, size_t size,
- int flags)
-{
- char *mapped_name = NULL;
- NTSTATUS status;
- ssize_t 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);
- return -1;
- }
-
-
- ret = SMB_VFS_NEXT_LSETXATTR(handle, path, mapped_name, value, size, flags);
- TALLOC_FREE(mapped_name);
-
- return ret;
-}
-
static struct vfs_fn_pointers vfs_catia_fns = {
- .mkdir = catia_mkdir,
- .rmdir = catia_rmdir,
- .opendir = catia_opendir,
- .open_fn = catia_open,
- .rename = catia_rename,
- .stat = catia_stat,
- .lstat = catia_lstat,
- .unlink = catia_unlink,
- .chown = catia_chown,
- .lchown = catia_lchown,
- .chdir = catia_chdir,
- .ntimes = catia_ntimes,
- .realpath = catia_realpath,
- .chflags = catia_chflags,
- .streaminfo = catia_streaminfo,
- .translate_name = catia_translate_name,
- .get_nt_acl = catia_get_nt_acl,
- .chmod_acl = catia_chmod_acl,
- .sys_acl_get_file = catia_sys_acl_get_file,
- .sys_acl_set_file = catia_sys_acl_set_file,
- .sys_acl_delete_def_file = catia_sys_acl_delete_def_file,
- .getxattr = catia_getxattr,
- .lgetxattr = catia_lgetxattr,
- .listxattr = catia_listxattr,
- .llistxattr = catia_llistxattr,
- .removexattr = catia_removexattr,
- .lremovexattr = catia_lremovexattr,
- .setxattr = catia_setxattr,
- .lsetxattr = catia_lsetxattr,
+ .mkdir_fn = catia_mkdir,
+ .rmdir_fn = catia_rmdir,
+ .opendir_fn = catia_opendir,
+ .open_fn = catia_open,
+ .rename_fn = catia_rename,
+ .stat_fn = catia_stat,
+ .lstat_fn = catia_lstat,
+ .unlink_fn = catia_unlink,
+ .chown_fn = catia_chown,
+ .lchown_fn = catia_lchown,
+ .chdir_fn = catia_chdir,
+ .ntimes_fn = catia_ntimes,
+ .realpath_fn = catia_realpath,
+ .chflags_fn = catia_chflags,
+ .streaminfo_fn = catia_streaminfo,
+ .translate_name_fn = catia_translate_name,
+ .get_nt_acl_fn = catia_get_nt_acl,
+ .chmod_acl_fn = catia_chmod_acl,
+ .sys_acl_get_file_fn = catia_sys_acl_get_file,
+ .sys_acl_set_file_fn = catia_sys_acl_set_file,
+ .sys_acl_delete_def_file_fn = catia_sys_acl_delete_def_file,
+ .getxattr_fn = catia_getxattr,
+ .listxattr_fn = catia_listxattr,
+ .removexattr_fn = catia_removexattr,
+ .setxattr_fn = catia_setxattr,
};
NTSTATUS vfs_catia_init(void)
{
- NTSTATUS ret;
-
- ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "catia",
+ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "catia",
&vfs_catia_fns);
- if (!NT_STATUS_IS_OK(ret))
- return ret;
-
- vfs_catia_debug_level = debug_add_class("catia");
- if (vfs_catia_debug_level == -1) {
- vfs_catia_debug_level = DBGC_VFS;
- DEBUG(0, ("vfs_catia: Couldn't register custom debugging "
- "class!\n"));
- } else {
- DEBUG(10, ("vfs_catia: Debug class number of "
- "'catia': %d\n", vfs_catia_debug_level));
- }
-
- return ret;
-
}