From e188b74aa9bea5ab443d7c96d9b108c1268aa52e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 28 Sep 2020 20:10:32 -0700 Subject: [PATCH] s3: smbd: SMB1 Remove the crazy semantics in filename_convert_internal() using UCF_COND_ALLOW_WCARD_LCOMP. In the places where wildcards are allowed in SMB1 we always pass in UCF_ALWAYS_ALLOW_WCARD_LCOMP. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/filename.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 73ea63ffd25..f7c49cc907f 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -487,8 +487,8 @@ Note NT_STATUS_OK doesn't mean the name exists or is valid, just that we didn't get any fatal errors that should immediately terminate the calling SMB processing whilst resolving. -If UCF_ALWAYS_ALLOW_WCARD_LCOMP is passed in, then a MS wildcard was detected -and should be allowed in the last component of the path only. +If UCF_ALWAYS_ALLOW_WCARD_LCOMP is passed in, then a MS wildcard +should be allowed in the last component of the path only. If the orig_path was a stream, smb_filename->base_name will point to the base filename, and smb_filename->stream_name will point to the stream name. If @@ -1901,9 +1901,6 @@ char *get_original_lcomp(TALLOC_CTX *ctx, * @param smbreq SMB request if we're using privileges. * @param name_in The unconverted name. * @param ucf_flags flags to pass through to unix_convert(). - * UCF_ALWAYS_ALLOW_WCARD_LCOMP will be OR'd in if - * p_cont_wcard != NULL and is true and - * UCF_COND_ALLOW_WCARD_LCOMP. * @param twrp Optional VSS time * @param p_cont_wcard If not NULL, will be set to true if the dfs path * resolution detects a wildcard. @@ -1962,15 +1959,6 @@ static NTSTATUS filename_convert_internal(TALLOC_CTX *ctx, return NT_STATUS_OK; } - /* - * If the caller conditionally allows wildcard lookups, only add the - * always allow if the path actually does contain a wildcard. - */ - if (ucf_flags & UCF_COND_ALLOW_WCARD_LCOMP && - ppath_contains_wcard != NULL && *ppath_contains_wcard) { - ucf_flags |= UCF_ALWAYS_ALLOW_WCARD_LCOMP; - } - status = unix_convert(ctx, conn, name_in, twrp, &smb_fname, ucf_flags); if (!NT_STATUS_IS_OK(status)) { DEBUG(10,("filename_convert_internal: unix_convert failed " -- 2.47.3