4 IDL structures for xattr file attributes
6 this has nothing to do with RPC, we are just using our NDR/IDL
7 infrastructure as a convenient way to store linearised information
8 about a file in a architecture independent manner
11 import
"security.idl";
15 helper
("../librpc/ndr/ndr_xattr.h"),
16 pyhelper
("librpc/ndr/py_xattr.c"),
17 pointer_default(unique)
21 const char *XATTR_DOSATTRIB_NAME
= "user.DosAttrib";
22 const char *XATTR_DOSATTRIB_NAME_S3
= "user.DOSATTRIB";
23 const int XATTR_DOSATTRIB_ESTIMATED_SIZE
= 64;
25 /* we store basic dos attributes in a DosAttrib xattr. By
26 using a union we can cope with new version of this
27 structure more easily */
30 * the FFFF level is never really used,
31 * it's used to pass the information from
32 * the old hex string attrib information
33 * we have a handwritten parser which converts
34 * the hex string to the xattr_DosInfoFFFFCompat strucure
39 } xattr_DosInfoFFFFCompat
;
51 We use xattrDosInfo1 again when we store values.
52 Because the sticky write time is now stored in the opendb
53 and xattr_DosInfo2Old is only present to parse existing
56 const int XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME = 0x1;
66 NTTIME write_time
; /* only used when sticky write time is set */
70 typedef [bitmap32bit
] bitmap
{
71 XATTR_DOSINFO_ATTRIB
= 0x00000001,
72 XATTR_DOSINFO_EA_SIZE
= 0x00000002,
73 XATTR_DOSINFO_SIZE
= 0x00000004,
74 XATTR_DOSINFO_ALLOC_SIZE
= 0x00000008,
75 XATTR_DOSINFO_CREATE_TIME
= 0x00000010,
76 XATTR_DOSINFO_CHANGE_TIME
= 0x00000020
77 } xattr_DosInfoValidFlags
;
80 xattr_DosInfoValidFlags valid_flags
;
89 typedef [public,switch_type(uint16
)] union {
90 [case(0xFFFF)] xattr_DosInfoFFFFCompat compatinfoFFFF
;
91 [case(1)] xattr_DosInfo1 info1
;
92 [case(2)] xattr_DosInfo2Old oldinfo2
;
93 [case(3)] xattr_DosInfo3 info3
;
96 typedef [public] struct {
98 [switch_is(version)] xattr_DosInfo info
;
101 typedef [public,nopush
,nopull
,noprint
] struct {
104 [switch_is(version)] xattr_DosInfo info
;
107 /* we store DOS style extended attributes in a DosEAs xattr */
108 const char *XATTR_DOSEAS_NAME
= "user.DosEAs";
115 typedef [public] struct {
117 [size_is(num_eas
)] xattr_EA
*eas
;
120 /* Slightly different version, used by the vfs_xattr_tdb module */
121 typedef [public] struct {
123 xattr_EA eas
[num_eas
];
126 /* we store stream information in this xattr structure. Then
127 the streams themselves are stored in
128 user.DosStream.STREAMNAME or in external files, according
130 const char *XATTR_DOSSTREAMS_NAME
= "user.DosStreams";
132 const int XATTR_STREAM_FLAG_INTERNAL
= 0x00000001;
134 /* stream data is stored in attributes with the given prefix */
135 const char *XATTR_DOSSTREAM_PREFIX
= "user.DosStream.";
137 const int XATTR_MAX_STREAM_SIZE
= 0x4000;
138 const int XATTR_MAX_STREAM_SIZE_TDB
= 0x100000;
147 typedef [public] struct {
149 [size_is(num_streams
)] xattr_DosStream
*streams
;
153 /* we store the NT ACL a NTACL xattr. It is versioned so we
154 can later add other acl attribs (such as posix acl mapping)
156 we put this xattr in the security namespace to ensure that
157 only trusted users can write to the ACL
159 stored in "security.NTACL"
161 Version 1. raw SD stored as Samba4 does it.
162 Version 2. raw SD + last changed hash so we
163 can discard if this doesn't match the underlying ACL hash.
166 const char *XATTR_NTACL_NAME
= "security.NTACL";
168 const int XATTR_SD_HASH_SIZE
= 64;
169 const int XATTR_SD_HASH_TYPE_NONE
= 0x0;
170 const int XATTR_SD_HASH_TYPE_SHA256
= 0x1;
172 typedef [public] struct {
173 security_descriptor
*sd
;
175 } security_descriptor_hash_v2
; /* Hash never used in this version. */
177 typedef [public] struct {
178 security_descriptor
*sd
;
180 uint8 hash
[64]; /* 64 bytes hash. */
181 } security_descriptor_hash_v3
;
183 typedef [public] struct {
184 security_descriptor
*sd
;
186 uint8 hash
[64]; /* 64 bytes hash. */
187 utf8string description
; /* description of what created
188 * this hash (to allow
189 * forensics later, if we have
190 * a bug in one codepath */
192 uint8 sys_acl_hash
[64]; /* 64 bytes hash. */
193 } security_descriptor_hash_v4
;
195 typedef [switch_type(uint16
)] union {
196 [case(1)] security_descriptor
*sd
;
197 [case(2)] security_descriptor_hash_v2
*sd_hs2
;
198 [case(3)] security_descriptor_hash_v3
*sd_hs3
;
199 [case(4)] security_descriptor_hash_v4
*sd_hs4
;
202 typedef [public] struct {
204 [switch_is(version)] xattr_NTACL_Info info
;
208 * A wrapper of the common information required to be in the
209 * hash of the ACL, for the acl_xattr and acl_tdb modules.
211 [public] typedef struct {
212 DATA_BLOB acl_as_blob
;
216 } xattr_sys_acl_hash_wrapper
;