1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

smbd: Prepare fdos_mode() for handling symlinks in smb2

We should show all special files as NORMAL|REPARSE_POINT, except
symlinks for SMB1 Posix Extensions. IFREG and IFDIR are handled via
our xattr mechanisms.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
Volker Lendecke 2024-11-19 15:35:58 +01:00 committed by Ralph Boehme
parent 61259bf9aa
commit c87269f528

View File

@ -721,16 +721,28 @@ uint32_t fdos_mode(struct files_struct *fsp)
}
switch (fsp->fsp_name->st.st_ex_mode & S_IFMT) {
case S_IFLNK:
return FILE_ATTRIBUTE_NORMAL;
case S_IFREG:
case S_IFDIR:
break;
case S_IFIFO:
case S_IFSOCK:
case S_IFBLK:
case S_IFCHR:
return FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_REPARSE_POINT;
case S_IFLNK:
if (fsp->fsp_flags.posix_open &&
!conn_using_smb2(fsp->conn->sconn)) {
/*
* SMB1 posix doesn't like the reparse point flag
*/
result = FILE_ATTRIBUTE_NORMAL;
} else {
/*
* Everybody else wants to see symlinks as
* reparse points
*/
result = FILE_ATTRIBUTE_NORMAL |
FILE_ATTRIBUTE_REPARSE_POINT;
}
break;
default:
return FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_REPARSE_POINT;
break;
}