mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
libsmb: Define to transfer file types via smb3 unix extensions
Ride on the definitions of the SMB1 extensions, send the UNIX type in the 3 bits above the permissions and extra (suid,sgid,sticky) bits Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
03fe0d631d
commit
a9983bb6ed
@ -117,7 +117,9 @@ Offset Size Name
|
||||
#define UNIX_USR_MASK 0000700
|
||||
#define UNIX_PERM_MASK 0000777
|
||||
#define UNIX_EXTRA_MASK 0007000
|
||||
#define UNIX_ALL_MASK 0007777
|
||||
#define UNIX_FILETYPE_MASK 0070000
|
||||
#define UNIX_FILETYPE_SHIFT 12
|
||||
#define UNIX_ALL_MASK 0077777
|
||||
|
||||
/* Flags for chflags (CIFS_UNIX_EXTATTR_CAP capability) and
|
||||
* SMB_QUERY_FILE_UNIX_INFO2.
|
||||
|
@ -34,6 +34,8 @@ uint32_t unix_perms_to_wire(mode_t perms);
|
||||
mode_t wire_perms_to_unix(uint32_t perms);
|
||||
mode_t wire_filetype_to_unix(uint32_t wire_type);
|
||||
uint32_t unix_filetype_to_wire(mode_t mode);
|
||||
mode_t wire_mode_to_unix(uint32_t wire);
|
||||
uint32_t unix_mode_to_wire(mode_t mode);
|
||||
|
||||
bool smb_buffer_oob(uint32_t bufsize, uint32_t offset, uint32_t length);
|
||||
|
||||
|
@ -195,6 +195,19 @@ uint32_t unix_filetype_to_wire(mode_t mode)
|
||||
return UNIX_TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
mode_t wire_mode_to_unix(uint32_t wire)
|
||||
{
|
||||
uint32_t wire_type = (wire & UNIX_FILETYPE_MASK) >>
|
||||
UNIX_FILETYPE_SHIFT;
|
||||
return wire_perms_to_unix(wire) | wire_filetype_to_unix(wire_type);
|
||||
}
|
||||
|
||||
uint32_t unix_mode_to_wire(mode_t mode)
|
||||
{
|
||||
uint32_t wire_type = unix_filetype_to_wire(mode);
|
||||
return unix_perms_to_wire(mode) | (wire_type << UNIX_FILETYPE_SHIFT);
|
||||
}
|
||||
|
||||
bool smb_buffer_oob(uint32_t bufsize, uint32_t offset, uint32_t length)
|
||||
{
|
||||
if ((offset + length < offset) || (offset + length < length)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user