From ee653577630d4f68f82fa93c03e0a33b7b6ccdc1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 8 May 2024 16:03:29 +0200 Subject: [PATCH] smbd: Return reparse tag as of MS-FSCC 2.4.6 Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- selftest/knownfail.d/reparse | 1 - source3/smbd/smb2_trans2.c | 22 ++++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/selftest/knownfail.d/reparse b/selftest/knownfail.d/reparse index 7cc4cab7569..11d094aa5c6 100644 --- a/selftest/knownfail.d/reparse +++ b/selftest/knownfail.d/reparse @@ -1,3 +1,2 @@ ^samba.tests.reparsepoints.samba.tests.reparsepoints.ReparsePoints.test_create_reparse_directory ^samba.tests.reparsepoints.samba.tests.reparsepoints.ReparsePoints.test_create_reparse_nonempty_directory -^samba.tests.reparsepoints.samba.tests.reparsepoints.ReparsePoints.test_query_reparse_tag diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c index fe1af381226..09cd7594465 100644 --- a/source3/smbd/smb2_trans2.c +++ b/source3/smbd/smb2_trans2.c @@ -48,6 +48,7 @@ #include "source3/lib/substitute.h" #include "source3/lib/adouble.h" #include "source3/smbd/dir.h" +#include "source3/modules/util_reparse.h" #define DIR_ENTRY_SAFETY_MARGIN 4096 @@ -3676,14 +3677,27 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, *fixed_portion = 56; break; - case SMB_FILE_ATTRIBUTE_TAG_INFORMATION: + case SMB_FILE_ATTRIBUTE_TAG_INFORMATION: { + uint32_t tag = 0; + uint8_t *data = NULL; + uint32_t datalen; + DBG_DEBUG("SMB_FILE_ATTRIBUTE_TAG_INFORMATION\n"); - SIVAL(pdata,0,mode); - SIVAL(pdata,4,0); + + (void)fsctl_get_reparse_point(fsp, + talloc_tos(), + &tag, + &data, + UINT32_MAX, + &datalen); + TALLOC_FREE(data); + + SIVAL(pdata, 0, mode); + SIVAL(pdata, 4, tag); data_size = 8; *fixed_portion = 8; break; - + } /* * SMB2 UNIX Extensions. */