From bad2646ff016fe8932fa8e18209337f361859b73 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 21 Sep 2024 01:22:54 +0200 Subject: [PATCH] libsmb: Move UNIX constants to smb3posix.idl Make them available to python Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- libcli/smb/smb_unix_ext.h | 44 +++------------------------------------ librpc/idl/smb3posix.idl | 31 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 41 deletions(-) diff --git a/libcli/smb/smb_unix_ext.h b/libcli/smb/smb_unix_ext.h index 1145fd3cad6..ca0470672ab 100644 --- a/libcli/smb/smb_unix_ext.h +++ b/libcli/smb/smb_unix_ext.h @@ -24,6 +24,9 @@ #ifndef __SMB_UNIX_EXT_H__ #define __SMB_UNIX_EXT_H__ +#include +#include "librpc/gen_ndr/smb3posix.h" + /* UNIX CIFS Extensions - created by HP */ /* * UNIX CIFS Extensions have the range 0x200 - 0x2FF reserved. @@ -80,47 +83,6 @@ Offset Size Name #define SMB_FILE_UNIX_BASIC_SIZE 100 -/* UNIX filetype mappings. */ - -#define UNIX_TYPE_FILE 0 -#define UNIX_TYPE_DIR 1 -#define UNIX_TYPE_SYMLINK 2 -#define UNIX_TYPE_CHARDEV 3 -#define UNIX_TYPE_BLKDEV 4 -#define UNIX_TYPE_FIFO 5 -#define UNIX_TYPE_SOCKET 6 -#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF - -/* - * Oh this is fun. "Standard UNIX permissions" has no - * meaning in POSIX. We need to define the mapping onto - * and off the wire as this was not done in the original HP - * spec. JRA. - */ - -#define UNIX_X_OTH 0000001 -#define UNIX_W_OTH 0000002 -#define UNIX_R_OTH 0000004 -#define UNIX_X_GRP 0000010 -#define UNIX_W_GRP 0000020 -#define UNIX_R_GRP 0000040 -#define UNIX_X_USR 0000100 -#define UNIX_W_USR 0000200 -#define UNIX_R_USR 0000400 -#define UNIX_STICKY 0001000 -#define UNIX_SET_GID 0002000 -#define UNIX_SET_UID 0004000 - -/* Masks for the above */ -#define UNIX_OTH_MASK 0000007 -#define UNIX_GRP_MASK 0000070 -#define UNIX_USR_MASK 0000700 -#define UNIX_PERM_MASK 0000777 -#define UNIX_EXTRA_MASK 0007000 -#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. */ diff --git a/librpc/idl/smb3posix.idl b/librpc/idl/smb3posix.idl index ad88cc16bca..262565848a1 100644 --- a/librpc/idl/smb3posix.idl +++ b/librpc/idl/smb3posix.idl @@ -13,6 +13,37 @@ import "security.idl"; ] interface smb3posix { + const int UNIX_TYPE_FILE = 0; + const int UNIX_TYPE_DIR = 1; + const int UNIX_TYPE_SYMLINK = 2; + const int UNIX_TYPE_CHARDEV = 3; + const int UNIX_TYPE_BLKDEV = 4; + const int UNIX_TYPE_FIFO = 5; + const int UNIX_TYPE_SOCKET = 6; + const int UNIX_TYPE_UNKNOWN = 0xFFFFFFFF; + + const int UNIX_X_OTH = 0000001; + const int UNIX_W_OTH = 0000002; + const int UNIX_R_OTH = 0000004; + const int UNIX_X_GRP = 0000010; + const int UNIX_W_GRP = 0000020; + const int UNIX_R_GRP = 0000040; + const int UNIX_X_USR = 0000100; + const int UNIX_W_USR = 0000200; + const int UNIX_R_USR = 0000400; + const int UNIX_STICKY = 0001000; + const int UNIX_SET_GID = 0002000; + const int UNIX_SET_UID = 0004000; + + const int UNIX_OTH_MASK = 0000007; + const int UNIX_GRP_MASK = 0000070; + const int UNIX_USR_MASK = 0000700; + const int UNIX_PERM_MASK = 0000777; + const int UNIX_EXTRA_MASK = 0007000; + const int UNIX_FILETYPE_MASK = 0070000; + const int UNIX_FILETYPE_SHIFT = 12; + const int UNIX_ALL_MASK = 0077777; + typedef [public,flag(NDR_NOALIGN)] struct { uint32 nlinks; uint32 reparse_tag; -- 2.47.3