The branch, master has been updated
       via  2881679 vfs_streams_xattr: fix and simplify streams_xattr_get_name()
       via  fedd096 vfs_fruit: hide the Netatalk metadata xattr in streaminfo
       via  c8ee1a0 vfs_fruit: add and use define for the Netatalk metadata 
xattr
       via  c4bdba9 s3.lib: Remove invalid switch case from sysquotas_nfs
      from  2bad085 build: Build *_wrapper without -DNDEBUG for in-tree use

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2881679e3ecbaf07cdd82ba65af8d55e5e3be800
Author: Ralph Boehme <[email protected]>
Date:   Mon Aug 24 17:45:14 2015 +0200

    vfs_streams_xattr: fix and simplify streams_xattr_get_name()
    
    streams_xattr_get_name() fails to chop off the stream type in case
    config->store_stream_type is false and the passed stream name contains a
    stream type.
    
    Eg when the passed in stream name is ":mystream:$DATA", but
    config->store_stream_type is false, we must generate a xattr name of
    "mystream" or "user.mystream".
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11466
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>
    
    Autobuild-User(master): Jeremy Allison <[email protected]>
    Autobuild-Date(master): Fri Oct 16 23:27:01 CEST 2015 on sn-devel-104

commit fedd09662c889fb796135d86836c160171fac68d
Author: Ralph Boehme <[email protected]>
Date:   Mon Aug 24 17:43:40 2015 +0200

    vfs_fruit: hide the Netatalk metadata xattr in streaminfo
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11466
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit c8ee1a059b4484575b03ac76b469df85cdabdd9a
Author: Ralph Boehme <[email protected]>
Date:   Mon Aug 24 17:42:35 2015 +0200

    vfs_fruit: add and use define for the Netatalk metadata xattr
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=11466
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

commit c4bdba97b4b09196765bb3a486b16294c28772b8
Author: Anoop C S <[email protected]>
Date:   Fri Oct 9 11:32:52 2015 +0000

    s3.lib: Remove invalid switch case from sysquotas_nfs
    
    getquota_rslt structure from rquota.h defines the enum
    named status whose values start from 1. But in
    sysquotas_nfs.c we have an invalid check for status 0.
    This change is to remove that particular switch case.
    
    Signed-off-by: Anoop C S <[email protected]>
    Reviewed-by: Michael Adam <[email protected]>
    Reviewed-by: Jeremy Allison <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/sysquotas_nfs.c         |  7 -----
 source3/modules/vfs_fruit.c         | 56 ++++++++++++++++++++++++++++++++++---
 source3/modules/vfs_streams_xattr.c | 39 +++++++++++++-------------
 3 files changed, 71 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/sysquotas_nfs.c b/source3/lib/sysquotas_nfs.c
index 58eedf0..4b37e34 100644
--- a/source3/lib/sysquotas_nfs.c
+++ b/source3/lib/sysquotas_nfs.c
@@ -211,19 +211,12 @@ int sys_get_nfs_quota(const char *path, const char *bdev,
 
        /*
         * gqr.status returns
-        *   0 if the rpc call fails,
         *   1 if quotas exist,
         *   2 if there is no quota set, and
         *   3 if no permission to get the quota.
         */
 
        switch (gq_rslt.GQR_STATUS) {
-       case 0:
-               DEBUG(3, ("sys_get_nfs_quotas: Remote Quotas Failed! "
-                         "Error '%i'\n", gq_rslt.GQR_STATUS));
-               ret = -1;
-               goto out;
-
        case 1:
                DEBUG(10, ("sys_get_nfs_quotas: Good quota data\n"));
                dp->bsize = (uint64_t)gq_rslt.GQR_RQUOTA.rq_bsize;
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 25a86c1..a09e288 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -104,11 +104,12 @@ static int vfs_fruit_debug_level = DBGC_VFS;
  * REVIEW:
  * This is hokey, but what else can we do?
  */
+#define NETATALK_META_XATTR "org.netatalk.Metadata"
 #if defined(HAVE_ATTROPEN) || defined(FREEBSD)
-#define AFPINFO_EA_NETATALK "org.netatalk.Metadata"
+#define AFPINFO_EA_NETATALK NETATALK_META_XATTR
 #define AFPRESOURCE_EA_NETATALK "org.netatalk.ResourceFork"
 #else
-#define AFPINFO_EA_NETATALK "user.org.netatalk.Metadata"
+#define AFPINFO_EA_NETATALK "user." NETATALK_META_XATTR
 #define AFPRESOURCE_EA_NETATALK "user.org.netatalk.ResourceFork"
 #endif
 
@@ -1522,6 +1523,37 @@ static bool add_fruit_stream(TALLOC_CTX *mem_ctx, 
unsigned int *num_streams,
        return true;
 }
 
+static bool del_fruit_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
+                            struct stream_struct **streams,
+                            const char *name)
+{
+       struct stream_struct *tmp = *streams;
+       int i;
+
+       if (*num_streams == 0) {
+               return true;
+       }
+
+       for (i = 0; i < *num_streams; i++) {
+               if (strequal_m(tmp[i].name, name)) {
+                       break;
+               }
+       }
+
+       if (i == *num_streams) {
+               return true;
+       }
+
+       TALLOC_FREE(tmp[i].name);
+       if (*num_streams - 1 > i) {
+               memmove(&tmp[i], &tmp[i+1],
+                       (*num_streams - i - 1) * sizeof(struct stream_struct));
+       }
+
+       *num_streams -= 1;
+       return true;
+}
+
 static bool empty_finderinfo(const struct adouble *ad)
 {
 
@@ -3095,6 +3127,7 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct 
*handle,
        struct fruit_config_data *config = NULL;
        struct smb_filename *smb_fname = NULL;
        struct adouble *ad = NULL;
+       NTSTATUS status;
 
        SMB_VFS_HANDLE_GET_DATA(handle, config, struct fruit_config_data,
                                return NT_STATUS_UNSUCCESSFUL);
@@ -3143,8 +3176,23 @@ static NTSTATUS fruit_streaminfo(vfs_handle_struct 
*handle,
 
        TALLOC_FREE(smb_fname);
 
-       return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
-                                      pnum_streams, pstreams);
+       status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
+                                        pnum_streams, pstreams);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       if (config->meta == FRUIT_META_NETATALK) {
+               /* Remove the Netatalk xattr from the list */
+               if (!del_fruit_stream(mem_ctx, pnum_streams, pstreams,
+                                     ":" NETATALK_META_XATTR ":$DATA")) {
+                               TALLOC_FREE(ad);
+                               TALLOC_FREE(smb_fname);
+                               return NT_STATUS_NO_MEMORY;
+               }
+       }
+
+       return NT_STATUS_OK;
 }
 
 static int fruit_ntimes(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_streams_xattr.c 
b/source3/modules/vfs_streams_xattr.c
index 92bd1c9..b54809f 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -106,12 +106,18 @@ static NTSTATUS streams_xattr_get_name(vfs_handle_struct 
*handle,
                                       const char *stream_name,
                                       char **xattr_name)
 {
+       char *sname;
        char *stype;
        struct streams_xattr_config *config;
 
        SMB_VFS_HANDLE_GET_DATA(handle, config, struct streams_xattr_config,
                                return NT_STATUS_UNSUCCESSFUL);
 
+       sname = talloc_strdup(ctx, stream_name + 1);
+       if (sname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
        /*
         * With vfs_fruit option "fruit:encoding = native" we're
         * already converting stream names that contain illegal NTFS
@@ -126,41 +132,34 @@ static NTSTATUS streams_xattr_get_name(vfs_handle_struct 
*handle,
         * In check_path_syntax() we've already ensured the streamname
         * we got from the client is valid.
         */
-       stype = strrchr_m(stream_name + 1, ':');
+       stype = strrchr_m(sname, ':');
 
        if (stype) {
+               /*
+                * We only support one stream type: "$DATA"
+                */
                if (strcasecmp_m(stype, ":$DATA") != 0) {
+                       talloc_free(sname);
                        return NT_STATUS_INVALID_PARAMETER;
                }
+
+               /* Split name and type */
+               stype[0] = '\0';
        }
 
-       *xattr_name = talloc_asprintf(ctx, "%s%s",
+       *xattr_name = talloc_asprintf(ctx, "%s%s%s",
                                      config->prefix,
-                                     stream_name + 1);
+                                     sname,
+                                     config->store_stream_type ? ":$DATA" : 
"");
        if (*xattr_name == NULL) {
+               talloc_free(sname);
                return NT_STATUS_NO_MEMORY;
        }
 
-       if (stype != NULL) {
-               /* Normalize the stream type to upercase. */
-               if (!strupper_m(strrchr_m(*xattr_name, ':') + 1)) {
-                       return NT_STATUS_INVALID_PARAMETER;
-               }
-       } else if (config->store_stream_type) {
-               /*
-                * Append an explicit stream type if one wasn't
-                * specified.
-                */
-               *xattr_name = talloc_asprintf(ctx, "%s%s",
-                                             *xattr_name, ":$DATA");
-               if (*xattr_name == NULL) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-       }
-
        DEBUG(10, ("xattr_name: %s, stream_name: %s\n", *xattr_name,
                   stream_name));
 
+       talloc_free(sname);
        return NT_STATUS_OK;
 }
 


-- 
Samba Shared Repository

Reply via email to