diff options
author | Jeremy Allison <jra@samba.org> | 2022-09-02 12:40:19 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2022-09-15 18:43:32 +0000 |
commit | 44bf2bc89a47ead4c7efb77ffa34017dfb9220dc (patch) | |
tree | 94000be854c615edf9b8295f26db537b9e0263d2 /source3/libsmb/clifile.c | |
parent | 4da3c724d5b3a60cd4af83b0a301b96a0d2ee945 (diff) | |
download | samba-44bf2bc89a47ead4c7efb77ffa34017dfb9220dc.tar.gz |
s3: libsmb: In cli_cifs_rename_send() (SMBmv) check for DFS dst pathname.
See smbtorture3: SMB1-DFS-PATHS: test_smb1_mv().
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>
Diffstat (limited to 'source3/libsmb/clifile.c')
-rw-r--r-- | source3/libsmb/clifile.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index b07e9457a59..47d71af71da 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1333,7 +1333,7 @@ static struct tevent_req *cli_cifs_rename_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_cifs_rename_state); if (req == NULL) { @@ -1348,17 +1348,6 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - /* - * 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); bytes = talloc_array(state, uint8_t, 1); @@ -1395,9 +1384,21 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } + /* + * SMBmv on a DFS share uses DFS names for src and dst. + * See smbtorture3: SMB1-DFS-PATHS: test_smb1_mv(). + */ + + 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); } |