connection_struct *conn,
struct smb_request *req,
bool overwrite_if_exists,
+ struct files_struct *dirfsp_old,
const struct smb_filename *smb_fname_old,
+ struct smb_filename *smb_fname_old_rel,
struct files_struct *dirfsp_new,
struct smb_filename *smb_fname_new,
struct smb_filename *smb_fname_new_rel);
connection_struct *conn = req->conn;
struct files_struct *src_dirfsp = NULL;
struct smb_filename *smb_fname_old = NULL;
+ struct smb_filename *smb_fname_old_rel = NULL;
struct files_struct *dst_dirfsp = NULL;
struct smb_filename *smb_fname_new = NULL;
struct smb_filename *smb_fname_new_rel = NULL;
goto out;
}
- status = filename_convert_dirfsp(ctx,
- conn,
- oldname,
- ucf_flags_src,
- src_twrp,
- &src_dirfsp,
- &smb_fname_old);
+ status = filename_convert_dirfsp_rel(ctx,
+ conn,
+ conn->cwd_fsp,
+ oldname,
+ ucf_flags_src,
+ src_twrp,
+ &src_dirfsp,
+ &smb_fname_old,
+ &smb_fname_old_rel);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
NT_STATUS_PATH_NOT_COVERED)) {
conn,
req,
false,
+ src_dirfsp,
smb_fname_old,
+ smb_fname_old_rel,
dst_dirfsp,
smb_fname_new,
smb_fname_new_rel);
char *oldname = NULL;
struct files_struct *src_dirfsp = NULL;
struct smb_filename *smb_fname_old = NULL;
+ struct smb_filename *smb_fname_old_rel = NULL;
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
NTTIME old_twrp = 0;
TALLOC_CTX *ctx = talloc_tos();
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- status = filename_convert_dirfsp(ctx,
- conn,
- oldname,
- ucf_flags,
- old_twrp,
- &src_dirfsp,
- &smb_fname_old);
+ status = filename_convert_dirfsp_rel(ctx,
+ conn,
+ conn->cwd_fsp,
+ oldname,
+ ucf_flags,
+ old_twrp,
+ &src_dirfsp,
+ &smb_fname_old,
+ &smb_fname_old_rel);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
conn,
req,
false,
+ src_dirfsp,
smb_fname_old,
+ smb_fname_old_rel,
dirfsp_new,
smb_fname_new,
smb_fname_new_rel);
connection_struct *conn,
struct smb_request *req,
bool overwrite_if_exists,
+ struct files_struct *dirfsp_old,
const struct smb_filename *smb_fname_old,
+ struct smb_filename *smb_fname_old_rel,
struct files_struct *dirfsp_new,
struct smb_filename *smb_fname_new,
struct smb_filename *smb_fname_new_rel)
NTSTATUS status = NT_STATUS_OK;
int ret;
bool ok;
- struct smb_filename *parent_fname_old = NULL;
- struct smb_filename *base_name_old = NULL;
/* source must already exist. */
if (!VALID_STAT(smb_fname_old->st)) {
goto out;
}
- status = parent_pathref(talloc_tos(),
- conn->cwd_fsp,
- smb_fname_old,
- &parent_fname_old,
- &base_name_old);
- if (!NT_STATUS_IS_OK(status)) {
- goto out;
- }
-
if (VALID_STAT(smb_fname_new->st)) {
if (overwrite_if_exists) {
if (S_ISDIR(smb_fname_new->st.st_ex_mode)) {
smb_fname_new->base_name);
ret = SMB_VFS_LINKAT(conn,
- parent_fname_old->fsp,
- base_name_old,
+ dirfsp_old,
+ smb_fname_old_rel,
dirfsp_new,
smb_fname_new_rel,
0);
fsp_get_smb2_lease(smb_fname_old->fsp));
out:
-
- TALLOC_FREE(parent_fname_old);
return status;
}
bool overwrite;
uint32_t len;
char *newname = NULL;
+ struct smb_filename *src_parent = NULL;
+ struct smb_filename *smb_fname_src_rel = NULL;
struct files_struct *dst_dirfsp = NULL;
struct smb_filename *smb_fname_dst = NULL;
struct smb_filename *smb_fname_dst_rel = NULL;
return NT_STATUS_NOT_SUPPORTED;
}
+ status = parent_pathref(ctx,
+ conn->cwd_fsp,
+ fsp->fsp_name,
+ &src_parent,
+ &smb_fname_src_rel);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
DBG_DEBUG("SMB_FILE_LINK_INFORMATION (%s) %s -> %s\n",
fsp_fnum_dbg(fsp),
fsp_str_dbg(fsp),
conn,
req,
overwrite,
+ src_parent->fsp,
fsp->fsp_name,
+ smb_fname_src_rel,
dst_dirfsp,
smb_fname_dst,
smb_fname_dst_rel);