1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

s3: libsmb: In cli_ntrename_internal_send() (SMBntrename) check for DFS dst pathname.

See smbtorture3: SMB1-DFS-PATHS: test_smb1_ntrename_rename().
and smbtorture3: SMB1-DFS-PATHS: test_smb1_ntrename_hardlink().

Remove the old code that stripped a DFS name from the
destination filename, and go through smb1_dfs_share_path()
as we did for fname_src in the last commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Jeremy Allison 2022-09-02 13:18:06 -07:00
parent f1765c9c7b
commit 73a6e2b14a

View File

@ -1567,7 +1567,7 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
uint16_t additional_flags2 = 0;
uint8_t *bytes = NULL;
char *fname_src_cp = NULL;
NTSTATUS status;
char *fname_dst_cp = NULL;
req = tevent_req_create(mem_ctx, &state,
struct cli_ntrename_internal_state);
@ -1575,17 +1575,6 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
return NULL;
}
/*
* Strip a MSDFS path from fname_dst if we were given one.
*/
status = cli_dfs_target_check(state,
cli,
fname_dst,
&fname_dst);
if (tevent_req_nterror(req, status)) {
return tevent_req_post(req, ev);
}
SSVAL(state->vwv+0, 0 ,FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY);
SSVAL(state->vwv+1, 0, rename_flag);
@ -1621,9 +1610,21 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
/*
* SMBntrename on a DFS share uses DFS names for src and dst.
* See smbtorture3: SMB1-DFS-PATHS: test_smb1_ntrename_rename().
* and smbtorture3: SMB1-DFS-PATHS: test_smb1_ntrename_hardlink()
*/
fname_dst_cp = smb1_dfs_share_path(state, cli, fname_dst);
if (tevent_req_nomem(fname_dst_cp, req)) {
return tevent_req_post(req, ev);
}
bytes[talloc_get_size(bytes)-1] = 4;
bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_dst,
strlen(fname_dst)+1, NULL);
bytes = smb_bytes_push_str(bytes,
smbXcli_conn_use_unicode(cli->conn),
fname_dst_cp,
strlen(fname_dst_cp)+1,
NULL);
if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev);
}