below.
Path processing in Samba typically means processing client supplied paths by
-Samba's core path processing function =filename_convert()= which returs a
+Samba's core path processing function =filename_convert()= which returns a
pointer to an object of type =struct smb_filename=. Pointers to such objects are
then passed around, often passing many layers of code.
*** When to open with O_PATH
In Samba the decision whether to call POSIX ~open()~ on a client pathname or
whether to leave the low-level handle at -1 (what we call a stat-open) is based
- on the client requested SMB acccess mask.
+ on the client requested SMB access mask.
The set of access rights that trigger an ~open()~ includes
~READ_CONTROL_ACCESS~. As a result, the open() will be done with at least
support ~O_PATH~ is needed.
The way this is implemented on such systems is impersonating the root user for
- the ~open()~ syscall. In order to avoid privelege escalations security issues,
+ the ~open()~ syscall. In order to avoid privilege escalations security issues,
we must carefully control the use these file-handles.
The low level filehandle is stored in a public struct ~struct file_handle~ that
is part of the widely used ~struct files_struct~. Consumers used to simply
- access the fd directly by derefencing pointers to ~struct files_struct~.
+ access the fd directly by dereferencing pointers to ~struct files_struct~.
In order to guard access to such file-handles we do two things:
| SMB_VFS_BRL_LOCK_WINDOWS() | [[fsp][fsp]] | - |
| SMB_VFS_BRL_UNLOCK_WINDOWS() | [[fsp][fsp]] | - |
| SMB_VFS_CHDIR() | [[Path][Path]] | Todo |
-| SMB_VFS_CHFLAGS() | [[Path][Path]] | Todo |
-| SMB_VFS_CHMOD() | [[Path][Path]] | Todo |
+| SMB_VFS_CHFLAGS() | [[Path][Path]] | - |
+| SMB_VFS_CHMOD() | [[Path][Path]] | - |
| SMB_VFS_CLOSE() | [[fsp][fsp]] | - |
| SMB_VFS_CLOSEDIR() | [[fsp][fsp]] | - |
| SMB_VFS_CONNECT() | [[Disk][Disk]] | - |
| SMB_VFS_GET_DOS_ATTRIBUTES_RECV() | [[Enum][Enum]] | - |
| SMB_VFS_GET_DOS_ATTRIBUTES_SEND() | [[Enum][Enum]] | - |
| SMB_VFS_GETLOCK() | [[fsp][fsp]] | - |
-| SMB_VFS_GET_NT_ACL_AT() | [[Path][Path]] | Todo |
+| SMB_VFS_GET_NT_ACL_AT() | [[Path][Path]] | - |
| SMB_VFS_GET_QUOTA() | [[Special][Special]] | - |
| SMB_VFS_GET_REAL_FILENAME() | [[P2px][P2px]] | - |
| SMB_VFS_GET_SHADOW_COPY_DATA() | [[fsp][fsp]] | - |
| SMB_VFS_GETWD() | [[Special][Special]] | - |
-| SMB_VFS_GETXATTR() | [[Path][Path]] | Todo |
+| SMB_VFS_GETXATTR() | [[Path][Path]] | - |
| SMB_VFS_GETXATTRAT_RECV() | [[Enum][Enum]] | - |
| SMB_VFS_GETXATTRAT_SEND() | [[Enum][Enum]] | - |
-| SMB_VFS_KERNEL_FLOCK() | [[fsp][fsp]] | - |
+| SMB_VFS_FILESYSTEM_SHAREMODE() | [[fsp][fsp]] | - |
| SMB_VFS_LCHOWN() | [[Path][Path]] | Todo |
| SMB_VFS_LINKAT() | [[NsC][NsC]] | - |
| SMB_VFS_LINUX_SETLEASE() | [[fsp][fsp]] | - |
-| SMB_VFS_LISTXATTR() | [[Path][Path]] | Todo |
+| SMB_VFS_LISTXATTR() | [[Path][Path]] | - |
| SMB_VFS_LOCK() | [[fsp][fsp]] | - |
| SMB_VFS_LSEEK() | [[fsp][fsp]] | - |
| SMB_VFS_LSTAT() | [[Path][Path]] | Todo |
| SMB_VFS_MKDIRAT() | [[NsC][NsC]] | - |
| SMB_VFS_MKNODAT() | [[NsC][NsC]] | - |
-| SMB_VFS_NTIMES() | [[Path][Path]] | Todo |
+| SMB_VFS_NTIMES() | [[Path][Path]] | - |
| SMB_VFS_OFFLOAD_READ_RECV() | [[fsp][fsp]] | - |
| SMB_VFS_OFFLOAD_READ_SEND() | [[fsp][fsp]] | - |
| SMB_VFS_OFFLOAD_WRITE_RECV() | [[fsp][fsp]] | - |
| SMB_VFS_PREAD_SEND() | [[fsp][fsp]] | - |
| SMB_VFS_PWRITE() | [[fsp][fsp]] | - |
| SMB_VFS_PWRITE_SEND() | [[fsp][fsp]] | - |
-| SMB_VFS_READ_DFS_PATHAT() | [[Symlink][Symlink]] | Todo |
+| SMB_VFS_READ_DFS_PATHAT() | [[Symlink][Symlink]] | - |
| SMB_VFS_READDIR() | [[fsp][fsp]] | - |
-| SMB_VFS_READDIR_ATTR() | [[Path][Path]] | Todo |
-| SMB_VFS_READLINKAT() | [[Symlink][Symlink]] | Todo |
+| SMB_VFS_READDIR_ATTR() | [[Path][Path]] | - |
+| SMB_VFS_READLINKAT() | [[Symlink][Symlink]] | - |
| SMB_VFS_REALPATH() | [[P2px][P2px]] | - |
| SMB_VFS_RECVFILE() | [[fsp][fsp]] | - |
-| SMB_VFS_REMOVEXATTR() | [[Path][Path]] | Todo |
-| SMB_VFS_RENAMEAT() | [[Path][Path]] | Todo |
+| SMB_VFS_REMOVEXATTR() | [[Path][Path]] | - |
+| SMB_VFS_RENAMEAT() | [[Path][Path]] | ---- |
| SMB_VFS_REWINDDIR() | [[fsp][fsp]] | - |
-| SMB_VFS_SEEKDIR() | [[fsp][fsp]] | - |
| SMB_VFS_SENDFILE() | [[fsp][fsp]] | - |
| SMB_VFS_SET_COMPRESSION() | [[fsp][fsp]] | - |
| SMB_VFS_SET_DOS_ATTRIBUTES() | [[Path][Path]] | - |
| SMB_VFS_SET_QUOTA() | [[Special][Special]] | - |
-| SMB_VFS_SETXATTR() | [[Path][Path]] | Todo |
+| SMB_VFS_SETXATTR() | [[Path][Path]] | - |
| SMB_VFS_SNAP_CHECK_PATH() | [[Disk][Disk]] | - |
| SMB_VFS_SNAP_CREATE() | [[Disk][Disk]] | - |
| SMB_VFS_SNAP_DELETE() | [[Disk][Disk]] | - |
| SMB_VFS_STAT() | [[Path][Path]] | Todo |
| SMB_VFS_STATVFS() | [[Disk][Disk]] | - |
-| SMB_VFS_STREAMINFO() | [[Path][Path]] | Todo |
+| SMB_VFS_STREAMINFO() | [[Path][Path]] | - |
| SMB_VFS_STRICT_LOCK_CHECK() | [[fsp][fsp]] | - |
| SMB_VFS_SYMLINKAT() | [[NsC][NsC]] | - |
| SMB_VFS_SYS_ACL_BLOB_GET_FD() | [[xpathref][xpathref]] | - |
-| SMB_VFS_SYS_ACL_BLOB_GET_FILE() | [[Path][Path]] | Todo |
-| SMB_VFS_SYS_ACL_DELETE_DEF_FILE() | [[Path][Path]] | Todo |
+| SMB_VFS_SYS_ACL_BLOB_GET_FILE() | [[Path][Path]] | - |
+| SMB_VFS_SYS_ACL_DELETE_DEF_FILE() | [[Path][Path]] | - |
| SMB_VFS_SYS_ACL_GET_FD() | [[xpathref][xpathref]] | - |
-| SMB_VFS_SYS_ACL_GET_FILE() | [[Path][Path]] | Todo |
+| SMB_VFS_SYS_ACL_GET_FILE() | [[Path][Path]] | - |
| SMB_VFS_SYS_ACL_SET_FD() | [[xpathref][xpathref]] | - |
-| SMB_VFS_TELLDIR() | [[fsp][fsp]] | - |
| SMB_VFS_TRANSLATE_NAME() | [[P2px][P2px]] | - |
| SMB_VFS_UNLINKAT() | [[NsC][NsC]] | - |
|-----------------------------------+----------+--------|
#+ATTR_HTML: :border 1 :rules all :frame border
| VFS Function | Group | Status |
|---------------------------------+----------+--------|
-| SMB_VFS_SYS_ACL_DELETE_DEF_FD() | [[xpathref][xpathref]] | Todo |
-| SMB_VFS_READDIR_ATTRAT() | [[Enum][Enum]] | Todo |
-| SMB_VFS_FUTIMENS() | [[fsp][fsp]] | Todo |
+| SMB_VFS_SYS_ACL_DELETE_DEF_FD() | [[xpathref][xpathref]] | - |
+| SMB_VFS_FNTIMENS() | [[fsp][fsp]] | - |
|---------------------------------+----------+--------|
** VFS functions by category
- SMB_VFS_GETLOCK()
- SMB_VFS_GET_ALLOC_SIZE()
- SMB_VFS_GET_SHADOW_COPY_DATA()
- - SMB_VFS_KERNEL_FLOCK()
+ - SMB_VFS_FILESYSTEM_SHAREMODE()
- SMB_VFS_LINUX_SETLEASE()
- SMB_VFS_LOCK()
- SMB_VFS_LSEEK()
- SMB_VFS_READDIR()
- SMB_VFS_RECVFILE()
- SMB_VFS_REWINDDIR()
- - SMB_VFS_SEEKDIR()
- SMB_VFS_SENDFILE()
- SMB_VFS_SET_COMPRESSION()
- SMB_VFS_STRICT_LOCK_CHECK()
- - SMB_VFS_TELLDIR()
If an fsp is provided by the SMB layer we use that, otherwise we use the
pathref fsp =smb_fname->fsp= provided by =filename_convert()=.
Callers use =openat_pathref_fsp()= to open a fsp on the parent directory.
*** Path based VFS functions <<Path>>
- All path based VFS functtions will be replaced by handle based variants using the
+ All path based VFS functions will be replaced by handle based variants using the
=smb_fname->fsp= provided by =filename_convert()=.
- SMB_VFS_CHDIR()
*** AT VFS functions needed for directory enumeration <<Enum>>
- SMB_VFS_GET_DOS_ATTRIBUTES_SEND()
- SMB_VFS_GETXATTRAT_SEND()
- - SMB_VFS_READDIR_ATTRAT() (NEW)
*** Handle based VFS functions not allowed on O_PATH opened handles <<xpathref>>
- SMB_VFS_FGETXATTR()
- SMB_VFS_FLISTXATTR()