This will be used in the future to also open symlinks as reparse
points, so this won't be specific to only SMB1 posix extensions.
I have tried to avoid additional flags for several weeks by making
openat_pathref_fsp or other flavors of this to always open fsp's with
symlink O_PATH opens, because I think NT_STATUS_OBJECT_NAME_NOT_FOUND
with a valid stat is a really bad and racy way to express that we just
hit a symlink, but I miserably failed. Adding additional flags (another one
will follow) is wrong, but I don't see another way right now.
Signed-off-by: Volker Lendecke <vl@samba.org>
if (req->posix_pathnames) {
ucf_flags |= UCF_POSIX_PATHNAMES;
+
+ if (!req->sconn->using_smb2) {
+ ucf_flags |= UCF_LCOMP_LNK_OK;
+ }
}
if (req->flags2 & FLAGS2_DFS_PATHNAMES) {
ucf_flags |= UCF_DFS_PATHNAME;
* In SMB1 posix mode, if this is a symlink,
* allow access to the name with a NULL smb_fname->fsp.
*/
- if (!conn->sconn->using_smb2 && posix) {
+ if (ucf_flags & UCF_LCOMP_LNK_OK) {
SMB_ASSERT(smb_fname_rel->fsp == NULL);
SMB_ASSERT(streamname == NULL);
#define UCF_POSIX_PATHNAMES 0x00000008
/* #define UCF_UNIX_NAME_LOOKUP 0x00000010 is no longer used. */
#define UCF_PREP_CREATEFILE 0x00000020
+/*
+ * Return a non-fsp smb_fname for a symlink
+ */
+#define UCF_LCOMP_LNK_OK 0x00000040
/*
* Use the same bit as FLAGS2_REPARSE_PATH
* which means the same thing.