summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_cap.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-06-02 14:21:54 -0700
committerJeremy Allison <jra@samba.org>2017-06-18 02:49:25 +0200
commitfc92d451cf3162807e2493c62fa7617863adf2ba (patch)
treefe8a0bd156eb1fc5f5337212fd6ff6b7df1af0e6 /source3/modules/vfs_cap.c
parent0da76414fdc6a0aacea6282a76b384a702615408 (diff)
downloadsamba-fc92d451cf3162807e2493c62fa7617863adf2ba.tar.gz
s3: VFS: Change SMB_VFS_LINK 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.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index cfb02cbdf62..7e89c0917f6 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -504,16 +504,56 @@ static int cap_readlink(vfs_handle_struct *handle, const char *path,
return SMB_VFS_NEXT_READLINK(handle, cappath, buf, bufsiz);
}
-static int cap_link(vfs_handle_struct *handle, const char *oldpath, const char *newpath)
+static int cap_link(vfs_handle_struct *handle,
+ const struct smb_filename *old_smb_fname,
+ const struct smb_filename *new_smb_fname)
{
- char *capold = capencode(talloc_tos(), oldpath);
- char *capnew = capencode(talloc_tos(), newpath);
+ char *capold = capencode(talloc_tos(), old_smb_fname->base_name);
+ char *capnew = capencode(talloc_tos(), new_smb_fname->base_name);
+ struct smb_filename *old_cap_smb_fname = NULL;
+ struct smb_filename *new_cap_smb_fname = NULL;
+ int saved_errno = 0;
+ int ret;
if (!capold || !capnew) {
errno = ENOMEM;
return -1;
}
- return SMB_VFS_NEXT_LINK(handle, capold, capnew);
+ old_cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ capold,
+ NULL,
+ NULL,
+ old_smb_fname->flags);
+ if (old_cap_smb_fname == NULL) {
+ TALLOC_FREE(capold);
+ TALLOC_FREE(capnew);
+ errno = ENOMEM;
+ return -1;
+ }
+ new_cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+ capnew,
+ NULL,
+ NULL,
+ new_smb_fname->flags);
+ if (new_cap_smb_fname == NULL) {
+ TALLOC_FREE(capold);
+ TALLOC_FREE(capnew);
+ TALLOC_FREE(old_cap_smb_fname);
+ errno = ENOMEM;
+ return -1;
+ }
+ ret = SMB_VFS_NEXT_LINK(handle, old_cap_smb_fname, new_cap_smb_fname);
+ if (ret == -1) {
+ saved_errno = errno;
+ }
+ TALLOC_FREE(capold);
+ TALLOC_FREE(capnew);
+ TALLOC_FREE(old_cap_smb_fname);
+ TALLOC_FREE(new_cap_smb_fname);
+ if (saved_errno != 0) {
+ errno = saved_errno;
+ }
+ return ret;
}
static int cap_mknod(vfs_handle_struct *handle,