From: Volker Lendecke Date: Sat, 11 Nov 2023 18:12:16 +0000 (+0100) Subject: smbd: Simplify smbd_dirptr_8_3_mode_fn() X-Git-Tag: talloc-2.4.2~729 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=47f36e0b1df028cf9abf1a88efaf0296c527e18b;p=thirdparty%2Fsamba.git smbd: Simplify smbd_dirptr_8_3_mode_fn() Do the smb1-specific code directly in smb1-code. Don't tunnel it through generic smb1/smb2 code. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/smb1_reply.c b/source3/smbd/smb1_reply.c index addca927c74..dc54e1b340d 100644 --- a/source3/smbd/smb1_reply.c +++ b/source3/smbd/smb1_reply.c @@ -1206,13 +1206,6 @@ static bool smbd_dirptr_8_3_mode_fn(TALLOC_CTX *ctx, bool get_dosmode, uint32_t *_mode) { - if (*_mode & FILE_ATTRIBUTE_REPARSE_POINT) { - /* - * Don't show symlinks/special files to old clients - */ - return false; - } - if (get_dosmode) { SMB_ASSERT(smb_fname != NULL); *_mode = fdos_mode(smb_fname->fsp); @@ -1240,6 +1233,7 @@ static bool get_dir_entry(TALLOC_CTX *ctx, uint32_t mode = 0; bool ok; +again: ok = smbd_dirptr_get_entry(ctx, dirptr, mask, @@ -1256,6 +1250,12 @@ static bool get_dir_entry(TALLOC_CTX *ctx, if (!ok) { return false; } + if (mode & FILE_ATTRIBUTE_REPARSE_POINT) { + /* hide reparse points from ancient clients */ + TALLOC_FREE(fname); + TALLOC_FREE(smb_fname); + goto again; + } *_fname = talloc_move(ctx, &fname); *_size = smb_fname->st.st_ex_size;