4 * Implement a fixed mapping of forbidden NT characters in filenames that are
5 * used a lot by the CAD package Catia.
7 * Yes, this a BAD BAD UGLY INCOMPLETE hack, but it helps quite some people
8 * out there. Catia V4 on AIX uses characters like "<*$ a *lot*, all forbidden
11 * Copyright (C) Volker Lendecke, 2005
12 * Copyright (C) Aravind Srinivasan, 2009
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see <http://www.gnu.org/licenses/>.
34 #define GLOBAL_SNUM 0xFFFFFFF
36 #define MAP_NUM 0x101 /* max unicode charval / MAP_SIZE */
37 #define T_OFFSET(_v_) ((_v_ % MAP_SIZE))
38 #define T_START(_v_) (((_v_ / MAP_SIZE) * MAP_SIZE))
39 #define T_PICK(_v_) ((_v_ / MAP_SIZE))
41 struct char_mappings
{
42 smb_ucs2_t entry
[MAP_SIZE
][2];
45 struct share_mapping_entry
{
47 struct share_mapping_entry
*next
;
48 struct char_mappings
**mappings
;
51 struct share_mapping_entry
*srt_head
= NULL
;
53 static bool build_table(struct char_mappings
**cmaps
, int value
)
56 int start
= T_START(value
);
58 (*cmaps
) = talloc_zero(NULL
, struct char_mappings
);
63 for (i
= 0; i
< MAP_SIZE
;i
++) {
64 (*cmaps
)->entry
[i
][TO_UNIX
] = start
+ i
;
65 (*cmaps
)->entry
[i
][TO_WINDOWS
] = start
+ i
;
71 static void set_tables(struct char_mappings
**cmaps
,
77 /* set unix -> windows */
78 i
= T_OFFSET(unix_map
);
79 cmaps
[T_PICK(unix_map
)]->entry
[i
][TO_WINDOWS
] = windows_map
;
81 /* set windows -> unix */
82 i
= T_OFFSET(windows_map
);
83 cmaps
[T_PICK(windows_map
)]->entry
[i
][TO_UNIX
] = unix_map
;
86 static bool build_ranges(struct char_mappings
**cmaps
,
91 if (!cmaps
[T_PICK(unix_map
)]) {
92 if (!build_table(&cmaps
[T_PICK(unix_map
)], unix_map
))
96 if (!cmaps
[T_PICK(windows_map
)]) {
97 if (!build_table(&cmaps
[T_PICK(windows_map
)], windows_map
))
101 set_tables(cmaps
, unix_map
, windows_map
);
106 static struct share_mapping_entry
*get_srt(connection_struct
*conn
,
107 struct share_mapping_entry
**global
)
109 struct share_mapping_entry
*share
;
111 for (share
= srt_head
; share
!= NULL
; share
= share
->next
) {
112 if (share
->snum
== GLOBAL_SNUM
)
115 if (share
->snum
== SNUM(conn
))
122 static struct share_mapping_entry
*add_srt(int snum
, const char **mappings
)
128 long unix_map
, windows_map
;
129 struct share_mapping_entry
*ret
= NULL
;
131 ret
= (struct share_mapping_entry
*)
132 TALLOC_ZERO(NULL
, sizeof(struct share_mapping_entry
) +
133 (mappings
? (MAP_NUM
* sizeof(struct char_mappings
*)) : 0));
141 ret
->mappings
= (struct char_mappings
**) ((unsigned char*) ret
+
142 sizeof(struct share_mapping_entry
));
143 memset(ret
->mappings
, 0,
144 MAP_NUM
* sizeof(struct char_mappings
*));
146 ret
->mappings
= NULL
;
151 * catia mappings are of the form :
152 * UNIX char (in 0xnn hex) : WINDOWS char (in 0xnn hex)
154 * multiple mappings are comma seperated in smb.conf
156 for (i
=0;mappings
[i
];i
++) {
157 fstrcpy(mapping
, mappings
[i
]);
158 unix_map
= strtol(mapping
, &tmp
, 16);
159 if (unix_map
== 0 && errno
== EINVAL
) {
160 DEBUG(0, ("INVALID CATIA MAPPINGS - %s\n", mapping
));
163 windows_map
= strtol(++tmp
, NULL
, 16);
164 if (windows_map
== 0 && errno
== EINVAL
) {
165 DEBUG(0, ("INVALID CATIA MAPPINGS - %s\n", mapping
));
169 if (!build_ranges(ret
->mappings
, unix_map
, windows_map
)) {
170 DEBUG(0, ("TABLE ERROR - CATIA MAPPINGS - %s\n", mapping
));
175 ret
->next
= srt_head
;
181 static bool init_mappings(connection_struct
*conn
,
182 struct share_mapping_entry
**selected_out
)
184 const char **mappings
= NULL
;
185 struct share_mapping_entry
*share_level
= NULL
;
186 struct share_mapping_entry
*global
= NULL
;
188 /* check srt cache */
189 share_level
= get_srt(conn
, &global
);
191 *selected_out
= share_level
;
192 return (share_level
->mappings
!= NULL
);
195 /* see if we have a global setting */
198 mappings
= lp_parm_string_list(-1, "catia", "mappings", NULL
);
199 global
= add_srt(GLOBAL_SNUM
, mappings
);
202 /* no global setting - what about share level ? */
203 mappings
= lp_parm_string_list(SNUM(conn
), "catia", "mappings", NULL
);
204 share_level
= add_srt(SNUM(conn
), mappings
);
206 if (share_level
->mappings
) {
207 (*selected_out
) = share_level
;
209 } else if (global
->mappings
) {
210 share_level
->mappings
= global
->mappings
;
211 (*selected_out
) = share_level
;
218 static NTSTATUS
catia_string_replace_allocate(connection_struct
*conn
,
223 static smb_ucs2_t
*tmpbuf
= NULL
;
225 struct share_mapping_entry
*selected
;
226 struct char_mappings
*map
= NULL
;
227 size_t converted_size
;
228 TALLOC_CTX
*ctx
= talloc_tos();
230 if (!init_mappings(conn
, &selected
))
233 if ((push_ucs2_talloc(ctx
, &tmpbuf
, name_in
,
234 &converted_size
)) == -1) {
235 return map_nt_error_from_unix(errno
);
241 map
= selected
->mappings
[T_PICK((*ptr
))];
247 *ptr
= map
->entry
[T_OFFSET((*ptr
))][direction
];
250 if ((pull_ucs2_talloc(ctx
, mapped_name
, tmpbuf
,
251 &converted_size
)) == -1) {
253 return map_nt_error_from_unix(errno
);
259 static SMB_STRUCT_DIR
*catia_opendir(vfs_handle_struct
*handle
,
264 char *name_mapped
= NULL
;
268 status
= catia_string_replace_allocate(handle
->conn
, fname
,
269 &name_mapped
, TO_UNIX
);
270 if (!NT_STATUS_IS_OK(status
)) {
271 errno
= map_errno_from_nt_status(status
);
275 ret
= SMB_VFS_NEXT_OPENDIR(handle
, name_mapped
, mask
, attr
);
276 TALLOC_FREE(name_mapped
);
282 * TRANSLATE_NAME call which converts the given name to
283 * "WINDOWS displayable" name
285 static NTSTATUS
catia_translate_name(vfs_handle_struct
*handle
,
292 * Copy the supplied name and free the memory for mapped_name,
293 * already allocated by the caller.
294 * We will be allocating new memory for mapped_name in
295 * catia_string_replace_allocate
297 name
= talloc_strdup(talloc_tos(), *mapped_name
);
300 return NT_STATUS_NO_MEMORY
;
302 TALLOC_FREE(*mapped_name
);
303 ret
= catia_string_replace_allocate(handle
->conn
, name
,
304 mapped_name
, TO_WINDOWS
);
307 if (!NT_STATUS_IS_OK(ret
)) {
311 ret
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, mapped_name
);
316 static int catia_open(vfs_handle_struct
*handle
,
317 struct smb_filename
*smb_fname
,
322 char *name_mapped
= NULL
;
327 tmp_base_name
= smb_fname
->base_name
;
328 status
= catia_string_replace_allocate(handle
->conn
,
329 smb_fname
->base_name
,
330 &name_mapped
, TO_UNIX
);
331 if (!NT_STATUS_IS_OK(status
)) {
332 errno
= map_errno_from_nt_status(status
);
336 smb_fname
->base_name
= name_mapped
;
337 ret
= SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
338 smb_fname
->base_name
= tmp_base_name
;
339 TALLOC_FREE(name_mapped
);
344 /* @internal - Isilon create file support */
345 static NTSTATUS
catia_createfile(vfs_handle_struct
*handle
,
346 struct smb_request
*req
,
347 uint16_t root_dir_fid
,
348 struct smb_filename
*smb_fname
,
349 uint32_t access_mask
,
350 uint32_t share_access
,
351 uint32_t create_disposition
,
352 uint32_t create_options
,
353 uint32_t file_attributes
,
354 uint32_t oplock_request
,
355 uint64_t allocation_size
,
356 struct security_descriptor
*sd
,
357 struct ea_list
*ea_list
,
358 files_struct
**result
,
361 char *name_mapped
= NULL
;
365 ret
= catia_string_replace_allocate(handle
->conn
, smb_fname
->base_name
,
366 &name_mapped
, TO_UNIX
);
367 if (!NT_STATUS_IS_OK(ret
)) {
368 errno
= map_errno_from_nt_status(ret
);
372 tmp_base_name
= smb_fname
->base_name
;
373 DEBUG(5, ("catia_createfile converted %s->%s (orginally %s)\n",
374 tmp_base_name
, name_mapped
, tmp_base_name
));
375 smb_fname
->base_name
= name_mapped
;
376 ret
= SMB_VFS_NEXT_CREATE_FILE(handle
, req
, root_dir_fid
,
377 smb_fname
, access_mask
, share_access
,
378 create_disposition
, create_options
,
379 file_attributes
, oplock_request
,
380 allocation_size
, sd
, ea_list
,
383 smb_fname
->base_name
= tmp_base_name
;
384 TALLOC_FREE(name_mapped
);
389 static int catia_rename(vfs_handle_struct
*handle
,
390 const struct smb_filename
*smb_fname_src
,
391 const struct smb_filename
*smb_fname_dst
)
393 TALLOC_CTX
*ctx
= talloc_tos();
394 struct smb_filename
*smb_fname_src_tmp
= NULL
;
395 struct smb_filename
*smb_fname_dst_tmp
= NULL
;
399 status
= catia_string_replace_allocate(handle
->conn
,
400 smb_fname_src
->base_name
,
401 &(smb_fname_src_tmp
->base_name
), TO_UNIX
);
402 if (!NT_STATUS_IS_OK(status
)) {
403 errno
= map_errno_from_nt_status(status
);
407 status
= catia_string_replace_allocate(handle
->conn
,
408 smb_fname_dst
->base_name
,
409 &(smb_fname_dst_tmp
->base_name
), TO_UNIX
);
410 if (!NT_STATUS_IS_OK(status
)) {
411 errno
= map_errno_from_nt_status(status
);
415 /* Setup temporary smb_filename structs. */
416 status
= copy_smb_filename(ctx
, smb_fname_src
, &smb_fname_src_tmp
);
418 if (!NT_STATUS_IS_OK(status
)) {
419 errno
= map_errno_from_nt_status(status
);
423 status
= copy_smb_filename(ctx
, smb_fname_dst
, &smb_fname_dst_tmp
);
424 if (!NT_STATUS_IS_OK(status
)) {
425 errno
= map_errno_from_nt_status(status
);
429 DEBUG(10, ("converted old name: %s\n",
430 smb_fname_str_dbg(smb_fname_src_tmp
)));
431 DEBUG(10, ("converted new name: %s\n",
432 smb_fname_str_dbg(smb_fname_dst_tmp
)));
434 ret
= SMB_VFS_NEXT_RENAME(handle
, smb_fname_src_tmp
,
437 TALLOC_FREE(smb_fname_src_tmp
);
438 TALLOC_FREE(smb_fname_dst_tmp
);
442 static int catia_stat(vfs_handle_struct
*handle
,
443 struct smb_filename
*smb_fname
)
450 status
= catia_string_replace_allocate(handle
->conn
,
451 smb_fname
->base_name
,
453 if (!NT_STATUS_IS_OK(status
)) {
454 errno
= map_errno_from_nt_status(status
);
458 tmp_base_name
= smb_fname
->base_name
;
459 smb_fname
->base_name
= name
;
461 ret
= SMB_VFS_NEXT_STAT(handle
, smb_fname
);
462 smb_fname
->base_name
= tmp_base_name
;
468 static int catia_lstat(vfs_handle_struct
*handle
,
469 struct smb_filename
*smb_fname
)
476 status
= catia_string_replace_allocate(handle
->conn
,
477 smb_fname
->base_name
,
479 if (!NT_STATUS_IS_OK(status
)) {
480 errno
= map_errno_from_nt_status(status
);
484 tmp_base_name
= smb_fname
->base_name
;
485 smb_fname
->base_name
= name
;
487 ret
= SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
488 smb_fname
->base_name
= tmp_base_name
;
494 static int catia_unlink(vfs_handle_struct
*handle
,
495 const struct smb_filename
*smb_fname
)
497 struct smb_filename
*smb_fname_tmp
= NULL
;
502 status
= catia_string_replace_allocate(handle
->conn
,
503 smb_fname
->base_name
,
505 if (!NT_STATUS_IS_OK(status
)) {
506 errno
= map_errno_from_nt_status(status
);
510 /* Setup temporary smb_filename structs. */
511 status
= copy_smb_filename(talloc_tos(), smb_fname
, &smb_fname_tmp
);
512 if (!NT_STATUS_IS_OK(status
)) {
513 errno
= map_errno_from_nt_status(status
);
517 smb_fname_tmp
->base_name
= name
;
518 ret
= SMB_VFS_NEXT_UNLINK(handle
, smb_fname_tmp
);
519 TALLOC_FREE(smb_fname_tmp
);
525 static int catia_chown(vfs_handle_struct
*handle
,
534 status
= catia_string_replace_allocate(handle
->conn
, path
,
536 if (!NT_STATUS_IS_OK(status
)) {
537 errno
= map_errno_from_nt_status(status
);
541 ret
= SMB_VFS_NEXT_CHOWN(handle
, name
, uid
, gid
);
547 static int catia_lchown(vfs_handle_struct
*handle
,
556 status
= catia_string_replace_allocate(handle
->conn
, path
,
558 if (!NT_STATUS_IS_OK(status
)) {
559 errno
= map_errno_from_nt_status(status
);
563 ret
= SMB_VFS_NEXT_LCHOWN(handle
, name
, uid
, gid
);
569 static int catia_rmdir(vfs_handle_struct
*handle
,
576 status
= catia_string_replace_allocate(handle
->conn
, path
,
578 if (!NT_STATUS_IS_OK(status
)) {
579 errno
= map_errno_from_nt_status(status
);
583 ret
= SMB_VFS_NEXT_RMDIR(handle
, name
);
589 static int catia_mkdir(vfs_handle_struct
*handle
,
597 status
= catia_string_replace_allocate(handle
->conn
, path
,
599 if (!NT_STATUS_IS_OK(status
)) {
600 errno
= map_errno_from_nt_status(status
);
604 ret
= SMB_VFS_NEXT_MKDIR(handle
, name
, mode
);
610 static int catia_chdir(vfs_handle_struct
*handle
,
617 status
= catia_string_replace_allocate(handle
->conn
, path
,
619 if (!NT_STATUS_IS_OK(status
)) {
620 errno
= map_errno_from_nt_status(status
);
624 ret
= SMB_VFS_NEXT_CHDIR(handle
, name
);
630 static int catia_ntimes(vfs_handle_struct
*handle
,
631 const struct smb_filename
*smb_fname
,
632 struct smb_file_time
*ft
)
634 struct smb_filename
*smb_fname_tmp
= NULL
;
639 status
= catia_string_replace_allocate(handle
->conn
,
640 smb_fname
->base_name
,
642 if (!NT_STATUS_IS_OK(status
)) {
643 errno
= map_errno_from_nt_status(status
);
647 status
= copy_smb_filename(talloc_tos(), smb_fname
, &smb_fname_tmp
);
648 if (!NT_STATUS_IS_OK(status
)) {
649 errno
= map_errno_from_nt_status(status
);
653 smb_fname_tmp
->base_name
= name
;
654 ret
= SMB_VFS_NEXT_NTIMES(handle
, smb_fname_tmp
, ft
);
655 TALLOC_FREE(smb_fname_tmp
);
661 catia_realpath(vfs_handle_struct
*handle
, const char *path
,
664 char *mapped_name
= NULL
;
668 status
= catia_string_replace_allocate(handle
->conn
, path
,
669 &mapped_name
, TO_UNIX
);
670 if (!NT_STATUS_IS_OK(status
)) {
671 errno
= map_errno_from_nt_status(status
);
675 ret
= SMB_VFS_NEXT_REALPATH(handle
, mapped_name
, resolved_path
);
676 TALLOC_FREE(mapped_name
);
681 static int catia_chflags(struct vfs_handle_struct
*handle
,
682 const char *path
, unsigned int flags
)
684 char *mapped_name
= NULL
;
688 status
= catia_string_replace_allocate(handle
->conn
, path
,
689 &mapped_name
, TO_UNIX
);
690 if (!NT_STATUS_IS_OK(status
)) {
691 errno
= map_errno_from_nt_status(status
);
695 ret
= SMB_VFS_NEXT_CHFLAGS(handle
, mapped_name
, flags
);
696 TALLOC_FREE(mapped_name
);
702 catia_streaminfo(struct vfs_handle_struct
*handle
,
703 struct files_struct
*fsp
,
706 unsigned int *num_streams
,
707 struct stream_struct
**streams
)
709 char *mapped_name
= NULL
;
712 status
= catia_string_replace_allocate(handle
->conn
, path
,
713 &mapped_name
, TO_UNIX
);
714 if (!NT_STATUS_IS_OK(status
)) {
715 errno
= map_errno_from_nt_status(status
);
719 status
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, mapped_name
,
720 mem_ctx
, num_streams
,streams
);
721 TALLOC_FREE(mapped_name
);
727 catia_get_nt_acl(struct vfs_handle_struct
*handle
,
729 uint32 security_info
,
730 struct security_descriptor
**ppdesc
)
732 char *mapped_name
= NULL
;
735 status
= catia_string_replace_allocate(handle
->conn
,
736 path
, &mapped_name
, TO_UNIX
);
737 if (!NT_STATUS_IS_OK(status
)) {
738 errno
= map_errno_from_nt_status(status
);
741 status
= SMB_VFS_NEXT_GET_NT_ACL(handle
, mapped_name
,
742 security_info
, ppdesc
);
743 TALLOC_FREE(mapped_name
);
749 catia_chmod_acl(vfs_handle_struct
*handle
,
753 char *mapped_name
= NULL
;
757 status
= catia_string_replace_allocate(handle
->conn
,
758 path
, &mapped_name
, TO_UNIX
);
759 if (!NT_STATUS_IS_OK(status
)) {
760 errno
= map_errno_from_nt_status(status
);
764 ret
= SMB_VFS_NEXT_CHMOD_ACL(handle
, mapped_name
, mode
);
765 TALLOC_FREE(mapped_name
);
770 catia_sys_acl_get_file(vfs_handle_struct
*handle
,
774 char *mapped_name
= NULL
;
778 status
= catia_string_replace_allocate(handle
->conn
,
779 path
, &mapped_name
, TO_UNIX
);
780 if (!NT_STATUS_IS_OK(status
)) {
781 errno
= map_errno_from_nt_status(status
);
785 ret
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, mapped_name
, type
);
786 TALLOC_FREE(mapped_name
);
792 catia_sys_acl_set_file(vfs_handle_struct
*handle
,
797 char *mapped_name
= NULL
;
801 status
= catia_string_replace_allocate(handle
->conn
,
802 path
, &mapped_name
, TO_UNIX
);
803 if (!NT_STATUS_IS_OK(status
)) {
804 errno
= map_errno_from_nt_status(status
);
808 ret
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, mapped_name
, type
, theacl
);
809 TALLOC_FREE(mapped_name
);
815 catia_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
818 char *mapped_name
= NULL
;
822 status
= catia_string_replace_allocate(handle
->conn
,
823 path
, &mapped_name
, TO_UNIX
);
824 if (!NT_STATUS_IS_OK(status
)) {
825 errno
= map_errno_from_nt_status(status
);
829 ret
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, mapped_name
);
830 TALLOC_FREE(mapped_name
);
836 catia_getxattr(vfs_handle_struct
*handle
, const char *path
,
837 const char *name
, void *value
, size_t size
)
839 char *mapped_name
= NULL
;
843 status
= catia_string_replace_allocate(handle
->conn
,
844 name
, &mapped_name
, TO_UNIX
);
845 if (!NT_STATUS_IS_OK(status
)) {
846 errno
= map_errno_from_nt_status(status
);
851 ret
= SMB_VFS_NEXT_GETXATTR(handle
, path
, mapped_name
, value
, size
);
852 TALLOC_FREE(mapped_name
);
858 catia_lgetxattr(vfs_handle_struct
*handle
, const char *path
,
859 const char *name
, void *value
, size_t size
)
861 char *mapped_name
= NULL
;
865 status
= catia_string_replace_allocate(handle
->conn
,
866 name
, &mapped_name
, TO_UNIX
);
867 if (!NT_STATUS_IS_OK(status
)) {
868 errno
= map_errno_from_nt_status(status
);
873 ret
= SMB_VFS_NEXT_LGETXATTR(handle
, path
, mapped_name
, value
, size
);
874 TALLOC_FREE(mapped_name
);
880 catia_listxattr(vfs_handle_struct
*handle
, const char *path
,
881 char *list
, size_t size
)
883 char *mapped_name
= NULL
;
887 status
= catia_string_replace_allocate(handle
->conn
,
888 path
, &mapped_name
, TO_UNIX
);
889 if (!NT_STATUS_IS_OK(status
)) {
890 errno
= map_errno_from_nt_status(status
);
895 ret
= SMB_VFS_NEXT_LISTXATTR(handle
, mapped_name
, list
, size
);
896 TALLOC_FREE(mapped_name
);
902 catia_llistxattr(vfs_handle_struct
*handle
, const char *path
,
903 char *list
, size_t size
)
905 char *mapped_name
= NULL
;
909 status
= catia_string_replace_allocate(handle
->conn
,
910 path
, &mapped_name
, TO_UNIX
);
911 if (!NT_STATUS_IS_OK(status
)) {
912 errno
= map_errno_from_nt_status(status
);
917 ret
= SMB_VFS_NEXT_LLISTXATTR(handle
, mapped_name
, list
, size
);
918 TALLOC_FREE(mapped_name
);
924 catia_removexattr(vfs_handle_struct
*handle
, const char *path
,
927 char *mapped_name
= NULL
;
931 status
= catia_string_replace_allocate(handle
->conn
,
932 name
, &mapped_name
, TO_UNIX
);
933 if (!NT_STATUS_IS_OK(status
)) {
934 errno
= map_errno_from_nt_status(status
);
939 ret
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, mapped_name
);
940 TALLOC_FREE(mapped_name
);
946 catia_lremovexattr(vfs_handle_struct
*handle
, const char *path
,
949 char *mapped_name
= NULL
;
953 status
= catia_string_replace_allocate(handle
->conn
,
954 name
, &mapped_name
, TO_UNIX
);
955 if (!NT_STATUS_IS_OK(status
)) {
956 errno
= map_errno_from_nt_status(status
);
961 ret
= SMB_VFS_NEXT_LREMOVEXATTR(handle
, path
, mapped_name
);
962 TALLOC_FREE(mapped_name
);
968 catia_setxattr(vfs_handle_struct
*handle
, const char *path
,
969 const char *name
, const void *value
, size_t size
,
972 char *mapped_name
= NULL
;
976 status
= catia_string_replace_allocate(handle
->conn
,
977 name
, &mapped_name
, TO_UNIX
);
978 if (!NT_STATUS_IS_OK(status
)) {
979 errno
= map_errno_from_nt_status(status
);
984 ret
= SMB_VFS_NEXT_SETXATTR(handle
, path
, mapped_name
, value
, size
, flags
);
985 TALLOC_FREE(mapped_name
);
991 catia_lsetxattr(vfs_handle_struct
*handle
, const char *path
,
992 const char *name
, const void *value
, size_t size
,
995 char *mapped_name
= NULL
;
999 status
= catia_string_replace_allocate(handle
->conn
,
1000 name
, &mapped_name
, TO_UNIX
);
1001 if (!NT_STATUS_IS_OK(status
)) {
1002 errno
= map_errno_from_nt_status(status
);
1007 ret
= SMB_VFS_NEXT_LSETXATTR(handle
, path
, mapped_name
, value
, size
, flags
);
1008 TALLOC_FREE(mapped_name
);
1013 static struct vfs_fn_pointers vfs_catia_fns
= {
1014 .mkdir
= catia_mkdir
,
1015 .rmdir
= catia_rmdir
,
1016 .opendir
= catia_opendir
,
1018 .create_file
= catia_createfile
,
1019 .rename
= catia_rename
,
1021 .lstat
= catia_lstat
,
1022 .unlink
= catia_unlink
,
1023 .chown
= catia_chown
,
1024 .lchown
= catia_lchown
,
1025 .chdir
= catia_chdir
,
1026 .ntimes
= catia_ntimes
,
1027 .realpath
= catia_realpath
,
1028 .chflags
= catia_chflags
,
1029 .streaminfo
= catia_streaminfo
,
1030 .translate_name
= catia_translate_name
,
1031 .get_nt_acl
= catia_get_nt_acl
,
1032 .chmod_acl
= catia_chmod_acl
,
1033 .sys_acl_get_file
= catia_sys_acl_get_file
,
1034 .sys_acl_set_file
= catia_sys_acl_set_file
,
1035 .sys_acl_delete_def_file
= catia_sys_acl_delete_def_file
,
1036 .getxattr
= catia_getxattr
,
1037 .lgetxattr
= catia_lgetxattr
,
1038 .listxattr
= catia_listxattr
,
1039 .llistxattr
= catia_llistxattr
,
1040 .removexattr
= catia_removexattr
,
1041 .lremovexattr
= catia_lremovexattr
,
1042 .setxattr
= catia_setxattr
,
1043 .lsetxattr
= catia_lsetxattr
,
1046 NTSTATUS
vfs_catia_init(void)
1048 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "catia",