From b58cee42512320f3b5ee1b6f4ae41eaf597690ef Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 7 Sep 2022 12:52:42 -0700 Subject: [PATCH] s3: libsmb: In cli_openx_create() (SMBopenX) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_openx() shows SMBopenX 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 54ca9e7a282..b9e5b39525c 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -3097,6 +3097,7 @@ struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx, uint8_t additional_flags; uint16_t additional_flags2 = 0; uint8_t *bytes; + char *fname_cp = NULL; req = tevent_req_create(mem_ctx, &state, struct cli_openx_state); if (req == NULL) { @@ -3159,8 +3160,18 @@ struct tevent_req *cli_openx_create(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } - bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname, - strlen(fname)+1, NULL); + /* + * SMBopenX 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 = 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.11.4.GIT