From ab1257226420c98621aec4fa0737882ae0291c94 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 7 Sep 2022 12:05:53 -0700 Subject: [PATCH] s3: libsmb: In cli_nttrans_create_send() (SMBnttrans:NT_TRANSACT_CREATE) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_nttrans_create() shows SMBnttrans:NT_TRANSACT_CREATE uses DFS paths. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- source3/libsmb/clifile.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index a657ed5e858..54ca9e7a282 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -2887,6 +2887,7 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx, NTSTATUS status; size_t converted_len; uint16_t additional_flags2 = 0; + char *fname_cp = NULL; req = tevent_req_create(mem_ctx, &state, struct cli_nttrans_create_state); @@ -2920,8 +2921,17 @@ struct tevent_req *cli_nttrans_create_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn), - fname, strlen(fname), + /* + * SMBntcreateX 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); + } + param = trans2_bytes_push_str(param, + smbXcli_conn_use_unicode(cli->conn), + fname_cp, + strlen(fname_cp), &converted_len); if (tevent_req_nomem(param, req)) { return tevent_req_post(req, ev);