From 5f0efdfe3cb3b267f09677659bd0149975382356 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 10 Aug 2022 21:49:51 -0700 Subject: [PATCH] s3: smbd: Now parse_dfs_path() is only called from dfs_filename_convert() replace allow_broken_path with an SMB1 check. dfs_filename_convert() always sets allow_broken_path = !smb2, so just move this bool inside of parse_dfs_path(). We can now remove allow_broken_path. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/msdfs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index a79bcff5197..988f6ee7ed5 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -253,6 +253,7 @@ static NTSTATUS parse_dfs_path(TALLOC_CTX *ctx, char *reqpath = NULL; char *eos_ptr = NULL; bool servicename_matches = false; + bool using_smb1 = !conn->sconn->using_smb2; pathname_local = talloc_strdup(ctx, pathname); if (pathname_local == NULL) { @@ -271,11 +272,16 @@ static NTSTATUS parse_dfs_path(TALLOC_CTX *ctx, p = pathname_local; /* - * Non-broken DFS paths *must* start with the - * path separator '/'. + * SMB1 DFS paths sent to the fileserver should start with + * the path separator '/'. However, libsmbclient libraries + * will set the DFS bit on SMB1 calls and then send non-DFS + * paths. We must cope with this. + * + * Note SMB2 paths sent to the fileserver never start with + * the path separator '/'. */ - if (allow_broken_path && (*p != '/')) { + if (using_smb1 && (*p != '/')) { DBG_ERR("path %s doesn't start with /\n", p); /* * Possibly client sent a local path by mistake. -- 2.47.3