summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_cap.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-06-07 15:03:37 -0700
committerJeremy Allison <jra@samba.org>2017-06-18 02:49:25 +0200
commit6ae2d86b9ccc0ebe73dc911a1d5f06bd53613acf (patch)
tree5b46b8fc5f2c144c0d65b3278ffd9da0c2acdb67 /source3/modules/vfs_cap.c
parent4ad426a7c6c9fffa41df5bcafd9f420c257b6805 (diff)
downloadsamba-6ae2d86b9ccc0ebe73dc911a1d5f06bd53613acf.tar.gz
s3: VFS: Change SMB_VFS_READLINK 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: Richard Sharpe <realrichardsharpe@gmail.com>
Diffstat (limited to 'source3/modules/vfs_cap.c')
-rw-r--r--source3/modules/vfs_cap.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 7e89c0917f6..2c21ab18c48 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -492,16 +492,40 @@ static int cap_symlink(vfs_handle_struct *handle, const char *oldpath,
return SMB_VFS_NEXT_SYMLINK(handle, capold, capnew);
}
-static int cap_readlink(vfs_handle_struct *handle, const char *path,
- char *buf, size_t bufsiz)
+static int cap_readlink(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname,
+ char *buf,
+ size_t bufsiz)
{
- char *cappath = capencode(talloc_tos(), path);
+ char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+ struct smb_filename *cap_smb_fname = NULL;
+ int saved_errno = 0;
+ int ret;
if (!cappath) {
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_READLINK(handle, cappath, buf, bufsiz);
+ 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_READLINK(handle, cap_smb_fname, buf, bufsiz);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(cappath);
+ TALLOC_FREE(cap_smb_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
+ return ret;
}
static int cap_link(vfs_handle_struct *handle,