struct ea_list *ea_list);
unsigned char *create_volume_objectid(connection_struct *conn, unsigned char objid[16]);
NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
- connection_struct *conn,
- struct smb_request *req,
- bool overwrite_if_exists,
- const struct smb_filename *smb_fname_old,
- struct smb_filename *smb_fname_new);
+ connection_struct *conn,
+ struct smb_request *req,
+ bool overwrite_if_exists,
+ const struct smb_filename *smb_fname_old,
+ struct files_struct *dirfsp_new,
+ struct smb_filename *smb_fname_new,
+ struct smb_filename *smb_fname_new_rel);
NTSTATUS smb_set_file_time(connection_struct *conn,
files_struct *fsp,
struct smb_filename *smb_fname,
struct smb_filename *smb_fname_old = NULL;
struct files_struct *dst_dirfsp = NULL;
struct smb_filename *smb_fname_new = NULL;
+ struct smb_filename *smb_fname_new_rel = NULL;
char *oldname = NULL;
char *newname = NULL;
const char *p;
reply_nterror(req, status);
goto out;
}
- status = filename_convert_dirfsp(ctx,
- conn,
- newname,
- ucf_flags_dst,
- dst_twrp,
- &dst_dirfsp,
- &smb_fname_new);
+ status = filename_convert_dirfsp_rel(ctx,
+ conn,
+ conn->cwd_fsp,
+ newname,
+ ucf_flags_dst,
+ dst_twrp,
+ &dst_dirfsp,
+ &smb_fname_new,
+ &smb_fname_new_rel);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
NT_STATUS_PATH_NOT_COVERED)) {
req,
false,
smb_fname_old,
- smb_fname_new);
+ dst_dirfsp,
+ smb_fname_new,
+ smb_fname_new_rel);
break;
case RENAME_FLAG_COPY:
status = copy_internals(ctx,
****************************************************************************/
NTSTATUS hardlink_internals(TALLOC_CTX *ctx,
- connection_struct *conn,
- struct smb_request *req,
- bool overwrite_if_exists,
- const struct smb_filename *smb_fname_old,
- struct smb_filename *smb_fname_new)
+ connection_struct *conn,
+ struct smb_request *req,
+ bool overwrite_if_exists,
+ const struct smb_filename *smb_fname_old,
+ 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;
- struct smb_filename *parent_fname_new = NULL;
- struct smb_filename *base_name_new = NULL;
/* source must already exist. */
if (!VALID_STAT(smb_fname_old->st)) {
goto out;
}
- status = parent_pathref(talloc_tos(),
- conn->cwd_fsp,
- smb_fname_new,
- &parent_fname_new,
- &base_name_new);
- 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,
- parent_fname_new->fsp,
- base_name_new,
- 0);
+ parent_fname_old->fsp,
+ base_name_old,
+ dirfsp_new,
+ smb_fname_new_rel,
+ 0);
if (ret != 0) {
status = map_nt_error_from_unix(errno);
out:
TALLOC_FREE(parent_fname_old);
- TALLOC_FREE(parent_fname_new);
return status;
}
char *newname = NULL;
struct files_struct *dst_dirfsp = NULL;
struct smb_filename *smb_fname_dst = NULL;
+ struct smb_filename *smb_fname_dst_rel = NULL;
NTSTATUS status = NT_STATUS_OK;
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
size_t ret;
DBG_DEBUG("got name |%s|\n", newname);
- status = filename_convert_dirfsp(ctx,
- conn,
- newname,
- ucf_flags,
- 0, /* No TWRP. */
- &dst_dirfsp,
- &smb_fname_dst);
+ status = filename_convert_dirfsp_rel(ctx,
+ conn,
+ conn->cwd_fsp,
+ newname,
+ ucf_flags,
+ 0, /* No TWRP. */
+ &dst_dirfsp,
+ &smb_fname_dst,
+ &smb_fname_dst_rel);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
smb_fname_str_dbg(smb_fname_dst));
status = hardlink_internals(ctx,
- conn,
- req,
- overwrite,
- fsp->fsp_name,
- smb_fname_dst);
+ conn,
+ req,
+ overwrite,
+ fsp->fsp_name,
+ dst_dirfsp,
+ smb_fname_dst,
+ smb_fname_dst_rel);
TALLOC_FREE(smb_fname_dst);
return status;
char *newname = NULL;
struct files_struct *dst_dirfsp = NULL;
struct smb_filename *smb_fname_dst = NULL;
+ struct smb_filename *smb_fname_dst_rel = NULL;
NTSTATUS status = NT_STATUS_OK;
uint32_t ucf_flags = ucf_flags_from_smb_request(req);
NTTIME dst_twrp = 0;
/* hardlink paths are never DFS. */
ucf_flags &= ~UCF_DFS_PATHNAME;
- status = filename_convert_dirfsp(ctx,
- conn,
- newname,
- ucf_flags,
- dst_twrp,
- &dst_dirfsp,
- &smb_fname_dst);
+ status = filename_convert_dirfsp_rel(ctx,
+ conn,
+ conn->cwd_fsp,
+ newname,
+ ucf_flags,
+ dst_twrp,
+ &dst_dirfsp,
+ &smb_fname_dst,
+ &smb_fname_dst_rel);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
smb_fname_str_dbg(smb_fname_dst));
status = hardlink_internals(ctx,
- conn,
- req,
- overwrite,
- fsp->fsp_name,
- smb_fname_dst);
+ conn,
+ req,
+ overwrite,
+ fsp->fsp_name,
+ dst_dirfsp,
+ smb_fname_dst,
+ smb_fname_dst_rel);
TALLOC_FREE(smb_fname_dst);
return status;