s3: VFS: Change SMB_VFS_LISTXATTR to use const struct smb_filename * instead of const...
authorJeremy Allison <jra@samba.org>
Tue, 23 May 2017 20:12:29 +0000 (13:12 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 31 May 2017 20:50:22 +0000 (22:50 +0200)
We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
21 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_cap.c
source3/modules/vfs_catia.c
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_media_harmony.c
source3/modules/vfs_posix_eadb.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_snapper.c
source3/modules/vfs_time_audit.c
source3/modules/vfs_unityed_media.c
source3/modules/vfs_vxfs.c
source3/modules/vfs_xattr_tdb.c
source3/smbd/trans2.c
source3/smbd/vfs.c
source3/torture/cmd_vfs.c

index e7158203c50a335b04bb51f092c3088cf912a6e7..981bfbffe33348a931cfb34d635656cd9e7f1ece 100644 (file)
@@ -812,8 +812,10 @@ static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
        return -1;
 }
 
-static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
-                             char *list, size_t size)
+static ssize_t skel_listxattr(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
        errno = ENOSYS;
        return -1;
index 05d672348450ebe4708acb2aca328a343c6431f7..ec7a9f1aee03e3e9b2294815724ad8677e2cd068 100644 (file)
@@ -946,10 +946,12 @@ static ssize_t skel_fgetxattr(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
 }
 
-static ssize_t skel_listxattr(vfs_handle_struct *handle, const char *path,
-                             char *list, size_t size)
+static ssize_t skel_listxattr(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
-       return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
 }
 
 static ssize_t skel_flistxattr(vfs_handle_struct *handle,
index f3a0b323923d3076faca9979cbee01ec1d4561b1..7046513480de162522383baaa4e4fb2ee42744e9 100644 (file)
                to const struct smb_filename * */
 /* Version 37 - Change sys_acl_set_file from const char *
                to const struct smb_filename * */
+/* Version 37 - Change listxattr from const char *
+               to const struct smb_filename * */
 
 #define SMB_VFS_INTERFACE_VERSION 37
 
@@ -889,7 +891,10 @@ struct vfs_fn_pointers {
        /* EA operations. */
        ssize_t (*getxattr_fn)(struct vfs_handle_struct *handle,const char *path, const char *name, void *value, size_t size);
        ssize_t (*fgetxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name, void *value, size_t size);
-       ssize_t (*listxattr_fn)(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
+       ssize_t (*listxattr_fn)(struct vfs_handle_struct *handle,
+                                       const struct smb_filename *smb_fname,
+                                       char *list,
+                                       size_t size);
        ssize_t (*flistxattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
        int (*removexattr_fn)(struct vfs_handle_struct *handle, const char *path, const char *name);
        int (*fremovexattr_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const char *name);
@@ -1354,7 +1359,9 @@ ssize_t smb_vfs_call_fgetxattr(struct vfs_handle_struct *handle,
                               struct files_struct *fsp, const char *name,
                               void *value, size_t size);
 ssize_t smb_vfs_call_listxattr(struct vfs_handle_struct *handle,
-                              const char *path, char *list, size_t size);
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size);
 ssize_t smb_vfs_call_llistxattr(struct vfs_handle_struct *handle,
                                const char *path, char *list, size_t size);
 ssize_t smb_vfs_call_flistxattr(struct vfs_handle_struct *handle,
index ac04093b10891e29599af0ddc9619c4d023045c4..f5c0332cf208d0d7c82dc8074f75d69ac20222e2 100644 (file)
 #define SMB_VFS_NEXT_FGETXATTR(handle,fsp,name,value,size) \
        smb_vfs_call_fgetxattr((handle)->next,(fsp),(name),(value),(size))
 
-#define SMB_VFS_LISTXATTR(conn,path,list,size) \
-       smb_vfs_call_listxattr((conn)->vfs_handles,(path),(list),(size))
-#define SMB_VFS_NEXT_LISTXATTR(handle,path,list,size) \
-       smb_vfs_call_listxattr((handle)->next,(path),(list),(size))
+#define SMB_VFS_LISTXATTR(conn,smb_fname,list,size) \
+       smb_vfs_call_listxattr((conn)->vfs_handles,(smb_fname),(list),(size))
+#define SMB_VFS_NEXT_LISTXATTR(handle,smb_fname,list,size) \
+       smb_vfs_call_listxattr((handle)->next,(smb_fname),(list),(size))
 
 #define SMB_VFS_FLISTXATTR(fsp,list,size) \
        smb_vfs_call_flistxattr((fsp)->conn->vfs_handles, (fsp), (list),(size))
index 8d621ccec5e800ae9b9db29c87910f9bec5cee0a..91f624ee96b4cf2010d8d437068efa8239ccf53b 100644 (file)
@@ -675,15 +675,40 @@ static ssize_t cap_fgetxattr(vfs_handle_struct *handle, struct files_struct *fsp
         return SMB_VFS_NEXT_FGETXATTR(handle, fsp, cappath, value, size);
 }
 
-static ssize_t cap_listxattr(vfs_handle_struct *handle, const char *path, char *list, size_t size)
+static ssize_t cap_listxattr(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
-       char *cappath = capencode(talloc_tos(), path);
+       struct smb_filename *cap_smb_fname = NULL;
+       char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+       ssize_t ret;
+       int saved_errno = 0;
 
        if (!cappath) {
                errno = ENOMEM;
                return -1;
        }
-        return SMB_VFS_NEXT_LISTXATTR(handle, cappath, list, size);
+       cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       cappath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (cap_smb_fname == NULL) {
+               TALLOC_FREE(cappath);
+               errno = ENOMEM;
+               return -1;
+       }
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, cap_smb_fname, list, size);
+       if (ret == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(cappath);
+       TALLOC_FREE(cap_smb_fname);
+       if (saved_errno) {
+               errno = saved_errno;
+       }
+       return ret;
 }
 
 static int cap_removexattr(vfs_handle_struct *handle, const char *path, const char *name)
index 24fc26d122f0a29d418f6dd2e11bffc42a637ec8..844f2418c60158fc0caa3c8a037246fba80b46bc 100644 (file)
@@ -1408,23 +1408,45 @@ catia_getxattr(vfs_handle_struct *handle, const char *path,
 }
 
 static ssize_t
-catia_listxattr(vfs_handle_struct *handle, const char *path,
+catia_listxattr(vfs_handle_struct *handle,
+               const struct smb_filename *smb_fname,
                char *list, size_t size)
 {
+       struct smb_filename *mapped_smb_fname = NULL;
        char *mapped_name = NULL;
        NTSTATUS status;
        ssize_t ret;
+       int saved_errno = 0;
 
        status = catia_string_replace_allocate(handle->conn,
-                               path, &mapped_name, vfs_translate_to_unix);
+                               smb_fname->base_name,
+                               &mapped_name,
+                               vfs_translate_to_unix);
        if (!NT_STATUS_IS_OK(status)) {
                errno = map_errno_from_nt_status(status);
                return -1;
        }
 
+       mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       mapped_name,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (mapped_smb_fname == NULL) {
+               TALLOC_FREE(mapped_name);
+               errno = ENOMEM;
+               return -1;
+       }
 
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, mapped_name, list, size);
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, mapped_smb_fname, list, size);
+       if (ret == -1) {
+               saved_errno = errno;
+       }
        TALLOC_FREE(mapped_name);
+       TALLOC_FREE(mapped_smb_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
 
        return ret;
 }
index d819fe18dc35fee26451c4ccf762d05cdb5b51a5..874bd40d733c3caf2b0708314b26af88f350f7e8 100644 (file)
@@ -1247,11 +1247,15 @@ static ssize_t cephwrap_fgetxattr(struct vfs_handle_struct *handle, struct files
        }
 }
 
-static ssize_t cephwrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
+static ssize_t cephwrap_listxattr(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       char *list,
+                       size_t size)
 {
        int ret;
-       DBG_DEBUG("[CEPH] listxattr(%p, %s, %p, %llu)\n", handle, path, list, llu(size));
-       ret = ceph_listxattr(handle->data, path, list, size);
+       DBG_DEBUG("[CEPH] listxattr(%p, %s, %p, %llu)\n", handle,
+                       smb_fname->base_name, list, llu(size));
+       ret = ceph_listxattr(handle->data, smb_fname->base_name, list, size);
        DBG_DEBUG("[CEPH] listxattr(...) = %d\n", ret);
        if (ret < 0) {
                WRAP_RETURN(ret);
index ad47f38105ff6fc903bfcf0d1a608138f9852dfd..dfdcfb4f23dac88be66c1b28db48f62c52507db1 100644 (file)
@@ -2757,9 +2757,12 @@ static ssize_t vfswrap_fgetxattr(struct vfs_handle_struct *handle, struct files_
        return fgetxattr(fsp->fh->fd, name, value, size);
 }
 
-static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size)
+static ssize_t vfswrap_listxattr(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       char *list,
+                       size_t size)
 {
-       return listxattr(path, list, size);
+       return listxattr(smb_fname->base_name, list, size);
 }
 
 static ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size)
index 07f01c27e992f041c04deeb433dd4e40dbe3a724..f50f24d02b1a4519e6b7f2205176e6eec61077f2 100644 (file)
@@ -2284,13 +2284,16 @@ static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle,
-                              const char *path, char *list, size_t size)
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       result = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
 
-       do_log(SMB_VFS_OP_LISTXATTR, (result >= 0), handle, "%s", path);
+       do_log(SMB_VFS_OP_LISTXATTR, (result >= 0), handle, "%s",
+                       smb_fname->base_name);
 
        return result;
 }
index 628dea7933697c30079bea62b214d668ad385f1f..30629b8db6c03d76833ed6f337014204b0dadf22 100644 (file)
@@ -1316,9 +1316,11 @@ static ssize_t vfs_gluster_fgetxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t vfs_gluster_listxattr(struct vfs_handle_struct *handle,
-                                    const char *path, char *list, size_t size)
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
-       return glfs_listxattr(handle->data, path, list, size);
+       return glfs_listxattr(handle->data, smb_fname->base_name, list, size);
 }
 
 static ssize_t vfs_gluster_flistxattr(struct vfs_handle_struct *handle,
index 6915fb0e21e1cff61c03a630477dc08a19de7ca7..2113e0310a11d1cf0b5efb7d7f6093fe559049a4 100644 (file)
@@ -2245,35 +2245,32 @@ out:
  * Failure: set errno, return -1
  */
 static ssize_t mh_listxattr(struct vfs_handle_struct *handle,
-               const char *path,
+               const struct smb_filename *smb_fname,
                char *list,
                size_t size)
 {
        ssize_t ret;
-       char *clientPath;
-       TALLOC_CTX *ctx;
+       struct smb_filename *clientFname = NULL;
+       int status;
 
        DEBUG(MH_INFO_DEBUG, ("Entering mh_listxattr\n"));
-       if (!is_in_media_files(path))
-       {
-               ret = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               ret = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
                goto out;
        }
 
-       clientPath = NULL;
-       ctx = talloc_tos();
-
-       if (alloc_get_client_path(handle, ctx,
-                               path,
-                               &clientPath))
-       {
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &clientFname);
+       if (status != 0) {
                ret = -1;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, clientPath, list, size);
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, clientFname, list, size);
 err:
-       TALLOC_FREE(clientPath);
+       TALLOC_FREE(clientFname);
 out:
        return ret;
 }
index 129f0720d55fb2018e5481a5a96624358b917190..b5f92dff9c150432935b9b1a6bdfd479ba4dc46a 100644 (file)
@@ -179,13 +179,15 @@ static ssize_t posix_eadb_listattr(struct tdb_wrap *db_ctx,
 }
 
 static ssize_t posix_eadb_listxattr(struct vfs_handle_struct *handle,
-                                  const char *path, char *list, size_t size)
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
        struct tdb_wrap *db;
 
        SMB_VFS_HANDLE_GET_DATA(handle, db, struct tdb_wrap, return -1);
 
-       return posix_eadb_listattr(db, path, -1, list, size);
+       return posix_eadb_listattr(db, smb_fname->base_name, -1, list, size);
 }
 
 static ssize_t posix_eadb_flistxattr(struct vfs_handle_struct *handle,
index 6777d7a82085ffcc82fde6bdbca594f1f545b111..74176793a14c1234b1e57bfd4c1234d8cd3d66e3 100644 (file)
@@ -2367,7 +2367,7 @@ static ssize_t shadow_copy2_getxattr(vfs_handle_struct *handle,
 }
 
 static ssize_t shadow_copy2_listxattr(struct vfs_handle_struct *handle,
-                                     const char *fname,
+                                     const struct smb_filename *smb_fname,
                                      char *list, size_t size)
 {
        time_t timestamp = 0;
@@ -2375,23 +2375,37 @@ static ssize_t shadow_copy2_listxattr(struct vfs_handle_struct *handle,
        ssize_t ret;
        int saved_errno = 0;
        char *conv;
+       struct smb_filename *conv_smb_fname = NULL;
 
-       if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
-                                        &timestamp, &stripped)) {
+       if (!shadow_copy2_strip_snapshot(talloc_tos(),
+                               handle,
+                               smb_fname->base_name,
+                               &timestamp,
+                               &stripped)) {
                return -1;
        }
        if (timestamp == 0) {
-               return SMB_VFS_NEXT_LISTXATTR(handle, fname, list, size);
+               return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
        }
        conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
        TALLOC_FREE(stripped);
        if (conv == NULL) {
                return -1;
        }
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, conv, list, size);
+       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (conv_smb_fname == NULL) {
+               TALLOC_FREE(conv);
+               return -1;
+       }
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, conv_smb_fname, list, size);
        if (ret == -1) {
                saved_errno = errno;
        }
+       TALLOC_FREE(conv_smb_fname);
        TALLOC_FREE(conv);
        if (saved_errno != 0) {
                errno = saved_errno;
index 69e2ab90a6222b8ef68c1f63504134e358d59ae8..bc98f78189aa16d13c66617be1afedbd8d70d4fc 100644 (file)
@@ -2699,31 +2699,50 @@ static ssize_t snapper_gmt_getxattr(vfs_handle_struct *handle,
 }
 
 static ssize_t snapper_gmt_listxattr(struct vfs_handle_struct *handle,
-                                    const char *fname,
+                                    const struct smb_filename *smb_fname,
                                     char *list, size_t size)
 {
-       time_t timestamp;
-       char *stripped;
+       time_t timestamp = 0;
+       char *stripped = NULL;
        ssize_t ret;
-       int saved_errno;
-       char *conv;
+       int saved_errno = 0;
+       char *conv = NULL;
+       struct smb_filename *conv_smb_fname = NULL;
 
-       if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname,
-                                       &timestamp, &stripped)) {
+       if (!snapper_gmt_strip_snapshot(talloc_tos(),
+                                       handle,
+                                       smb_fname->base_name,
+                                       &timestamp,
+                                       &stripped)) {
                return -1;
        }
        if (timestamp == 0) {
-               return SMB_VFS_NEXT_LISTXATTR(handle, fname, list, size);
+               return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
        }
        conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
        TALLOC_FREE(stripped);
        if (conv == NULL) {
                return -1;
        }
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, conv, list, size);
-       saved_errno = errno;
+       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
        TALLOC_FREE(conv);
-       errno = saved_errno;
+       if (conv_smb_fname == NULL) {
+               errno = ENOMEM;
+               return -1;
+       }
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, conv_smb_fname, list, size);
+       if (ret == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(conv_smb_fname);
+       TALLOC_FREE(conv);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return ret;
 }
 
index 2a2f084cdd84e846ef1c38007da9d31625551800..e260c4727e3f6d77f9608945e452e135f5010511 100644 (file)
@@ -2362,7 +2362,8 @@ static ssize_t smb_time_audit_fgetxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
-                                       const char *path, char *list,
+                                       const struct smb_filename *smb_fname,
+                                       char *list,
                                        size_t size)
 {
        ssize_t result;
@@ -2370,12 +2371,13 @@ static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
        double timediff;
 
        clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       result = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
        clock_gettime_mono(&ts2);
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log_fname("listxattr", timediff, path);
+               smb_time_audit_log_fname("listxattr", timediff,
+                               smb_fname->base_name);
        }
 
        return result;
index 21d5416568e756147afe9862b04f241970108e2a..7b60856ae7542a9c5abdb223ebe3dac54c7ee40d 100644 (file)
@@ -1750,31 +1750,33 @@ err:
 }
 
 static ssize_t um_listxattr(struct vfs_handle_struct *handle,
-                           const char *path,
+                           const struct smb_filename *smb_fname,
                            char *list,
                            size_t size)
 {
        ssize_t ret;
-       char *client_path = NULL;
+       struct smb_filename *client_fname = NULL;
        int status;
 
        DEBUG(10, ("Entering um_listxattr\n"));
 
-       if (!is_in_media_files(path)) {
-               return SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
        }
 
-       status = alloc_get_client_path(handle, talloc_tos(),
-                                      path, &client_path);
+       status = alloc_get_client_smb_fname(handle,
+                               talloc_tos(),
+                               smb_fname,
+                               &client_fname);
        if (status != 0) {
                ret = -1;
                goto err;
        }
 
-       ret = SMB_VFS_NEXT_LISTXATTR(handle, client_path, list, size);
+       ret = SMB_VFS_NEXT_LISTXATTR(handle, client_fname, list, size);
 
 err:
-       TALLOC_FREE(client_path);
+       TALLOC_FREE(client_fname);
        return ret;
 }
 
index 5dc9ba2cfe37643cdc404c34022096675135bd43..c678636d14a9760e6d0e07c33634e54064319cb0 100644 (file)
@@ -752,17 +752,19 @@ static size_t vxfs_filter_list(char *list, size_t size)
        return size;
 }
 
-static ssize_t vxfs_listxattr(vfs_handle_struct *handle, const char *path,
-                              char *list, size_t size)
+static ssize_t vxfs_listxattr(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
        ssize_t result;
 
-       result = vxfs_listxattr_path(path, list, size);
+       result = vxfs_listxattr_path(smb_fname->base_name, list, size);
        if (result >= 0 || ((errno != ENOTSUP) && (errno != ENOSYS))) {
                return result;
        }
 
-       result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
+       result = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
 
        if (result <= 0) {
                return result;
index 12ccbca59200671fa583ab055ebc807f3b76a2c0..a4f80b20eda01aac5c8c5cc0825dd721fa1c8ea1 100644 (file)
@@ -204,7 +204,9 @@ static int xattr_tdb_fsetxattr(struct vfs_handle_struct *handle,
 }
 
 static ssize_t xattr_tdb_listxattr(struct vfs_handle_struct *handle,
-                                  const char *path, char *list, size_t size)
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
        struct file_id id;
        struct db_context *db;
@@ -217,7 +219,7 @@ static ssize_t xattr_tdb_listxattr(struct vfs_handle_struct *handle,
                                        TALLOC_FREE(frame); return -1;
                                });
 
-       ret = xattr_tdb_get_file_id(handle, path, &id);
+       ret = xattr_tdb_get_file_id(handle, smb_fname->base_name, &id);
        if (ret == -1) {
                TALLOC_FREE(frame);
                return -1;
index a44de7e7b3a33c9573e7c14dc80a06b5883b269b..8c1190b5d30c3227b97c600a5564cb99d51fe384 100644 (file)
@@ -289,7 +289,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx,
                                             ea_namelist_size);
        } else {
                sizeret = SMB_VFS_LISTXATTR(conn,
-                                           smb_fname->base_name,
+                                           smb_fname,
                                            ea_namelist,
                                            ea_namelist_size);
        }
@@ -307,7 +307,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx,
                                                     ea_namelist_size);
                } else {
                        sizeret = SMB_VFS_LISTXATTR(conn,
-                                                   smb_fname->base_name,
+                                                   smb_fname,
                                                    ea_namelist,
                                                    ea_namelist_size);
                }
index fc0a519383ba0dba72f5df602b13aa8886292827..d27ab397419c5fb730f96c9a3a6aee05f8ede5ef 100644 (file)
@@ -2519,10 +2519,12 @@ ssize_t smb_vfs_call_fgetxattr(struct vfs_handle_struct *handle,
 }
 
 ssize_t smb_vfs_call_listxattr(struct vfs_handle_struct *handle,
-                              const char *path, char *list, size_t size)
+                               const struct smb_filename *smb_fname,
+                               char *list,
+                               size_t size)
 {
        VFS_FIND(listxattr);
-       return handle->fns->listxattr_fn(handle, path, list, size);
+       return handle->fns->listxattr_fn(handle, smb_fname, list, size);
 }
 
 ssize_t smb_vfs_call_flistxattr(struct vfs_handle_struct *handle,
index 0bb2903597284c5301f1f3b2db3c40aa2beb8ea1..7155ac3a170ef58a20399a1e1e9305a3362bd0a6 100644 (file)
@@ -1344,6 +1344,7 @@ static NTSTATUS cmd_listxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
 {
        char *buf, *p;
        ssize_t ret;
+       struct smb_filename *smb_fname = NULL;
 
        if (argc != 2) {
                printf("Usage: listxattr <path>\n");
@@ -1352,7 +1353,14 @@ static NTSTATUS cmd_listxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
 
        buf = NULL;
 
-       ret = SMB_VFS_LISTXATTR(vfs->conn, argv[1], buf, talloc_get_size(buf));
+       smb_fname = synthetic_smb_fname_split(mem_ctx,
+                                       argv[1],
+                                       lp_posix_pathnames());
+       if (smb_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       ret = SMB_VFS_LISTXATTR(vfs->conn, smb_fname,
+                               buf, talloc_get_size(buf));
        if (ret == -1) {
                int err = errno;
                printf("listxattr returned (%s)\n", strerror(err));
@@ -1362,7 +1370,8 @@ static NTSTATUS cmd_listxattr(struct vfs_state *vfs, TALLOC_CTX *mem_ctx,
        if (buf == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
-       ret = SMB_VFS_LISTXATTR(vfs->conn, argv[1], buf, talloc_get_size(buf));
+       ret = SMB_VFS_LISTXATTR(vfs->conn, smb_fname,
+                               buf, talloc_get_size(buf));
        if (ret == -1) {
                int err = errno;
                printf("listxattr returned (%s)\n", strerror(err));