}
static int skel_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
}
static int skel_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
* changed to bitfields.
* Version 43 - convert SMB_VFS_GET_REAL_FILENAME() arg path
* to be a struct smb_filename
+ * Version 43 - convert link_contents arg of SMB_VFS_SYMLINKAT()
+ * to struct smb_filename
*/
#define SMB_VFS_INTERFACE_VERSION 43
int (*linux_setlease_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype);
bool (*getlock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid);
int (*symlinkat_fn)(struct vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname);
int (*readlinkat_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp, off_t *poffset,
off_t *pcount, int *ptype, pid_t *ppid);
int smb_vfs_call_symlinkat(struct vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname);
int smb_vfs_call_readlinkat(struct vfs_handle_struct *handle,
off_t *poffset, off_t *pcount, int *ptype,
pid_t *ppid);
int vfs_not_implemented_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname);
int vfs_not_implemented_vfs_readlinkat(vfs_handle_struct *handle,
}
static int cap_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
- char *capold = capencode(talloc_tos(), link_contents);
+ char *capold = capencode(talloc_tos(), link_contents->base_name);
char *capnew = capencode(talloc_tos(), new_smb_fname->base_name);
+ struct smb_filename *new_link_target = NULL;
struct smb_filename *new_cap_smb_fname = NULL;
int saved_errno = 0;
int ret;
errno = ENOMEM;
return -1;
}
+
+ new_link_target = synthetic_smb_fname(talloc_tos(),
+ capold,
+ NULL,
+ NULL,
+ new_smb_fname->twrp,
+ new_smb_fname->flags);
+ if (new_link_target == NULL) {
+ TALLOC_FREE(capold);
+ TALLOC_FREE(capnew);
+ errno = ENOMEM;
+ return -1;
+ }
+
new_cap_smb_fname = synthetic_smb_fname(talloc_tos(),
capnew,
NULL,
if (new_cap_smb_fname == NULL) {
TALLOC_FREE(capold);
TALLOC_FREE(capnew);
+ TALLOC_FREE(new_link_target);
errno = ENOMEM;
return -1;
}
ret = SMB_VFS_NEXT_SYMLINKAT(handle,
- capold,
+ new_link_target,
dirfsp,
new_cap_smb_fname);
if (ret == -1) {
}
TALLOC_FREE(capold);
TALLOC_FREE(capnew);
+ TALLOC_FREE(new_link_target);
TALLOC_FREE(new_cap_smb_fname);
if (saved_errno != 0) {
errno = saved_errno;
}
static int cephwrap_symlinkat(struct vfs_handle_struct *handle,
- const char *link_target,
+ const struct smb_filename *link_target,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
int result = -1;
DBG_DEBUG("[CEPH] symlink(%p, %s, %s)\n", handle,
- link_target,
+ link_target->base_name,
new_smb_fname->base_name);
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
result = ceph_symlink(handle->data,
- link_target,
+ link_target->base_name,
new_smb_fname->base_name);
DBG_DEBUG("[CEPH] symlink(...) = %d\n", result);
WRAP_RETURN(result);
/* block links from writeable shares to snapshots for now, like other modules */
static int ceph_snap_gmt_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
time_t timestamp_new = 0;
ret = ceph_snap_gmt_strip_snapshot(handle,
- link_contents,
+ link_contents->base_name,
×tamp_old,
NULL, 0);
if (ret < 0) {
}
static int vfswrap_symlinkat(vfs_handle_struct *handle,
- const char *link_target,
+ const struct smb_filename *link_target,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
- result = symlinkat(link_target,
+ result = symlinkat(link_target->base_name,
dirfsp->fh->fd,
new_smb_fname->base_name);
END_PROFILE(syscall_symlinkat);
}
static int smb_full_audit_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
(result >= 0),
handle,
"%s|%s",
- link_contents,
+ link_contents->base_name,
smb_fname_str_do_log(handle->conn, new_smb_fname));
return result;
}
static int vfs_gluster_symlinkat(struct vfs_handle_struct *handle,
- const char *link_target,
+ const struct smb_filename *link_target,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
START_PROFILE(syscall_symlinkat);
SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
ret = glfs_symlink(handle->data,
- link_target,
+ link_target->base_name,
new_smb_fname->base_name);
END_PROFILE(syscall_symlinkat);
*/
static int mh_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
int status = -1;
- char *client_link_contents = NULL;
+ struct smb_filename *new_link_target = NULL;
struct smb_filename *newclientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering mh_symlinkat\n"));
- if (!is_in_media_files(link_contents) &&
+ if (!is_in_media_files(link_contents->base_name) &&
!is_in_media_files(new_smb_fname->base_name)) {
status = SMB_VFS_NEXT_SYMLINKAT(handle,
link_contents,
goto out;
}
- if ((status = alloc_get_client_path(handle, talloc_tos(),
+ if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
link_contents,
- &client_link_contents))) {
+ &new_link_target))) {
goto err;
}
if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
}
status = SMB_VFS_NEXT_SYMLINKAT(handle,
- client_link_contents,
+ new_link_target,
dirfsp,
newclientFname);
err:
- TALLOC_FREE(client_link_contents);
+ TALLOC_FREE(new_link_target);
TALLOC_FREE(newclientFname);
out:
return status;
}
int vfs_not_implemented_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
}
static int shadow_copy2_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
if (!shadow_copy2_strip_snapshot_internal(talloc_tos(),
handle,
- link_contents,
+ link_contents->base_name,
×tamp_old,
NULL,
&snappath_old,
}
static int snapper_gmt_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
if (!snapper_gmt_strip_snapshot(talloc_tos(),
handle,
- link_contents,
+ link_contents->base_name,
×tamp_old,
NULL)) {
return -1;
} while (0)
static int syncops_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
new_smb_fname);
if (ret == 0 && config->onmeta && !config->disable) {
- syncops_two_names(link_contents,
+ syncops_two_names(link_contents->base_name,
new_smb_fname->base_name);
}
return ret;
}
static int smb_time_audit_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
}
static int um_symlinkat(vfs_handle_struct *handle,
- const char *link_contents,
+ const struct smb_filename *link_contents,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
int status;
- char *client_link_contents = NULL;
+ struct smb_filename *new_link_target = NULL;
struct smb_filename *new_client_fname = NULL;
DEBUG(10, ("Entering um_symlinkat\n"));
- if (!is_in_media_files(link_contents) &&
+ if (!is_in_media_files(link_contents->base_name) &&
!is_in_media_files(new_smb_fname->base_name)) {
return SMB_VFS_NEXT_SYMLINKAT(handle,
link_contents,
new_smb_fname);
}
- status = alloc_get_client_path(handle, talloc_tos(),
- link_contents, &client_link_contents);
+ status = alloc_get_client_smb_fname(handle, talloc_tos(),
+ link_contents, &new_link_target);
if (status != 0) {
goto err;
}
}
status = SMB_VFS_NEXT_SYMLINKAT(handle,
- client_link_contents,
+ new_link_target,
dirfsp,
new_client_fname);
err:
- TALLOC_FREE(client_link_contents);
+ TALLOC_FREE(new_link_target);
TALLOC_FREE(new_client_fname);
return status;
}
new_smb_fname->base_name, link_target ));
ret = SMB_VFS_SYMLINKAT(conn,
- target_fname.base_name,
+ &target_fname,
conn->cwd_fsp,
new_smb_fname);
if (ret != 0) {
}
int smb_vfs_call_symlinkat(struct vfs_handle_struct *handle,
- const char *link_target,
+ const struct smb_filename *link_target,
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
}
ret = SMB_VFS_SYMLINKAT(vfs->conn,
- target_fname.base_name,
+ &target_fname,
vfs->conn->cwd_fsp,
new_smb_fname);
if (ret == -1) {