2 * Store streams in xattrs
4 * Copyright (C) Volker Lendecke, 2008
6 * Partly based on James Peach's Darwin module, which is
8 * Copyright (C) James Peach 2006-2007
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 #include "smbd/smbd.h"
26 #include "system/filesys.h"
27 #include "../lib/crypto/md5.h"
28 #include "lib/util/tevent_unix.h"
29 #include "librpc/gen_ndr/ioctl.h"
32 #define DBGC_CLASS DBGC_VFS
34 struct streams_xattr_config
{
37 bool store_stream_type
;
45 vfs_handle_struct
*handle
;
48 static SMB_INO_T
stream_inode(const SMB_STRUCT_STAT
*sbuf
, const char *sname
)
51 unsigned char hash
[16];
55 DEBUG(10, ("stream_inode called for %lu/%lu [%s]\n",
56 (unsigned long)sbuf
->st_ex_dev
,
57 (unsigned long)sbuf
->st_ex_ino
, sname
));
59 upper_sname
= talloc_strdup_upper(talloc_tos(), sname
);
60 SMB_ASSERT(upper_sname
!= NULL
);
63 MD5Update(&ctx
, (const unsigned char *)&(sbuf
->st_ex_dev
),
64 sizeof(sbuf
->st_ex_dev
));
65 MD5Update(&ctx
, (const unsigned char *)&(sbuf
->st_ex_ino
),
66 sizeof(sbuf
->st_ex_ino
));
67 MD5Update(&ctx
, (unsigned char *)upper_sname
,
68 talloc_get_size(upper_sname
)-1);
71 TALLOC_FREE(upper_sname
);
73 /* Hopefully all the variation is in the lower 4 (or 8) bytes! */
74 memcpy(&result
, hash
, sizeof(result
));
76 DEBUG(10, ("stream_inode returns %lu\n", (unsigned long)result
));
81 static ssize_t
get_xattr_size(connection_struct
*conn
,
82 const struct smb_filename
*smb_fname
,
83 const char *xattr_name
)
89 status
= get_ea_value(talloc_tos(), conn
, NULL
, smb_fname
,
92 if (!NT_STATUS_IS_OK(status
)) {
96 result
= ea
.value
.length
-1;
97 TALLOC_FREE(ea
.value
.data
);
102 * Given a stream name, populate xattr_name with the xattr name to use for
103 * accessing the stream.
105 static NTSTATUS
streams_xattr_get_name(vfs_handle_struct
*handle
,
107 const char *stream_name
,
112 struct streams_xattr_config
*config
;
114 SMB_VFS_HANDLE_GET_DATA(handle
, config
, struct streams_xattr_config
,
115 return NT_STATUS_UNSUCCESSFUL
);
117 sname
= talloc_strdup(ctx
, stream_name
+ 1);
119 return NT_STATUS_NO_MEMORY
;
123 * With vfs_fruit option "fruit:encoding = native" we're
124 * already converting stream names that contain illegal NTFS
125 * characters from their on-the-wire Unicode Private Range
126 * encoding to their native ASCII representation.
128 * As as result the name of xattrs storing the streams (via
129 * vfs_streams_xattr) may contain a colon, so we have to use
130 * strrchr_m() instead of strchr_m() for matching the stream
133 * In check_path_syntax() we've already ensured the streamname
134 * we got from the client is valid.
136 stype
= strrchr_m(sname
, ':');
140 * We only support one stream type: "$DATA"
142 if (strcasecmp_m(stype
, ":$DATA") != 0) {
144 return NT_STATUS_INVALID_PARAMETER
;
147 /* Split name and type */
151 *xattr_name
= talloc_asprintf(ctx
, "%s%s%s",
154 config
->store_stream_type
? ":$DATA" : "");
155 if (*xattr_name
== NULL
) {
157 return NT_STATUS_NO_MEMORY
;
160 DEBUG(10, ("xattr_name: %s, stream_name: %s\n", *xattr_name
,
167 static bool streams_xattr_recheck(struct stream_io
*sio
)
170 char *xattr_name
= NULL
;
172 if (sio
->fsp
->fsp_name
== sio
->fsp_name_ptr
) {
176 if (sio
->fsp
->fsp_name
->stream_name
== NULL
) {
177 /* how can this happen */
182 status
= streams_xattr_get_name(sio
->handle
, talloc_tos(),
183 sio
->fsp
->fsp_name
->stream_name
,
185 if (!NT_STATUS_IS_OK(status
)) {
189 TALLOC_FREE(sio
->xattr_name
);
190 TALLOC_FREE(sio
->base
);
191 sio
->xattr_name
= talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio
->handle
, sio
->fsp
),
193 if (sio
->xattr_name
== NULL
) {
194 DBG_DEBUG("sio->xattr_name==NULL\n");
197 TALLOC_FREE(xattr_name
);
199 sio
->base
= talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio
->handle
, sio
->fsp
),
200 sio
->fsp
->fsp_name
->base_name
);
201 if (sio
->base
== NULL
) {
202 DBG_DEBUG("sio->base==NULL\n");
206 sio
->fsp_name_ptr
= sio
->fsp
->fsp_name
;
212 * Helper to stat/lstat the base file of an smb_fname.
214 static int streams_xattr_stat_base(vfs_handle_struct
*handle
,
215 struct smb_filename
*smb_fname
,
218 char *tmp_stream_name
;
221 tmp_stream_name
= smb_fname
->stream_name
;
222 smb_fname
->stream_name
= NULL
;
224 result
= SMB_VFS_NEXT_STAT(handle
, smb_fname
);
226 result
= SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
228 smb_fname
->stream_name
= tmp_stream_name
;
232 static int streams_xattr_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
233 SMB_STRUCT_STAT
*sbuf
)
235 struct smb_filename
*smb_fname_base
= NULL
;
237 struct stream_io
*io
= (struct stream_io
*)
238 VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
240 if (io
== NULL
|| fsp
->base_fsp
== NULL
) {
241 return SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
244 DBG_DEBUG("streams_xattr_fstat called for %s\n", fsp_str_dbg(io
->fsp
));
246 if (!streams_xattr_recheck(io
)) {
250 /* Create an smb_filename with stream_name == NULL. */
251 smb_fname_base
= synthetic_smb_fname(talloc_tos(),
255 fsp
->fsp_name
->flags
);
256 if (smb_fname_base
== NULL
) {
261 if (smb_fname_base
->flags
& SMB_FILENAME_POSIX_PATH
) {
262 ret
= SMB_VFS_LSTAT(handle
->conn
, smb_fname_base
);
264 ret
= SMB_VFS_STAT(handle
->conn
, smb_fname_base
);
266 *sbuf
= smb_fname_base
->st
;
269 TALLOC_FREE(smb_fname_base
);
273 sbuf
->st_ex_size
= get_xattr_size(handle
->conn
,
274 smb_fname_base
, io
->xattr_name
);
275 if (sbuf
->st_ex_size
== -1) {
276 TALLOC_FREE(smb_fname_base
);
277 SET_STAT_INVALID(*sbuf
);
281 DEBUG(10, ("sbuf->st_ex_size = %d\n", (int)sbuf
->st_ex_size
));
283 sbuf
->st_ex_ino
= stream_inode(sbuf
, io
->xattr_name
);
284 sbuf
->st_ex_mode
&= ~S_IFMT
;
285 sbuf
->st_ex_mode
&= ~S_IFDIR
;
286 sbuf
->st_ex_mode
|= S_IFREG
;
287 sbuf
->st_ex_blocks
= sbuf
->st_ex_size
/ STAT_ST_BLOCKSIZE
+ 1;
289 TALLOC_FREE(smb_fname_base
);
293 static int streams_xattr_stat(vfs_handle_struct
*handle
,
294 struct smb_filename
*smb_fname
)
298 char *xattr_name
= NULL
;
300 if (!is_ntfs_stream_smb_fname(smb_fname
)) {
301 return SMB_VFS_NEXT_STAT(handle
, smb_fname
);
304 /* Note if lp_posix_paths() is true, we can never
305 * get here as is_ntfs_stream_smb_fname() is
306 * always false. So we never need worry about
307 * not following links here. */
309 /* If the default stream is requested, just stat the base file. */
310 if (is_ntfs_default_stream_smb_fname(smb_fname
)) {
311 return streams_xattr_stat_base(handle
, smb_fname
, true);
314 /* Populate the stat struct with info from the base file. */
315 if (streams_xattr_stat_base(handle
, smb_fname
, true) == -1) {
319 /* Derive the xattr name to lookup. */
320 status
= streams_xattr_get_name(handle
, talloc_tos(),
321 smb_fname
->stream_name
, &xattr_name
);
322 if (!NT_STATUS_IS_OK(status
)) {
323 errno
= map_errno_from_nt_status(status
);
327 /* Augment the base file's stat information before returning. */
328 smb_fname
->st
.st_ex_size
= get_xattr_size(handle
->conn
,
331 if (smb_fname
->st
.st_ex_size
== -1) {
332 SET_STAT_INVALID(smb_fname
->st
);
338 smb_fname
->st
.st_ex_ino
= stream_inode(&smb_fname
->st
, xattr_name
);
339 smb_fname
->st
.st_ex_mode
&= ~S_IFMT
;
340 smb_fname
->st
.st_ex_mode
&= ~S_IFDIR
;
341 smb_fname
->st
.st_ex_mode
|= S_IFREG
;
342 smb_fname
->st
.st_ex_blocks
=
343 smb_fname
->st
.st_ex_size
/ STAT_ST_BLOCKSIZE
+ 1;
347 TALLOC_FREE(xattr_name
);
351 static int streams_xattr_lstat(vfs_handle_struct
*handle
,
352 struct smb_filename
*smb_fname
)
356 char *xattr_name
= NULL
;
358 if (!is_ntfs_stream_smb_fname(smb_fname
)) {
359 return SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
362 /* If the default stream is requested, just stat the base file. */
363 if (is_ntfs_default_stream_smb_fname(smb_fname
)) {
364 return streams_xattr_stat_base(handle
, smb_fname
, false);
367 /* Populate the stat struct with info from the base file. */
368 if (streams_xattr_stat_base(handle
, smb_fname
, false) == -1) {
372 /* Derive the xattr name to lookup. */
373 status
= streams_xattr_get_name(handle
, talloc_tos(),
374 smb_fname
->stream_name
, &xattr_name
);
375 if (!NT_STATUS_IS_OK(status
)) {
376 errno
= map_errno_from_nt_status(status
);
380 /* Augment the base file's stat information before returning. */
381 smb_fname
->st
.st_ex_size
= get_xattr_size(handle
->conn
,
384 if (smb_fname
->st
.st_ex_size
== -1) {
385 SET_STAT_INVALID(smb_fname
->st
);
391 smb_fname
->st
.st_ex_ino
= stream_inode(&smb_fname
->st
, xattr_name
);
392 smb_fname
->st
.st_ex_mode
&= ~S_IFMT
;
393 smb_fname
->st
.st_ex_mode
|= S_IFREG
;
394 smb_fname
->st
.st_ex_blocks
=
395 smb_fname
->st
.st_ex_size
/ STAT_ST_BLOCKSIZE
+ 1;
400 TALLOC_FREE(xattr_name
);
404 static int streams_xattr_open(vfs_handle_struct
*handle
,
405 struct smb_filename
*smb_fname
,
406 files_struct
*fsp
, int flags
, mode_t mode
)
409 struct streams_xattr_config
*config
= NULL
;
410 struct stream_io
*sio
= NULL
;
412 char *xattr_name
= NULL
;
415 bool set_empty_xattr
= false;
418 SMB_VFS_HANDLE_GET_DATA(handle
, config
, struct streams_xattr_config
,
421 DEBUG(10, ("streams_xattr_open called for %s with flags 0x%x\n",
422 smb_fname_str_dbg(smb_fname
), flags
));
424 if (!is_ntfs_stream_smb_fname(smb_fname
)) {
425 return SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
428 /* If the default stream is requested, just open the base file. */
429 if (is_ntfs_default_stream_smb_fname(smb_fname
)) {
430 char *tmp_stream_name
;
432 tmp_stream_name
= smb_fname
->stream_name
;
433 smb_fname
->stream_name
= NULL
;
435 ret
= SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
437 smb_fname
->stream_name
= tmp_stream_name
;
442 status
= streams_xattr_get_name(handle
, talloc_tos(),
443 smb_fname
->stream_name
, &xattr_name
);
444 if (!NT_STATUS_IS_OK(status
)) {
445 errno
= map_errno_from_nt_status(status
);
449 status
= get_ea_value(talloc_tos(), handle
->conn
, NULL
,
450 smb_fname
, xattr_name
, &ea
);
452 DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status
)));
454 if (!NT_STATUS_IS_OK(status
)) {
455 if (!NT_STATUS_EQUAL(status
, NT_STATUS_NOT_FOUND
)) {
457 * The base file is not there. This is an error even if
458 * we got O_CREAT, the higher levels should have created
459 * the base file for us.
461 DBG_DEBUG("streams_xattr_open: base file %s not around, "
462 "returning ENOENT\n", smb_fname
->base_name
);
467 if (!(flags
& O_CREAT
)) {
472 set_empty_xattr
= true;
475 if (flags
& O_TRUNC
) {
476 set_empty_xattr
= true;
479 if (set_empty_xattr
) {
481 * The attribute does not exist or needs to be truncated
485 * Darn, xattrs need at least 1 byte
489 DEBUG(10, ("creating or truncating attribute %s on file %s\n",
490 xattr_name
, smb_fname
->base_name
));
492 ret
= SMB_VFS_SETXATTR(fsp
->conn
,
496 flags
& O_EXCL
? XATTR_CREATE
: 0);
503 * Return a valid fd, but ensure any attempt to use it returns an error
506 ret
= pipe(pipe_fds
);
513 fakefd
= pipe_fds
[0];
515 sio
= VFS_ADD_FSP_EXTENSION(handle
, fsp
, struct stream_io
, NULL
);
521 sio
->xattr_name
= talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle
, fsp
),
523 if (sio
->xattr_name
== NULL
) {
529 * so->base needs to be a copy of fsp->fsp_name->base_name,
530 * making it identical to streams_xattr_recheck(). If the
531 * open is changing directories, fsp->fsp_name->base_name
532 * will be the full path from the share root, whilst
533 * smb_fname will be relative to the $cwd.
535 sio
->base
= talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle
, fsp
),
536 fsp
->fsp_name
->base_name
);
537 if (sio
->base
== NULL
) {
542 sio
->fsp_name_ptr
= fsp
->fsp_name
;
543 sio
->handle
= handle
;
557 static int streams_xattr_close(vfs_handle_struct
*handle
,
565 DBG_DEBUG("streams_xattr_close called [%s] fd [%d]\n",
566 smb_fname_str_dbg(fsp
->fsp_name
), fd
);
568 if (!is_ntfs_stream_smb_fname(fsp
->fsp_name
)) {
569 return SMB_VFS_NEXT_CLOSE(handle
, fsp
);
572 if (is_ntfs_default_stream_smb_fname(fsp
->fsp_name
)) {
573 return SMB_VFS_NEXT_CLOSE(handle
, fsp
);
582 static int streams_xattr_unlink(vfs_handle_struct
*handle
,
583 const struct smb_filename
*smb_fname
)
587 char *xattr_name
= NULL
;
589 if (!is_ntfs_stream_smb_fname(smb_fname
)) {
590 return SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
593 /* If the default stream is requested, just open the base file. */
594 if (is_ntfs_default_stream_smb_fname(smb_fname
)) {
595 struct smb_filename
*smb_fname_base
= NULL
;
597 smb_fname_base
= cp_smb_filename(talloc_tos(), smb_fname
);
598 if (smb_fname_base
== NULL
) {
603 ret
= SMB_VFS_NEXT_UNLINK(handle
, smb_fname_base
);
605 TALLOC_FREE(smb_fname_base
);
609 status
= streams_xattr_get_name(handle
, talloc_tos(),
610 smb_fname
->stream_name
, &xattr_name
);
611 if (!NT_STATUS_IS_OK(status
)) {
612 errno
= map_errno_from_nt_status(status
);
616 ret
= SMB_VFS_REMOVEXATTR(handle
->conn
, smb_fname
, xattr_name
);
618 if ((ret
== -1) && (errno
== ENOATTR
)) {
626 TALLOC_FREE(xattr_name
);
630 static int streams_xattr_rename(vfs_handle_struct
*handle
,
631 const struct smb_filename
*smb_fname_src
,
632 const struct smb_filename
*smb_fname_dst
)
636 char *src_xattr_name
= NULL
;
637 char *dst_xattr_name
= NULL
;
638 bool src_is_stream
, dst_is_stream
;
643 src_is_stream
= is_ntfs_stream_smb_fname(smb_fname_src
);
644 dst_is_stream
= is_ntfs_stream_smb_fname(smb_fname_dst
);
646 if (!src_is_stream
&& !dst_is_stream
) {
647 return SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
,
651 /* For now don't allow renames from or to the default stream. */
652 if (is_ntfs_default_stream_smb_fname(smb_fname_src
) ||
653 is_ntfs_default_stream_smb_fname(smb_fname_dst
)) {
658 /* Don't rename if the streams are identical. */
659 if (strcasecmp_m(smb_fname_src
->stream_name
,
660 smb_fname_dst
->stream_name
) == 0) {
664 /* Get the xattr names. */
665 status
= streams_xattr_get_name(handle
, talloc_tos(),
666 smb_fname_src
->stream_name
,
668 if (!NT_STATUS_IS_OK(status
)) {
669 errno
= map_errno_from_nt_status(status
);
672 status
= streams_xattr_get_name(handle
, talloc_tos(),
673 smb_fname_dst
->stream_name
,
675 if (!NT_STATUS_IS_OK(status
)) {
676 errno
= map_errno_from_nt_status(status
);
680 /* read the old stream */
681 status
= get_ea_value(talloc_tos(), handle
->conn
, NULL
,
682 smb_fname_src
, src_xattr_name
, &ea
);
683 if (!NT_STATUS_IS_OK(status
)) {
688 /* (over)write the new stream */
689 nret
= SMB_VFS_SETXATTR(handle
->conn
, smb_fname_src
,
690 dst_xattr_name
, ea
.value
.data
, ea
.value
.length
,
693 if (errno
== ENOATTR
) {
699 /* remove the old stream */
700 oret
= SMB_VFS_REMOVEXATTR(handle
->conn
, smb_fname_src
,
703 if (errno
== ENOATTR
) {
713 TALLOC_FREE(src_xattr_name
);
714 TALLOC_FREE(dst_xattr_name
);
718 static NTSTATUS
walk_xattr_streams(vfs_handle_struct
*handle
,
720 const struct smb_filename
*smb_fname
,
721 bool (*fn
)(struct ea_struct
*ea
,
728 struct streams_xattr_config
*config
;
730 SMB_VFS_HANDLE_GET_DATA(handle
, config
, struct streams_xattr_config
,
731 return NT_STATUS_UNSUCCESSFUL
);
733 status
= get_ea_names_from_file(talloc_tos(),
739 if (!NT_STATUS_IS_OK(status
)) {
743 for (i
=0; i
<num_names
; i
++) {
747 * We want to check with samba_private_attr_name()
748 * whether the xattr name is a private one,
749 * unfortunately it flags xattrs that begin with the
750 * default streams prefix as private.
752 * By only calling samba_private_attr_name() in case
753 * the xattr does NOT begin with the default prefix,
754 * we know that if it returns 'true' it definitely one
755 * of our internal xattr like "user.DOSATTRIB".
757 if (strncasecmp_m(names
[i
], SAMBA_XATTR_DOSSTREAM_PREFIX
,
758 strlen(SAMBA_XATTR_DOSSTREAM_PREFIX
)) != 0) {
759 if (samba_private_attr_name(names
[i
])) {
764 if (strncmp(names
[i
], config
->prefix
,
765 config
->prefix_len
) != 0) {
769 status
= get_ea_value(names
,
775 if (!NT_STATUS_IS_OK(status
)) {
776 DEBUG(10, ("Could not get ea %s for file %s: %s\n",
778 smb_fname
->base_name
,
783 ea
.name
= talloc_asprintf(
784 ea
.value
.data
, ":%s%s",
785 names
[i
] + config
->prefix_len
,
786 config
->store_stream_type
? "" : ":$DATA");
787 if (ea
.name
== NULL
) {
788 DEBUG(0, ("talloc failed\n"));
792 if (!fn(&ea
, private_data
)) {
793 TALLOC_FREE(ea
.value
.data
);
797 TALLOC_FREE(ea
.value
.data
);
804 static bool add_one_stream(TALLOC_CTX
*mem_ctx
, unsigned int *num_streams
,
805 struct stream_struct
**streams
,
806 const char *name
, off_t size
,
809 struct stream_struct
*tmp
;
811 tmp
= talloc_realloc(mem_ctx
, *streams
, struct stream_struct
,
817 tmp
[*num_streams
].name
= talloc_strdup(tmp
, name
);
818 if (tmp
[*num_streams
].name
== NULL
) {
822 tmp
[*num_streams
].size
= size
;
823 tmp
[*num_streams
].alloc_size
= alloc_size
;
830 struct streaminfo_state
{
832 vfs_handle_struct
*handle
;
833 unsigned int num_streams
;
834 struct stream_struct
*streams
;
838 static bool collect_one_stream(struct ea_struct
*ea
, void *private_data
)
840 struct streaminfo_state
*state
=
841 (struct streaminfo_state
*)private_data
;
843 if (!add_one_stream(state
->mem_ctx
,
844 &state
->num_streams
, &state
->streams
,
845 ea
->name
, ea
->value
.length
-1,
846 smb_roundup(state
->handle
->conn
,
847 ea
->value
.length
-1))) {
848 state
->status
= NT_STATUS_NO_MEMORY
;
855 static NTSTATUS
streams_xattr_streaminfo(vfs_handle_struct
*handle
,
856 struct files_struct
*fsp
,
857 const struct smb_filename
*smb_fname
,
859 unsigned int *pnum_streams
,
860 struct stream_struct
**pstreams
)
862 SMB_STRUCT_STAT sbuf
;
865 struct streaminfo_state state
;
867 ret
= vfs_stat_smb_basename(handle
->conn
, smb_fname
, &sbuf
);
869 return map_nt_error_from_unix(errno
);
872 state
.streams
= *pstreams
;
873 state
.num_streams
= *pnum_streams
;
874 state
.mem_ctx
= mem_ctx
;
875 state
.handle
= handle
;
876 state
.status
= NT_STATUS_OK
;
878 if (S_ISLNK(sbuf
.st_ex_mode
)) {
880 * Currently we do't have SMB_VFS_LLISTXATTR
881 * inside the VFS which means there's no way
882 * to cope with a symlink when lp_posix_pathnames().
883 * returns true. For now ignore links.
884 * FIXME - by adding SMB_VFS_LLISTXATTR. JRA.
886 status
= NT_STATUS_OK
;
888 status
= walk_xattr_streams(handle
, fsp
, smb_fname
,
889 collect_one_stream
, &state
);
892 if (!NT_STATUS_IS_OK(status
)) {
893 TALLOC_FREE(state
.streams
);
897 if (!NT_STATUS_IS_OK(state
.status
)) {
898 TALLOC_FREE(state
.streams
);
902 *pnum_streams
= state
.num_streams
;
903 *pstreams
= state
.streams
;
905 return SMB_VFS_NEXT_STREAMINFO(handle
,
913 static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct
*handle
,
914 enum timestamp_set_resolution
*p_ts_res
)
916 return SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
) | FILE_NAMED_STREAMS
;
919 static int streams_xattr_connect(vfs_handle_struct
*handle
,
920 const char *service
, const char *user
)
922 struct streams_xattr_config
*config
;
923 const char *default_prefix
= SAMBA_XATTR_DOSSTREAM_PREFIX
;
927 rc
= SMB_VFS_NEXT_CONNECT(handle
, service
, user
);
932 config
= talloc_zero(handle
->conn
, struct streams_xattr_config
);
933 if (config
== NULL
) {
934 DEBUG(1, ("talloc_zero() failed\n"));
939 prefix
= lp_parm_const_string(SNUM(handle
->conn
),
940 "streams_xattr", "prefix",
942 config
->prefix
= talloc_strdup(config
, prefix
);
943 if (config
->prefix
== NULL
) {
944 DEBUG(1, ("talloc_strdup() failed\n"));
948 config
->prefix_len
= strlen(config
->prefix
);
949 DEBUG(10, ("streams_xattr using stream prefix: %s\n", config
->prefix
));
951 config
->store_stream_type
= lp_parm_bool(SNUM(handle
->conn
),
956 SMB_VFS_HANDLE_SET_DATA(handle
, config
,
957 NULL
, struct stream_xattr_config
,
963 static ssize_t
streams_xattr_pwrite(vfs_handle_struct
*handle
,
964 files_struct
*fsp
, const void *data
,
965 size_t n
, off_t offset
)
967 struct stream_io
*sio
=
968 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
971 struct smb_filename
*smb_fname_base
= NULL
;
974 DEBUG(10, ("streams_xattr_pwrite called for %d bytes\n", (int)n
));
977 return SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
980 if (!streams_xattr_recheck(sio
)) {
984 /* Create an smb_filename with stream_name == NULL. */
985 smb_fname_base
= synthetic_smb_fname(talloc_tos(),
989 fsp
->fsp_name
->flags
);
990 if (smb_fname_base
== NULL
) {
995 status
= get_ea_value(talloc_tos(), handle
->conn
, NULL
,
996 smb_fname_base
, sio
->xattr_name
, &ea
);
997 if (!NT_STATUS_IS_OK(status
)) {
1001 if ((offset
+ n
) > ea
.value
.length
-1) {
1004 tmp
= talloc_realloc(talloc_tos(), ea
.value
.data
, uint8_t,
1008 TALLOC_FREE(ea
.value
.data
);
1012 ea
.value
.data
= tmp
;
1013 ea
.value
.length
= offset
+ n
+ 1;
1014 ea
.value
.data
[offset
+n
] = 0;
1017 memcpy(ea
.value
.data
+ offset
, data
, n
);
1019 ret
= SMB_VFS_SETXATTR(fsp
->conn
,
1022 ea
.value
.data
, ea
.value
.length
, 0);
1023 TALLOC_FREE(ea
.value
.data
);
1032 static ssize_t
streams_xattr_pread(vfs_handle_struct
*handle
,
1033 files_struct
*fsp
, void *data
,
1034 size_t n
, off_t offset
)
1036 struct stream_io
*sio
=
1037 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1038 struct ea_struct ea
;
1040 size_t length
, overlap
;
1041 struct smb_filename
*smb_fname_base
= NULL
;
1043 DEBUG(10, ("streams_xattr_pread: offset=%d, size=%d\n",
1044 (int)offset
, (int)n
));
1047 return SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
1050 if (!streams_xattr_recheck(sio
)) {
1054 /* Create an smb_filename with stream_name == NULL. */
1055 smb_fname_base
= synthetic_smb_fname(talloc_tos(),
1059 fsp
->fsp_name
->flags
);
1060 if (smb_fname_base
== NULL
) {
1065 status
= get_ea_value(talloc_tos(), handle
->conn
, NULL
,
1066 smb_fname_base
, sio
->xattr_name
, &ea
);
1067 if (!NT_STATUS_IS_OK(status
)) {
1071 length
= ea
.value
.length
-1;
1073 DEBUG(10, ("streams_xattr_pread: get_ea_value returned %d bytes\n",
1076 /* Attempt to read past EOF. */
1077 if (length
<= offset
) {
1081 overlap
= (offset
+ n
) > length
? (length
- offset
) : n
;
1082 memcpy(data
, ea
.value
.data
+ offset
, overlap
);
1084 TALLOC_FREE(ea
.value
.data
);
1088 struct streams_xattr_pread_state
{
1090 struct vfs_aio_state vfs_aio_state
;
1093 static void streams_xattr_pread_done(struct tevent_req
*subreq
);
1095 static struct tevent_req
*streams_xattr_pread_send(
1096 struct vfs_handle_struct
*handle
,
1097 TALLOC_CTX
*mem_ctx
,
1098 struct tevent_context
*ev
,
1099 struct files_struct
*fsp
,
1101 size_t n
, off_t offset
)
1103 struct tevent_req
*req
= NULL
;
1104 struct tevent_req
*subreq
= NULL
;
1105 struct streams_xattr_pread_state
*state
= NULL
;
1106 struct stream_io
*sio
=
1107 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1109 req
= tevent_req_create(mem_ctx
, &state
,
1110 struct streams_xattr_pread_state
);
1116 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
,
1118 if (tevent_req_nomem(req
, subreq
)) {
1119 return tevent_req_post(req
, ev
);
1121 tevent_req_set_callback(subreq
, streams_xattr_pread_done
, req
);
1125 state
->nread
= SMB_VFS_PREAD(fsp
, data
, n
, offset
);
1126 if (state
->nread
!= n
) {
1127 if (state
->nread
!= -1) {
1130 tevent_req_error(req
, errno
);
1131 return tevent_req_post(req
, ev
);
1134 tevent_req_done(req
);
1135 return tevent_req_post(req
, ev
);
1138 static void streams_xattr_pread_done(struct tevent_req
*subreq
)
1140 struct tevent_req
*req
= tevent_req_callback_data(
1141 subreq
, struct tevent_req
);
1142 struct streams_xattr_pread_state
*state
= tevent_req_data(
1143 req
, struct streams_xattr_pread_state
);
1145 state
->nread
= SMB_VFS_PREAD_RECV(subreq
, &state
->vfs_aio_state
);
1146 TALLOC_FREE(subreq
);
1148 if (tevent_req_error(req
, state
->vfs_aio_state
.error
)) {
1151 tevent_req_done(req
);
1154 static ssize_t
streams_xattr_pread_recv(struct tevent_req
*req
,
1155 struct vfs_aio_state
*vfs_aio_state
)
1157 struct streams_xattr_pread_state
*state
= tevent_req_data(
1158 req
, struct streams_xattr_pread_state
);
1160 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
1164 *vfs_aio_state
= state
->vfs_aio_state
;
1165 return state
->nread
;
1168 struct streams_xattr_pwrite_state
{
1170 struct vfs_aio_state vfs_aio_state
;
1173 static void streams_xattr_pwrite_done(struct tevent_req
*subreq
);
1175 static struct tevent_req
*streams_xattr_pwrite_send(
1176 struct vfs_handle_struct
*handle
,
1177 TALLOC_CTX
*mem_ctx
,
1178 struct tevent_context
*ev
,
1179 struct files_struct
*fsp
,
1181 size_t n
, off_t offset
)
1183 struct tevent_req
*req
= NULL
;
1184 struct tevent_req
*subreq
= NULL
;
1185 struct streams_xattr_pwrite_state
*state
= NULL
;
1186 struct stream_io
*sio
=
1187 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1189 req
= tevent_req_create(mem_ctx
, &state
,
1190 struct streams_xattr_pwrite_state
);
1196 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
,
1198 if (tevent_req_nomem(req
, subreq
)) {
1199 return tevent_req_post(req
, ev
);
1201 tevent_req_set_callback(subreq
, streams_xattr_pwrite_done
, req
);
1205 state
->nwritten
= SMB_VFS_PWRITE(fsp
, data
, n
, offset
);
1206 if (state
->nwritten
!= n
) {
1207 if (state
->nwritten
!= -1) {
1210 tevent_req_error(req
, errno
);
1211 return tevent_req_post(req
, ev
);
1214 tevent_req_done(req
);
1215 return tevent_req_post(req
, ev
);
1218 static void streams_xattr_pwrite_done(struct tevent_req
*subreq
)
1220 struct tevent_req
*req
= tevent_req_callback_data(
1221 subreq
, struct tevent_req
);
1222 struct streams_xattr_pwrite_state
*state
= tevent_req_data(
1223 req
, struct streams_xattr_pwrite_state
);
1225 state
->nwritten
= SMB_VFS_PWRITE_RECV(subreq
, &state
->vfs_aio_state
);
1226 TALLOC_FREE(subreq
);
1228 if (tevent_req_error(req
, state
->vfs_aio_state
.error
)) {
1231 tevent_req_done(req
);
1234 static ssize_t
streams_xattr_pwrite_recv(struct tevent_req
*req
,
1235 struct vfs_aio_state
*vfs_aio_state
)
1237 struct streams_xattr_pwrite_state
*state
= tevent_req_data(
1238 req
, struct streams_xattr_pwrite_state
);
1240 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
1244 *vfs_aio_state
= state
->vfs_aio_state
;
1245 return state
->nwritten
;
1248 static int streams_xattr_ftruncate(struct vfs_handle_struct
*handle
,
1249 struct files_struct
*fsp
,
1254 struct ea_struct ea
;
1256 struct stream_io
*sio
=
1257 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1258 struct smb_filename
*smb_fname_base
= NULL
;
1260 DEBUG(10, ("streams_xattr_ftruncate called for file %s offset %.0f\n",
1261 fsp_str_dbg(fsp
), (double)offset
));
1264 return SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, offset
);
1267 if (!streams_xattr_recheck(sio
)) {
1271 /* Create an smb_filename with stream_name == NULL. */
1272 smb_fname_base
= synthetic_smb_fname(talloc_tos(),
1276 fsp
->fsp_name
->flags
);
1277 if (smb_fname_base
== NULL
) {
1282 status
= get_ea_value(talloc_tos(), handle
->conn
, NULL
,
1283 smb_fname_base
, sio
->xattr_name
, &ea
);
1284 if (!NT_STATUS_IS_OK(status
)) {
1288 tmp
= talloc_realloc(talloc_tos(), ea
.value
.data
, uint8_t,
1292 TALLOC_FREE(ea
.value
.data
);
1297 /* Did we expand ? */
1298 if (ea
.value
.length
< offset
+ 1) {
1299 memset(&tmp
[ea
.value
.length
], '\0',
1300 offset
+ 1 - ea
.value
.length
);
1303 ea
.value
.data
= tmp
;
1304 ea
.value
.length
= offset
+ 1;
1305 ea
.value
.data
[offset
] = 0;
1307 ret
= SMB_VFS_SETXATTR(fsp
->conn
,
1310 ea
.value
.data
, ea
.value
.length
, 0);
1311 TALLOC_FREE(ea
.value
.data
);
1320 static int streams_xattr_fallocate(struct vfs_handle_struct
*handle
,
1321 struct files_struct
*fsp
,
1326 struct stream_io
*sio
=
1327 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1329 DEBUG(10, ("streams_xattr_fallocate called for file %s offset %.0f"
1331 fsp_str_dbg(fsp
), (double)offset
, (double)len
));
1334 return SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
1337 if (!streams_xattr_recheck(sio
)) {
1341 /* Let the pwrite code path handle it. */
1346 static int streams_xattr_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1347 uid_t uid
, gid_t gid
)
1349 struct stream_io
*sio
=
1350 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1353 return SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1359 static int streams_xattr_fchmod(vfs_handle_struct
*handle
,
1363 struct stream_io
*sio
=
1364 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1367 return SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1373 static ssize_t
streams_xattr_fgetxattr(struct vfs_handle_struct
*handle
,
1374 struct files_struct
*fsp
,
1379 struct stream_io
*sio
=
1380 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1383 return SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
1390 static ssize_t
streams_xattr_flistxattr(struct vfs_handle_struct
*handle
,
1391 struct files_struct
*fsp
,
1395 struct stream_io
*sio
=
1396 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1399 return SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
1406 static int streams_xattr_fremovexattr(struct vfs_handle_struct
*handle
,
1407 struct files_struct
*fsp
,
1410 struct stream_io
*sio
=
1411 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1414 return SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
1421 static int streams_xattr_fsetxattr(struct vfs_handle_struct
*handle
,
1422 struct files_struct
*fsp
,
1428 struct stream_io
*sio
=
1429 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1432 return SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
,
1440 static SMB_ACL_T
streams_xattr_sys_acl_get_fd(vfs_handle_struct
*handle
,
1442 TALLOC_CTX
*mem_ctx
)
1444 struct stream_io
*sio
=
1445 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1448 return SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
, mem_ctx
);
1451 return SMB_VFS_NEXT_SYS_ACL_GET_FILE(
1452 handle
, fsp
->base_fsp
->fsp_name
,
1453 SMB_ACL_TYPE_ACCESS
, mem_ctx
);
1456 static int streams_xattr_sys_acl_set_fd(vfs_handle_struct
*handle
,
1460 struct stream_io
*sio
=
1461 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1464 return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
1470 static int streams_xattr_sys_acl_blob_get_fd(vfs_handle_struct
*handle
,
1472 TALLOC_CTX
*mem_ctx
,
1473 char **blob_description
,
1476 struct stream_io
*sio
=
1477 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1480 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle
, fsp
, mem_ctx
,
1481 blob_description
, blob
);
1484 return SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(
1485 handle
, fsp
->base_fsp
->fsp_name
, mem_ctx
,
1486 blob_description
, blob
);
1489 static NTSTATUS
streams_xattr_fget_nt_acl(vfs_handle_struct
*handle
,
1491 uint32_t security_info
,
1492 TALLOC_CTX
*mem_ctx
,
1493 struct security_descriptor
**ppdesc
)
1495 struct stream_io
*sio
=
1496 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1499 return SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
,
1503 return SMB_VFS_NEXT_GET_NT_ACL(handle
, fsp
->base_fsp
->fsp_name
,
1504 security_info
, mem_ctx
, ppdesc
);
1507 static NTSTATUS
streams_xattr_fset_nt_acl(vfs_handle_struct
*handle
,
1509 uint32_t security_info_sent
,
1510 const struct security_descriptor
*psd
)
1512 struct stream_io
*sio
=
1513 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1516 return SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
,
1517 security_info_sent
, psd
);
1520 return NT_STATUS_OK
;
1523 struct streams_xattr_fsync_state
{
1525 struct vfs_aio_state vfs_aio_state
;
1528 static void streams_xattr_fsync_done(struct tevent_req
*subreq
);
1530 static struct tevent_req
*streams_xattr_fsync_send(
1531 struct vfs_handle_struct
*handle
,
1532 TALLOC_CTX
*mem_ctx
,
1533 struct tevent_context
*ev
,
1534 struct files_struct
*fsp
)
1536 struct tevent_req
*req
= NULL
;
1537 struct tevent_req
*subreq
= NULL
;
1538 struct streams_xattr_fsync_state
*state
= NULL
;
1539 struct stream_io
*sio
=
1540 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1542 req
= tevent_req_create(mem_ctx
, &state
,
1543 struct streams_xattr_fsync_state
);
1549 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
1550 if (tevent_req_nomem(req
, subreq
)) {
1551 return tevent_req_post(req
, ev
);
1553 tevent_req_set_callback(subreq
, streams_xattr_fsync_done
, req
);
1558 * There's no pathname based sync variant and we don't have access to
1559 * the basefile handle, so we can't do anything here.
1562 tevent_req_done(req
);
1563 return tevent_req_post(req
, ev
);
1566 static void streams_xattr_fsync_done(struct tevent_req
*subreq
)
1568 struct tevent_req
*req
= tevent_req_callback_data(
1569 subreq
, struct tevent_req
);
1570 struct streams_xattr_fsync_state
*state
= tevent_req_data(
1571 req
, struct streams_xattr_fsync_state
);
1573 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->vfs_aio_state
);
1574 TALLOC_FREE(subreq
);
1575 if (state
->ret
!= 0) {
1576 tevent_req_error(req
, errno
);
1580 tevent_req_done(req
);
1583 static int streams_xattr_fsync_recv(struct tevent_req
*req
,
1584 struct vfs_aio_state
*vfs_aio_state
)
1586 struct streams_xattr_fsync_state
*state
= tevent_req_data(
1587 req
, struct streams_xattr_fsync_state
);
1589 if (tevent_req_is_unix_error(req
, &vfs_aio_state
->error
)) {
1593 *vfs_aio_state
= state
->vfs_aio_state
;
1597 static bool streams_xattr_lock(vfs_handle_struct
*handle
,
1604 struct stream_io
*sio
=
1605 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1608 return SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1614 static bool streams_xattr_getlock(vfs_handle_struct
*handle
,
1621 struct stream_io
*sio
=
1622 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1625 return SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
,
1626 pcount
, ptype
, ppid
);
1633 static int streams_xattr_kernel_flock(vfs_handle_struct
*handle
,
1635 uint32_t share_mode
,
1636 uint32_t access_mask
)
1638 struct stream_io
*sio
=
1639 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1642 return SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
,
1643 share_mode
, access_mask
);
1649 static int streams_xattr_linux_setlease(vfs_handle_struct
*handle
,
1653 struct stream_io
*sio
=
1654 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1657 return SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1663 static bool streams_xattr_strict_lock_check(struct vfs_handle_struct
*handle
,
1665 struct lock_struct
*plock
)
1667 struct stream_io
*sio
=
1668 (struct stream_io
*)VFS_FETCH_FSP_EXTENSION(handle
, fsp
);
1671 return SMB_VFS_NEXT_STRICT_LOCK_CHECK(handle
, fsp
, plock
);
1677 static struct vfs_fn_pointers vfs_streams_xattr_fns
= {
1678 .fs_capabilities_fn
= streams_xattr_fs_capabilities
,
1679 .connect_fn
= streams_xattr_connect
,
1680 .open_fn
= streams_xattr_open
,
1681 .close_fn
= streams_xattr_close
,
1682 .stat_fn
= streams_xattr_stat
,
1683 .fstat_fn
= streams_xattr_fstat
,
1684 .lstat_fn
= streams_xattr_lstat
,
1685 .pread_fn
= streams_xattr_pread
,
1686 .pwrite_fn
= streams_xattr_pwrite
,
1687 .pread_send_fn
= streams_xattr_pread_send
,
1688 .pread_recv_fn
= streams_xattr_pread_recv
,
1689 .pwrite_send_fn
= streams_xattr_pwrite_send
,
1690 .pwrite_recv_fn
= streams_xattr_pwrite_recv
,
1691 .unlink_fn
= streams_xattr_unlink
,
1692 .rename_fn
= streams_xattr_rename
,
1693 .ftruncate_fn
= streams_xattr_ftruncate
,
1694 .fallocate_fn
= streams_xattr_fallocate
,
1695 .streaminfo_fn
= streams_xattr_streaminfo
,
1697 .fsync_send_fn
= streams_xattr_fsync_send
,
1698 .fsync_recv_fn
= streams_xattr_fsync_recv
,
1700 .lock_fn
= streams_xattr_lock
,
1701 .getlock_fn
= streams_xattr_getlock
,
1702 .kernel_flock_fn
= streams_xattr_kernel_flock
,
1703 .linux_setlease_fn
= streams_xattr_linux_setlease
,
1704 .strict_lock_check_fn
= streams_xattr_strict_lock_check
,
1706 .fchown_fn
= streams_xattr_fchown
,
1707 .fchmod_fn
= streams_xattr_fchmod
,
1709 .fgetxattr_fn
= streams_xattr_fgetxattr
,
1710 .flistxattr_fn
= streams_xattr_flistxattr
,
1711 .fremovexattr_fn
= streams_xattr_fremovexattr
,
1712 .fsetxattr_fn
= streams_xattr_fsetxattr
,
1714 .sys_acl_get_fd_fn
= streams_xattr_sys_acl_get_fd
,
1715 .sys_acl_blob_get_fd_fn
= streams_xattr_sys_acl_blob_get_fd
,
1716 .sys_acl_set_fd_fn
= streams_xattr_sys_acl_set_fd
,
1718 .fget_nt_acl_fn
= streams_xattr_fget_nt_acl
,
1719 .fset_nt_acl_fn
= streams_xattr_fset_nt_acl
,
1723 NTSTATUS
vfs_streams_xattr_init(TALLOC_CTX
*ctx
)
1725 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "streams_xattr",
1726 &vfs_streams_xattr_fns
);