int ret_fd = -1;
uint32_t onefs_dos_attributes;
struct ifs_createfile_flags cf_flags = CF_FLAGS_NONE;
+ char *mapped_name = NULL;
+ NTSTATUS result;
START_PROFILE(syscall_createfile);
+ /* Translate the name to UNIX before calling ifs_createfile */
+ mapped_name = talloc_strdup(talloc_tos(), path);
+ if (mapped_name == NULL) {
+ errno = ENOMEM;
+ goto out;
+ }
+ result = SMB_VFS_TRANSLATE_NAME(conn, &mapped_name,
+ vfs_translate_to_unix);
+ if (!NT_STATUS_IS_OK(result)) {
+ goto out;
+ }
+
/* Setup security descriptor and get secinfo. */
if (sd != NULL) {
NTSTATUS status;
PARM_ALLOW_EXECUTE_ALWAYS_DEFAULT) &&
(open_access_mask & FILE_EXECUTE)) {
- DEBUG(3, ("Stripping execute bit from %s: (0x%x)\n", path,
+ DEBUG(3, ("Stripping execute bit from %s: (0x%x)\n", mapped_name,
open_access_mask));
/* Strip execute. */
"open_access_mask = 0x%x, flags = 0x%x, mode = 0%o, "
"desired_oplock = %s, id = 0x%x, secinfo = 0x%x, sd = %p, "
"dos_attributes = 0x%x, path = %s, "
- "default_acl=%s\n", base_fd, path,
+ "default_acl=%s\n", base_fd, mapped_name,
(unsigned int)open_access_mask,
(unsigned int)flags,
(unsigned int)mode,
onefs_oplock_str(onefs_oplock),
(unsigned int)id,
sec_info_effective, sd,
- (unsigned int)onefs_dos_attributes, path,
+ (unsigned int)onefs_dos_attributes, mapped_name,
cf_flags_and_bool(cf_flags, CF_FLAGS_DEFAULT_ACL) ?
"true" : "false"));
/* Initialize smlock struct for files/dirs but not internal opens */
if (!(oplock_request & INTERNAL_OPEN_ONLY)) {
- smlock_init(conn, &sml, is_executable(path), access_mask,
+ smlock_init(conn, &sml, is_executable(mapped_name), access_mask,
share_access, create_options);
psml = &sml;
}
smlock_dump(10, psml);
- ret_fd = ifs_createfile(base_fd, path,
+ ret_fd = ifs_createfile(base_fd, mapped_name,
(enum ifs_ace_rights)open_access_mask, flags & ~O_ACCMODE, mode,
onefs_oplock, id, psml, sec_info_effective, pifs_sd,
onefs_dos_attributes, cf_flags, &onefs_granted_oplock);
out:
END_PROFILE(syscall_createfile);
aclu_free_sd(pifs_sd, false);
+ TALLOC_FREE(mapped_name);
return ret_fd;
}
#include "includes.h"
-#define TO_UNIX 0
-#define TO_WINDOWS 1
-
#define GLOBAL_SNUM 0xFFFFFFF
#define MAP_SIZE 0xFF
#define MAP_NUM 0x101 /* max unicode charval / MAP_SIZE */
return False;
for (i = 0; i < MAP_SIZE;i++) {
- (*cmaps)->entry[i][TO_UNIX] = start + i;
- (*cmaps)->entry[i][TO_WINDOWS] = start + i;
+ (*cmaps)->entry[i][vfs_translate_to_unix] = start + i;
+ (*cmaps)->entry[i][vfs_translate_to_windows] = start + i;
}
return True;
/* set unix -> windows */
i = T_OFFSET(unix_map);
- cmaps[T_PICK(unix_map)]->entry[i][TO_WINDOWS] = windows_map;
+ cmaps[T_PICK(unix_map)]->entry[i][vfs_translate_to_windows] = windows_map;
/* set windows -> unix */
i = T_OFFSET(windows_map);
- cmaps[T_PICK(windows_map)]->entry[i][TO_UNIX] = unix_map;
+ cmaps[T_PICK(windows_map)]->entry[i][vfs_translate_to_unix] = unix_map;
}
static bool build_ranges(struct char_mappings **cmaps,
SMB_STRUCT_DIR *ret;
status = catia_string_replace_allocate(handle->conn, fname,
- &name_mapped, TO_UNIX);
+ &name_mapped, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return NULL;
* "WINDOWS displayable" name
*/
static NTSTATUS catia_translate_name(vfs_handle_struct *handle,
- char **mapped_name)
+ char **mapped_name,
+ enum vfs_translate_direction direction)
{
char *name = NULL;
NTSTATUS ret;
}
TALLOC_FREE(*mapped_name);
ret = catia_string_replace_allocate(handle->conn, name,
- mapped_name, TO_WINDOWS);
+ mapped_name, direction);
TALLOC_FREE(name);
if (!NT_STATUS_IS_OK(ret)) {
return ret;
}
- ret = SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name);
+ ret = SMB_VFS_NEXT_TRANSLATE_NAME(handle, mapped_name, direction);
return ret;
}
tmp_base_name = smb_fname->base_name;
status = catia_string_replace_allocate(handle->conn,
smb_fname->base_name,
- &name_mapped, TO_UNIX);
+ &name_mapped, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
return ret;
}
-/* @internal - Isilon create file support */
-static NTSTATUS catia_createfile(vfs_handle_struct *handle,
- struct smb_request *req,
- uint16_t root_dir_fid,
- struct smb_filename *smb_fname,
- uint32_t access_mask,
- uint32_t share_access,
- uint32_t create_disposition,
- uint32_t create_options,
- uint32_t file_attributes,
- uint32_t oplock_request,
- uint64_t allocation_size,
- struct security_descriptor *sd,
- struct ea_list *ea_list,
- files_struct **result,
- int *pinfo)
-{
- char *name_mapped = NULL;
- char *tmp_base_name;
- NTSTATUS ret;
-
- ret = catia_string_replace_allocate(handle->conn, smb_fname->base_name,
- &name_mapped, TO_UNIX);
- if (!NT_STATUS_IS_OK(ret)) {
- errno = map_errno_from_nt_status(ret);
- return ret;
- }
-
- tmp_base_name = smb_fname->base_name;
- DEBUG(5, ("catia_createfile converted %s->%s (orginally %s)\n",
- tmp_base_name, name_mapped, tmp_base_name));
- smb_fname->base_name = name_mapped;
- ret = SMB_VFS_NEXT_CREATE_FILE(handle, req, root_dir_fid,
- smb_fname, access_mask, share_access,
- create_disposition, create_options,
- file_attributes, oplock_request,
- allocation_size, sd, ea_list,
- result, pinfo);
-
- smb_fname->base_name = tmp_base_name;
- TALLOC_FREE(name_mapped);
-
- return ret;
-}
-
static int catia_rename(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst)
status = catia_string_replace_allocate(handle->conn,
smb_fname_src->base_name,
- &src_name_mapped, TO_UNIX);
+ &src_name_mapped, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
status = catia_string_replace_allocate(handle->conn,
smb_fname_dst->base_name,
- &dst_name_mapped, TO_UNIX);
+ &dst_name_mapped, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
status = catia_string_replace_allocate(handle->conn,
smb_fname->base_name,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
status = catia_string_replace_allocate(handle->conn,
smb_fname->base_name,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
status = catia_string_replace_allocate(handle->conn,
smb_fname->base_name,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
int ret;
status = catia_string_replace_allocate(handle->conn, path,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
int ret;
status = catia_string_replace_allocate(handle->conn, path,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
int ret;
status = catia_string_replace_allocate(handle->conn, path,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
int ret;
status = catia_string_replace_allocate(handle->conn, path,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
int ret;
status = catia_string_replace_allocate(handle->conn, path,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
status = catia_string_replace_allocate(handle->conn,
smb_fname->base_name,
- &name, TO_UNIX);
+ &name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
char *ret = NULL;
status = catia_string_replace_allocate(handle->conn, path,
- &mapped_name, TO_UNIX);
+ &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return NULL;
int ret;
status = catia_string_replace_allocate(handle->conn, path,
- &mapped_name, TO_UNIX);
+ &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
NTSTATUS status;
status = catia_string_replace_allocate(handle->conn, path,
- &mapped_name, TO_UNIX);
+ &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return status;
NTSTATUS status;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, TO_UNIX);
+ path, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return status;
int ret;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, TO_UNIX);
+ path, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
SMB_ACL_T ret;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, TO_UNIX);
+ path, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return NULL;
int ret;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, TO_UNIX);
+ path, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
int ret;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, TO_UNIX);
+ path, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- name, &mapped_name, TO_UNIX);
+ name, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- name, &mapped_name, TO_UNIX);
+ name, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, TO_UNIX);
+ path, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- path, &mapped_name, TO_UNIX);
+ path, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- name, &mapped_name, TO_UNIX);
+ name, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- name, &mapped_name, TO_UNIX);
+ name, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- name, &mapped_name, TO_UNIX);
+ name, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
ssize_t ret;
status = catia_string_replace_allocate(handle->conn,
- name, &mapped_name, TO_UNIX);
+ name, &mapped_name, vfs_translate_to_unix);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
return -1;
.rmdir = catia_rmdir,
.opendir = catia_opendir,
.open = catia_open,
- .create_file = catia_createfile,
.rename = catia_rename,
.stat = catia_stat,
.lstat = catia_lstat,