summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_cap.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-05-25 12:41:31 -0700
committerJeremy Allison <jra@samba.org>2017-05-31 22:50:22 +0200
commit48956fa4d3b37105ad3e8e742c21b5583d79db11 (patch)
tree0c90dd34b5be384c8791df622bf490fc065dd192 /source3/modules/vfs_cap.c
parent12b801d9d7856f1bb50619962f7e9cb94e75087f (diff)
downloadsamba-48956fa4d3b37105ad3e8e742c21b5583d79db11.tar.gz
s3: VFS: Change SMB_VFS_SETXATTR to use const struct smb_filename * instead of const char *.
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>
Diffstat (limited to 'source3/modules/vfs_cap.c')
-rw-r--r--source3/modules/vfs_cap.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index fe70d781d07..62d40b5da10 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -760,16 +760,46 @@ static int cap_fremovexattr(vfs_handle_struct *handle, struct files_struct *fsp,
return SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, cappath);
}
-static int cap_setxattr(vfs_handle_struct *handle, const char *path, const char *name, const void *value, size_t size, int flags)
+static int cap_setxattr(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ const char *name,
+ const void *value,
+ size_t size,
+ int flags)
{
- char *cappath = capencode(talloc_tos(), path);
+ struct smb_filename *cap_smb_fname = NULL;
+ char *cappath = capencode(talloc_tos(), smb_fname->base_name);
char *capname = capencode(talloc_tos(), name);
+ int ret;
+ int saved_errno = 0;
if (!cappath || !capname) {
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_SETXATTR(handle, cappath, capname, value, size, flags);
+ cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ cappath,
+ NULL,
+ NULL,
+ smb_fname->flags);
+ if (cap_smb_fname == NULL) {
+ TALLOC_FREE(cappath);
+ TALLOC_FREE(capname);
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_SETXATTR(handle, cap_smb_fname,
+ capname, value, size, flags);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(cappath);
+ TALLOC_FREE(capname);
+ TALLOC_FREE(cap_smb_fname);
+ if (saved_errno) {
+ errno = saved_errno;
+ }
+ return ret;
}
static int cap_fsetxattr(vfs_handle_struct *handle, struct files_struct *fsp, const char *path, const void *value, size_t size, int flags)