lib-addns: ensure that allocated buffer are pre set to 0 (bug #9259)
[Samba.git] / librpc / idl / xattr.idl
blob1dd98a9588436604cf4aae212d893728766cbdee
1 #include "idl_types.h"
3 /*
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
9 */
11 import "security.idl";
14 uuid("12345778-1234-abcd-0001-00000002"),
15 version(0.0),
16 helper("../librpc/ndr/ndr_xattr.h"),
17 pointer_default(unique)
19 interface xattr
21 const char *XATTR_DOSATTRIB_NAME = "user.DosAttrib";
22 const int XATTR_DOSATTRIB_ESTIMATED_SIZE = 64;
24 /* we store basic dos attributes in a DosAttrib xattr. By
25 using a union we can cope with new version of this
26 structure more easily */
29 * the FFFF level is never really used,
30 * it's used to pass the information from
31 * the old hex string attrib information
32 * we have a handwritten parser which converts
33 * the hex string to the xattr_DosInfoFFFFCompat strucure
36 typedef struct {
37 uint32 attrib;
38 } xattr_DosInfoFFFFCompat;
40 typedef struct {
41 uint32 attrib;
42 uint32 ea_size;
43 udlong size;
44 udlong alloc_size;
45 NTTIME create_time;
46 NTTIME change_time;
47 } xattr_DosInfo1;
50 We use xattrDosInfo1 again when we store values.
51 Because the sticky write time is now stored in the opendb
52 and xattr_DosInfo2Old is only present to parse existing
53 values from disk.
55 const int XATTR_ATTRIB_FLAG_STICKY_WRITE_TIME = 0x1;
57 typedef struct {
58 uint32 flags;
59 uint32 attrib;
60 uint32 ea_size;
61 udlong size;
62 udlong alloc_size;
63 NTTIME create_time;
64 NTTIME change_time;
65 NTTIME write_time; /* only used when sticky write time is set */
66 utf8string name;
67 } xattr_DosInfo2Old;
69 typedef [bitmap32bit] bitmap {
70 XATTR_DOSINFO_ATTRIB = 0x00000001,
71 XATTR_DOSINFO_EA_SIZE = 0x00000002,
72 XATTR_DOSINFO_SIZE = 0x00000004,
73 XATTR_DOSINFO_ALLOC_SIZE = 0x00000008,
74 XATTR_DOSINFO_CREATE_TIME = 0x00000010,
75 XATTR_DOSINFO_CHANGE_TIME = 0x00000020
76 } xattr_DosInfoValidFlags;
78 typedef struct {
79 xattr_DosInfoValidFlags valid_flags;
80 uint32 attrib;
81 uint32 ea_size;
82 udlong size;
83 udlong alloc_size;
84 NTTIME create_time;
85 NTTIME change_time;
86 } xattr_DosInfo3;
88 typedef [public,switch_type(uint16)] union {
89 [case(0xFFFF)] xattr_DosInfoFFFFCompat compatinfoFFFF;
90 [case(1)] xattr_DosInfo1 info1;
91 [case(2)] xattr_DosInfo2Old oldinfo2;
92 [case(3)] xattr_DosInfo3 info3;
93 } xattr_DosInfo;
95 typedef [public] struct {
96 uint16 version;
97 [switch_is(version)] xattr_DosInfo info;
98 } xattr_DosAttrib;
100 typedef [public,nopush,nopull,noprint] struct {
101 astring attrib_hex;
102 uint16 version;
103 [switch_is(version)] xattr_DosInfo info;
104 } xattr_DOSATTRIB;
106 void xattr_parse_DOSATTRIB(
107 [in] xattr_DOSATTRIB x
110 /* we store DOS style extended attributes in a DosEAs xattr */
111 const char *XATTR_DOSEAS_NAME = "user.DosEAs";
113 typedef struct {
114 utf8string name;
115 DATA_BLOB value;
116 } xattr_EA;
118 typedef [public] struct {
119 uint16 num_eas;
120 [size_is(num_eas)] xattr_EA *eas;
121 } xattr_DosEAs;
123 /* Slightly different version, used by the vfs_xattr_tdb module */
124 typedef [public] struct {
125 uint32 num_eas;
126 xattr_EA eas[num_eas];
127 } tdb_xattrs;
129 /* we store stream information in this xattr structure. Then
130 the streams themselves are stored in
131 user.DosStream.STREAMNAME or in external files, according
132 to the flags */
133 const char *XATTR_DOSSTREAMS_NAME = "user.DosStreams";
135 const int XATTR_STREAM_FLAG_INTERNAL = 0x00000001;
137 /* stream data is stored in attributes with the given prefix */
138 const char *XATTR_DOSSTREAM_PREFIX = "user.DosStream.";
140 const int XATTR_MAX_STREAM_SIZE = 0x4000;
141 const int XATTR_MAX_STREAM_SIZE_TDB = 0x100000;
143 typedef struct {
144 uint32 flags;
145 udlong size;
146 udlong alloc_size;
147 utf8string name;
148 } xattr_DosStream;
150 typedef [public] struct {
151 uint32 num_streams;
152 [size_is(num_streams)] xattr_DosStream *streams;
153 } xattr_DosStreams;
156 /* we store the NT ACL a NTACL xattr. It is versioned so we
157 can later add other acl attribs (such as posix acl mapping)
159 we put this xattr in the security namespace to ensure that
160 only trusted users can write to the ACL
162 stored in "security.NTACL"
164 Version 1. raw SD stored as Samba4 does it.
165 Version 2. raw SD + last changed hash so we
166 can discard if this doesn't match the underlying ACL hash.
169 const char *XATTR_NTACL_NAME = "security.NTACL";
171 const int XATTR_SD_HASH_SIZE = 64;
172 const int XATTR_SD_HASH_TYPE_NONE = 0x0;
173 const int XATTR_SD_HASH_TYPE_SHA256 = 0x1;
175 typedef [public] struct {
176 security_descriptor *sd;
177 uint8 hash[16];
178 } security_descriptor_hash_v2; /* Hash never used in this version. */
180 typedef [public] struct {
181 security_descriptor *sd;
182 uint16 hash_type;
183 uint8 hash[64]; /* 64 bytes hash. */
184 } security_descriptor_hash_v3;
186 typedef [switch_type(uint16)] union {
187 [case(1)] security_descriptor *sd;
188 [case(2)] security_descriptor_hash_v2 *sd_hs2;
189 [case(3)] security_descriptor_hash_v3 *sd_hs3;
190 } xattr_NTACL_Info;
192 typedef [public] struct {
193 uint16 version;
194 [switch_is(version)] xattr_NTACL_Info info;
195 } xattr_NTACL;