r19784: smbd compiles (still a few warning which are actual bugs)
[Samba.git] / source / include / rpc_misc.h
blob661d436859afccd917d45b5d4aaaa34606359883
1 /*
2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 1992-1997
5 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
6 Copyright (C) Paul Ashton 1997
7 Copyright (C) Gerald (Jerry) Carter 2005
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _RPC_MISC_H /* _RPC_MISC_H */
25 #define _RPC_MISC_H
27 #define SMB_RPC_INTERFACE_VERSION 1
28 #define PRS_POINTER_CAST BOOL (*)(const char*, prs_struct*, int, void*)
30 enum unistr2_term_codes { UNI_FLAGS_NONE = 0, UNI_STR_TERMINATE = 1, UNI_MAXLEN_TERMINATE = 2, UNI_BROKEN_NON_NULL = 3, UNI_STR_DBLTERMINATE = 4 };
34 /**********************************************************************
35 * well-known RIDs - Relative IDs
36 **********************************************************************/
38 /* RIDs - Well-known users ... */
39 #define DOMAIN_USER_RID_ADMIN (0x000001F4L)
40 #define DOMAIN_USER_RID_GUEST (0x000001F5L)
41 #define DOMAIN_USER_RID_KRBTGT (0x000001F6L)
43 /* RIDs - well-known groups ... */
44 #define DOMAIN_GROUP_RID_ADMINS (0x00000200L)
45 #define DOMAIN_GROUP_RID_USERS (0x00000201L)
46 #define DOMAIN_GROUP_RID_GUESTS (0x00000202L)
47 #define DOMAIN_GROUP_RID_COMPUTERS (0x00000203L)
49 #define DOMAIN_GROUP_RID_CONTROLLERS (0x00000204L)
50 #define DOMAIN_GROUP_RID_CERT_ADMINS (0x00000205L)
51 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS (0x00000206L)
52 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS (0x00000207L)
54 /* is the following the right number? I bet it is --simo
55 #define DOMAIN_GROUP_RID_POLICY_ADMINS (0x00000208L)
58 /* RIDs - well-known aliases ... */
59 #define BUILTIN_ALIAS_RID_ADMINS (0x00000220L)
60 #define BUILTIN_ALIAS_RID_USERS (0x00000221L)
61 #define BUILTIN_ALIAS_RID_GUESTS (0x00000222L)
62 #define BUILTIN_ALIAS_RID_POWER_USERS (0x00000223L)
64 #define BUILTIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L)
65 #define BUILTIN_ALIAS_RID_SYSTEM_OPS (0x00000225L)
66 #define BUILTIN_ALIAS_RID_PRINT_OPS (0x00000226L)
67 #define BUILTIN_ALIAS_RID_BACKUP_OPS (0x00000227L)
69 #define BUILTIN_ALIAS_RID_REPLICATOR (0x00000228L)
70 #define BUILTIN_ALIAS_RID_RAS_SERVERS (0x00000229L)
71 #define BUILTIN_ALIAS_RID_PRE_2K_ACCESS (0x0000022aL)
74 /**********************************************************************
75 * Masks for mappings between unix uid and gid types and
76 * NT RIDS.
77 **********************************************************************/
79 #define BASE_RID (0x000003E8L)
81 /* Take the bottom bit. */
82 #define RID_TYPE_MASK 1
83 #define RID_MULTIPLIER 2
85 /* The two common types. */
86 #define USER_RID_TYPE 0
87 #define GROUP_RID_TYPE 1
91 /**********************************************************************
92 * RPC policy handle used pretty much everywhere
93 **********************************************************************/
95 typedef struct {
96 uint32 ptr_hnd; /* pointer to enumeration handle */
97 uint32 handle; /* enumeration handle */
98 } ENUM_HND;
102 /**********************************************************************
103 * RPC policy handle used pretty much everywhere
104 **********************************************************************/
106 typedef struct {
107 uint32 data1;
108 uint32 data2;
109 uint16 data3;
110 uint16 data4;
111 uint8 data5[8];
112 #ifdef __INSURE__
114 /* To prevent the leakage of policy handles mallocate a bit of
115 memory when a policy handle is created and free it when the
116 handle is closed. This should cause Insure to flag an error
117 when policy handles are overwritten or fall out of scope without
118 being freed. */
120 char *marker;
121 #endif
122 } POLICY_HND;
125 /**********************************************************************
126 * Buffer Headers -- use by SEC_DESC_BUF in winreg and netlogon code
127 **********************************************************************/
129 /* TODO: replace this with an encompassing buffer structure */
130 typedef struct {
131 uint32 buf_max_len;
132 uint32 buf_len;
133 } BUFHDR;
135 /* this is a BUFHDR + a pointer to a buffer */
136 typedef struct {
137 uint32 info_level;
138 uint32 length; /* uint8 chars */
139 uint32 buffer;
140 } BUFHDR2;
142 /* generic buffer ? wrapped around void*? */
143 typedef struct {
144 uint32 size;
145 uint32 buffer;
146 } BUFHDR4;
149 /**********************************************************************
150 * Buffers
151 **********************************************************************/
153 /* buffer used by \winreg\ calls to fill in arbitrary REG_XXX values.
154 It *may* look like a UNISTR2 but it is *not*. This is not a goof
155 by the winreg developers. It is a generic buffer. buffer length
156 is stored in bytes (not # of uint16's) */
158 typedef struct {
159 uint32 buf_max_len;
160 uint32 offset;
161 uint32 buf_len;
162 uint16 *buffer;
163 } REGVAL_BUFFER;
165 /* generic rpc version of the DATA_BLOB. Just a length and uint8 array */
167 typedef struct {
168 uint32 buf_len;
169 uint8 *buffer;
170 } RPC_DATA_BLOB;
172 /**********************************************************************
173 * Buffers use by spoolss (i might be able to replace it with
174 * an RPC_DATA_BLOB)
175 **********************************************************************/
177 typedef struct {
178 uint32 buf_len;
179 uint16 *buffer; /* data */
180 } BUFFER5;
183 /**********************************************************************
184 * Unicode and basic string headers
185 **********************************************************************/
187 typedef struct {
188 uint16 str_str_len;
189 uint16 str_max_len;
190 uint32 buffer; /* non-zero */
191 } STRHDR;
193 typedef struct {
194 uint16 uni_str_len;
195 uint16 uni_max_len;
196 uint32 buffer;
197 } UNIHDR;
199 /**********************************************************************
200 * UNICODE string variations
201 **********************************************************************/
204 typedef struct { /* UNISTR - unicode string size and buffer */
205 uint16 *buffer; /* unicode characters. ***MUST*** be
206 little-endian. ***MUST*** be null-terminated */
207 } UNISTR;
209 typedef struct { /* UNISTR2 - unicode string size (in
210 uint16 unicode chars) and buffer */
211 uint32 uni_max_len;
212 uint32 offset;
213 uint32 uni_str_len;
214 uint16 *buffer; /* unicode characters. ***MUST*** be little-endian.
215 **must** be null-terminated and the uni_str_len
216 should include the NULL character */
217 } UNISTR2;
219 /* i think this is the same as a BUFFER5 used in the spoolss code --jerry */
220 /* not sure about how the termination matches between the uint16 buffers thought */
222 typedef struct { /* UNISTR3 - XXXX not sure about this structure */
223 uint32 uni_str_len;
224 UNISTR str;
225 } UNISTR3;
227 typedef struct { /* Buffer wrapped around a UNISTR2 */
228 uint16 length; /* number of bytes not counting NULL terminatation */
229 uint16 size; /* number of bytes including NULL terminatation */
230 UNISTR2 *string;
231 } UNISTR4;
233 typedef struct {
234 uint32 count;
235 UNISTR4 *strings;
236 } UNISTR4_ARRAY;
239 /**********************************************************************
240 * String variations
241 **********************************************************************/
243 typedef struct { /* STRING2 - string size (in uint8 chars) and buffer */
244 uint32 str_max_len;
245 uint32 offset;
246 uint32 str_str_len;
247 uint8 *buffer; /* uint8 characters. **NOT** necessarily null-terminated */
248 } STRING2;
253 /**********************************************************************
254 * Domain SID structures
255 **********************************************************************/
257 typedef struct {
258 uint32 num_auths; /* length, bytes, including length of len :-) */
259 DOM_SID sid;
260 } DOM_SID2;
263 /**********************************************************************
264 * Domain SID structures
265 **********************************************************************/
267 /* DOM_RID - domain RID structure for ntlsa pipe */
268 typedef struct {
269 uint16 type; /* value is SID_NAME_USE enum */
270 uint32 rid;
271 uint32 rid_idx; /* referenced domain index */
272 } DOM_RID;
274 /* DOM_RID2 - second domain RID structure for ntlsa pipe */
275 typedef struct {
276 uint16 type; /* value is SID_NAME_USE enum */
277 uint32 rid;
278 uint32 rid_idx; /* referenced domain index */
279 uint32 unknown;
280 } DOM_RID2;
282 typedef struct { /* DOM_RID3 - domain RID structure for samr pipe */
283 uint32 rid; /* domain-relative (to a SID) id */
284 uint32 type1; /* value is 0x1 */
285 uint32 ptr_type; /* undocumented pointer */
286 uint32 type2; /* value is 0x1 */
287 uint32 unk; /* value is 0x2 */
288 } DOM_RID3;
290 /* DOM_RID4 - rid + user attributes */
291 typedef struct domrid4_info
293 uint32 unknown;
294 uint16 attr;
295 uint32 rid; /* user RID */
296 } DOM_RID4;
298 /* DOM_GID - group id + user attributes */
299 typedef struct {
300 uint32 g_rid; /* a group RID */
301 uint32 attr;
302 } DOM_GID;
304 /**********************************************************************
305 * ????
306 **********************************************************************/
308 /* DOM_CLNT_SRV - client / server names */
309 typedef struct clnt_srv_info {
310 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
311 UNISTR2 uni_logon_srv; /* logon server name */
312 uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */
313 UNISTR2 uni_comp_name; /* client machine name */
314 } DOM_CLNT_SRV;
316 /* DOM_LOG_INFO - login info */
317 typedef struct log_info {
318 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
319 UNISTR2 uni_logon_srv; /* logon server name */
320 UNISTR2 uni_acct_name; /* account name */
321 uint16 sec_chan; /* secure channel type */
322 UNISTR2 uni_comp_name; /* client machine name */
323 } DOM_LOG_INFO;
325 /* DOM_CHAL - challenge info */
326 typedef struct chal_info {
327 unsigned char data[8]; /* credentials */
328 } DOM_CHAL;
330 /* DOM_CREDs - timestamped client or server credentials */
331 typedef struct cred_info {
332 DOM_CHAL challenge; /* credentials */
333 UTIME timestamp; /* credential time-stamp */
334 } DOM_CRED;
336 /* DOM_CLNT_INFO - client info */
337 typedef struct clnt_info {
338 DOM_LOG_INFO login;
339 DOM_CRED cred;
340 } DOM_CLNT_INFO;
342 /* DOM_CLNT_INFO2 - client info */
343 typedef struct clnt_info2 {
344 DOM_CLNT_SRV login;
345 uint32 ptr_cred;
346 DOM_CRED cred;
347 } DOM_CLNT_INFO2;
349 /* DOM_LOGON_ID - logon id */
350 typedef struct logon_info {
351 uint32 low;
352 uint32 high;
353 } DOM_LOGON_ID;
355 /* OWF INFO */
356 typedef struct owf_info {
357 uint8 data[16];
358 } OWF_INFO;
360 typedef struct uint64_s
362 uint32 low;
363 uint32 high;
364 } UINT64_S;
366 #endif /* _RPC_MISC_H */