xattr.id: Fix a typo
[metze/samba/wip.git] / librpc / idl / xattr.idl
1 #include "idl_types.h"
2
3 /*
4    IDL structures for xattr file attributes
5
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
9 */
10
11 import "security.idl";
12
13 [
14   uuid("12345778-1234-abcd-0001-00000002"),
15   version(0.0),
16   helper("../librpc/ndr/ndr_xattr.h"),
17   pyhelper("librpc/ndr/py_xattr.c"),
18   pointer_default(unique)
19 ]
20 interface xattr
21 {
22         const char *XATTR_DOSATTRIB_NAME = "user.DosAttrib";
23         const char *XATTR_DOSATTRIB_NAME_S3 = "user.DOSATTRIB";
24         const int XATTR_DOSATTRIB_ESTIMATED_SIZE = 64;
25
26         /* we store basic dos attributes in a DosAttrib xattr. By
27            using a union we can cope with new version of this
28            structure more easily */
29
30         /*
31          * the FFFF level is never really used,
32          * it's used to pass the information from
33          * the old hex string attrib information
34          * we have a handwritten parser which converts
35          * the hex string to the xattr_DosInfoFFFFCompat strucure
36          */
37
38         typedef struct {
39                 uint32 attrib;
40         } xattr_DosInfoFFFFCompat;
41
42         typedef struct {
43                 uint32 attrib;
44                 uint32 ea_size;
45                 udlong size;
46                 udlong alloc_size;
47                 NTTIME create_time;
48                 NTTIME change_time;
49         } xattr_DosInfo1;
50
51 /*
52         We use xattrDosInfo1 again when we store values.
53         Because the sticky write time is now stored in the opendb
54         and xattr_DosInfo2Old is only present to parse existing
55         values from disk.
56
57         const int XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME = 0x1;
58 */
59         typedef struct {
60                 uint32     flags;
61                 uint32     attrib;
62                 uint32     ea_size;
63                 udlong     size;
64                 udlong     alloc_size;
65                 NTTIME     create_time;
66                 NTTIME     change_time;
67                 NTTIME     write_time; /* only used when sticky write time is set */
68                 utf8string name;
69         } xattr_DosInfo2Old;
70
71         typedef [bitmap32bit] bitmap {
72                 XATTR_DOSINFO_ATTRIB            = 0x00000001,
73                 XATTR_DOSINFO_EA_SIZE           = 0x00000002,
74                 XATTR_DOSINFO_SIZE              = 0x00000004,
75                 XATTR_DOSINFO_ALLOC_SIZE        = 0x00000008,
76                 XATTR_DOSINFO_CREATE_TIME       = 0x00000010,
77                 XATTR_DOSINFO_CHANGE_TIME       = 0x00000020
78         } xattr_DosInfoValidFlags;
79
80         typedef struct {
81                 xattr_DosInfoValidFlags valid_flags;
82                 uint32 attrib;
83                 uint32 ea_size;
84                 udlong size;
85                 udlong alloc_size;
86                 NTTIME create_time;
87                 NTTIME change_time;
88         } xattr_DosInfo3;
89
90         typedef [public,switch_type(uint16)] union {
91                 [case(0xFFFF)] xattr_DosInfoFFFFCompat compatinfoFFFF;
92                 [case(1)] xattr_DosInfo1 info1;
93                 [case(2)] xattr_DosInfo2Old oldinfo2;
94                 [case(3)] xattr_DosInfo3 info3;
95         } xattr_DosInfo;
96
97         typedef [public] struct {
98                 uint16 version;
99                 [switch_is(version)] xattr_DosInfo info;
100         } xattr_DosAttrib;
101
102         typedef [public,nopush,nopull,noprint] struct {
103                 astring attrib_hex;
104                 uint16 version;
105                 [switch_is(version)] xattr_DosInfo info;
106         } xattr_DOSATTRIB;
107
108         void xattr_parse_DOSATTRIB(
109                 [in] xattr_DOSATTRIB x
110         );
111
112         /* we store DOS style extended attributes in a DosEAs xattr */
113         const char *XATTR_DOSEAS_NAME = "user.DosEAs";
114
115         typedef struct {
116                 utf8string name;
117                 DATA_BLOB value;
118         } xattr_EA;
119
120         typedef [public] struct {
121                 uint16 num_eas;
122                 [size_is(num_eas)] xattr_EA *eas;
123         } xattr_DosEAs;
124
125         /* Slightly different version, used by the vfs_xattr_tdb module */
126         typedef [public] struct {
127                 uint32 num_eas;
128                 xattr_EA eas[num_eas];
129         } tdb_xattrs;
130
131         /* we store stream information in this xattr structure. Then
132            the streams themselves are stored in
133            user.DosStream.STREAMNAME or in external files, according
134            to the flags */
135         const char *XATTR_DOSSTREAMS_NAME = "user.DosStreams";
136
137         const int XATTR_STREAM_FLAG_INTERNAL = 0x00000001;
138
139         /* stream data is stored in attributes with the given prefix */
140         const char *XATTR_DOSSTREAM_PREFIX = "user.DosStream.";
141
142         const int XATTR_MAX_STREAM_SIZE     = 0x4000;
143         const int XATTR_MAX_STREAM_SIZE_TDB = 0x100000;
144
145         typedef struct {
146                 uint32     flags;
147                 udlong     size;
148                 udlong     alloc_size;
149                 utf8string name;
150         } xattr_DosStream;
151
152         typedef [public] struct {
153                 uint32 num_streams;
154                 [size_is(num_streams)] xattr_DosStream *streams;
155         } xattr_DosStreams;
156
157
158         /* we store the NT ACL a NTACL xattr. It is versioned so we
159            can later add other acl attribs (such as posix acl mapping)
160
161            we put this xattr in the security namespace to ensure that
162            only trusted users can write to the ACL
163
164            stored in "security.NTACL"
165
166            Version 1. raw SD stored as Samba4 does it.
167            Version 2. raw SD + last changed hash so we
168                       can discard if this doesn't match the underlying ACL hash.
169         */
170
171         const char *XATTR_NTACL_NAME = "security.NTACL";
172
173         const int XATTR_SD_HASH_SIZE = 64;
174         const int XATTR_SD_HASH_TYPE_NONE = 0x0;
175         const int XATTR_SD_HASH_TYPE_SHA256 = 0x1;
176
177         typedef [public] struct {
178                 security_descriptor *sd;
179                 uint8 hash[16];
180         } security_descriptor_hash_v2; /* Hash never used in this version. */
181
182         typedef [public] struct {
183                 security_descriptor *sd;
184                 uint16 hash_type;
185                 uint8 hash[64]; /* 64 bytes hash. */
186         } security_descriptor_hash_v3;
187
188         typedef [public] struct {
189                 security_descriptor *sd;
190                 uint16 hash_type;
191                 uint8 hash[64]; /* 64 bytes hash. */
192                 utf8string description; /* description of what created
193                                          * this hash (to allow
194                                          * forensics later, if we have
195                                          * a bug in one codepath */
196                 NTTIME time;
197                 uint8 sys_acl_hash[64]; /* 64 bytes hash. */
198         } security_descriptor_hash_v4;
199
200         typedef [switch_type(uint16)] union {
201                 [case(1)] security_descriptor *sd;
202                 [case(2)] security_descriptor_hash_v2 *sd_hs2;
203                 [case(3)] security_descriptor_hash_v3 *sd_hs3;
204                 [case(4)] security_descriptor_hash_v4 *sd_hs4;
205         } xattr_NTACL_Info;
206
207         typedef [public] struct {
208                 uint16 version;
209                 [switch_is(version)] xattr_NTACL_Info info;
210         } xattr_NTACL;
211
212         /*
213          * A wrapper of the common information required to be in the
214          * hash of the ACL, for the acl_xattr and acl_tdb modules.
215          */
216         [public] typedef struct {
217                 DATA_BLOB acl_as_blob;
218                 uid_t owner;
219                 gid_t group;
220                 mode_t mode;
221         } xattr_sys_acl_hash_wrapper;
222
223 }