From b4455f04879d39aefc4d4e39e6611c54be00e62d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 9 Sep 2022 10:29:30 -0700 Subject: [PATCH] s3: libsmb: In cli_posix_open_internal_send() (SMBtrans2:TRANSACT2_SETPATHINFO) check for DFS pathname. See smbtorture3: SMB1-DFS-PATHS: test_smb1_setpathinfo_XXXX() Signed-off-by: Jeremy Allison Reviewed-by: Noel Power Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Sep 15 19:44:00 UTC 2022 on sn-devel-184 --- source3/libsmb/clifile.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index deb7bd222a3..1d1e6f03337 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -5794,6 +5794,7 @@ static struct tevent_req *cli_posix_open_internal_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req = NULL, *subreq = NULL; struct cli_posix_open_internal_state *state = NULL; + char *fname_cp = NULL; req = tevent_req_create( mem_ctx, &state, struct cli_posix_open_internal_state); @@ -5811,11 +5812,18 @@ static struct tevent_req *cli_posix_open_internal_send(TALLOC_CTX *mem_ctx, } SSVAL(state->param, 0, SMB_POSIX_PATH_OPEN); + /* + * TRANSACT2_SETPATHINFO 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); + } state->param = trans2_bytes_push_str( state->param, smbXcli_conn_use_unicode(cli->conn), - fname, - strlen(fname)+1, + fname_cp, + strlen(fname_cp)+1, NULL); if (tevent_req_nomem(state->param, req)) { -- 2.47.3