vfs_streams_xattr: stream name prefix and type suffix
Volker Lendecke
Volker.Lendecke at SerNet.DE
Fri May 23 10:52:05 MDT 2014
On Wed, May 21, 2014 at 01:47:53PM +0200, Ralph Böhme wrote:
> With the patches applied, adding the following to smb.conf
>
> streams_xattr:prefix = user.
> streams_xattr:store_stream_type = no
>
> gives the desired behaviour.
>
> Thoughts?
The idea sounds good.
> >From 066fcf3c5bb414b84a349a1a5fda07e3e0308593 Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <rb at sernet.de>
> Date: Wed, 21 May 2014 11:52:27 +0200
> Subject: [PATCH 1/2] Convert samba_private_attr_name() to a public function
>
> Signed-off-by: Ralph Boehme <rb at sernet.de>
> ---
> source3/modules/vfs_streams_xattr.c | 3 +++
> source3/smbd/proto.h | 1 +
> source3/smbd/trans2.c | 2 +-
> 3 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
> index 5e9bd3e..5ff4f82 100644
> --- a/source3/modules/vfs_streams_xattr.c
> +++ b/source3/modules/vfs_streams_xattr.c
> @@ -674,6 +674,9 @@ static NTSTATUS walk_xattr_streams(connection_struct *conn, files_struct *fsp,
> prefix_len) != 0) {
> continue;
> }
> + if (samba_private_attr_name(names[i])) {
> + continue;
> + }
This hunk is a bit more than is explained in the commit
message. Can you expand the message a bit with something
like ... in preparation of ... or split this into a separate
patch?
> if (stype == NULL) {
> /* Append an explicit stream type if one wasn't specified. */
> - *xattr_name = talloc_asprintf(ctx, "%s:$DATA",
> - *xattr_name);
> + *xattr_name = talloc_asprintf(ctx, "%s%s",
> + *xattr_name,
> + config->store_stream_type ? ":$DATA" : "");
Stylistic comment: Here I would do something like
if ((stype == NULL) && (config->store_stream_type != NULL))
and just not do the talloc_asprintf in the NULL case.
> +static int streams_xattr_connect(vfs_handle_struct *handle, const char *service, const char *user)
> +{
> + struct streams_xattr_config *config;
> + const char *default_prefix = SAMBA_XATTR_DOSSTREAM_PREFIX;
> + const char **prefix;
> +
> + config = talloc_zero(handle->conn, struct streams_xattr_config);
> + if (!config) {
> + DEBUG(1, ("talloc_zero() failed\n"));
> + errno = ENOMEM;
> + return -1;
> + }
> +
> + prefix = lp_parm_string_list(SNUM(handle->conn),
> + "streams_xattr", "prefix",
> + &default_prefix);
> + if (prefix) {
> + config->prefix = *prefix;
Does this maintain the correct talloc hierarchy? Isn't
*prefix gone after the next tevent round with
talloc_free(frame)?
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical
mailing list