From: Jeremy Allison Date: Thu, 8 Sep 2022 19:25:49 +0000 (-0700) Subject: s3: libsmb: In cli_chkpath_send() (SMBcheckpath) check for DFS pathname. X-Git-Tag: talloc-2.4.0~1009 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a82167f11fa499bac6176a5dfd2f9a423721058;p=thirdparty%2Fsamba.git s3: libsmb: In cli_chkpath_send() (SMBcheckpath) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_chkpath() shows SMBcheckpath uses DFS paths. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 34c3dcaa861..51d6f35a12f 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -4823,6 +4823,7 @@ struct tevent_req *cli_chkpath_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_chkpath_state); if (req == NULL) { @@ -4858,9 +4859,19 @@ struct tevent_req *cli_chkpath_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } + /* + * SMBcheckpath 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);