From 47cf519e98f937cf21cc3c8c62e38efa7010f091 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 7 Sep 2022 10:45:01 -0700 Subject: [PATCH] s3: libsmb: In cli_mkdir_send() (SMBmkdir) check for DFS pathname. smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_mkdir() shows SMBmkdir 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 385eacc3052..e118de01e54 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -2145,6 +2145,7 @@ struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx, uint8_t additional_flags = 0; uint16_t additional_flags2 = 0; uint8_t *bytes = NULL; + char *dname_cp = NULL; req = tevent_req_create(mem_ctx, &state, struct cli_mkdir_state); if (req == NULL) { @@ -2164,9 +2165,19 @@ struct tevent_req *cli_mkdir_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } + /* + * SMBmkdir on a DFS share must use DFS names. + */ + dname_cp = smb1_dfs_share_path(state, cli, dname); + if (tevent_req_nomem(dname_cp, req)) { + return tevent_req_post(req, ev); + } bytes[0] = 4; - bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), dname, - strlen(dname)+1, NULL); + bytes = smb_bytes_push_str(bytes, + smbXcli_conn_use_unicode(cli->conn), + dname_cp, + strlen(dname_cp)+1, + NULL); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev);