]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify smbd_dirptr_8_3_mode_fn()
authorVolker Lendecke <vl@samba.org>
Sat, 11 Nov 2023 18:12:16 +0000 (19:12 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 15 Nov 2023 05:10:35 +0000 (05:10 +0000)
Do the smb1-specific code directly in smb1-code. Don't tunnel it
through generic smb1/smb2 code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb1_reply.c

index addca927c74359d228d53a159872702fc9fba7b0..dc54e1b340ddc5ef4c6908cb89fbb61095440643 100644 (file)
@@ -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;