From e2efea7d1f2b635057b6a25b1e086645eb2f38be Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 6 Sep 2022 17:26:58 -0700 Subject: [PATCH] s3: libsmb: In cli_unlink_send() (SMBunlink) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_unlink() shows SMBunlink uses DFS paths. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- source3/libsmb/clifile.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index d996c9f6db5..385eacc3052 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -2001,6 +2001,7 @@ struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx, uint8_t additional_flags = 0; uint16_t additional_flags2 = 0; uint8_t *bytes = NULL; + char *fname_cp = NULL; req = tevent_req_create(mem_ctx, &state, struct cli_unlink_state); if (req == NULL) { @@ -2032,9 +2033,19 @@ struct tevent_req *cli_unlink_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } + /* + * SMBunlink on a DFS share must use DFS names. + */ + fname_cp = smb1_dfs_share_path(state, cli, fname); + if (tevent_req_nomem(fname_cp, req)) { + return tevent_req_post(req, ev); + } bytes[0] = 4; - bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname, - strlen(fname)+1, NULL); + bytes = smb_bytes_push_str(bytes, + smbXcli_conn_use_unicode(cli->conn), + fname_cp, + strlen(fname_cp)+1, + NULL); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); -- 2.47.3