2 Unix SMB/Netbios implementation.
4 SMB parameters and setup
5 Copyright (C) Andrew Tridgell 1992-1997
6 Copyright (C) Luke Kenneth Casson Leighton 1996-1997
7 Copyright (C) Paul Ashton 1997
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 */
28 * macros to wrap prs_xxxx routines.
30 #define prs_uint8(name, ps, depth, data8) \
31 if (!_prs_uint8(name, ps, depth, data8)) return False
32 #define prs_uint16(name, ps, depth, data16) \
33 if (!_prs_uint16(name, ps, depth, data16)) return False
34 #define prs_hash1(ps, offset, sess_key) \
35 if (!_prs_hash1(ps, offset, sess_key)) return False
36 #define prs_uint32(name, ps, depth, data32) \
37 if (!_prs_uint32(name, ps, depth, data32)) return False
38 #define prs_uint8s(charmode, name, ps, depth, data8s, len) \
39 if (!_prs_uint8s(charmode, name, ps, depth, data8s, len)) return False
40 #define prs_uint16s(charmode, name, ps, depth, data16s, len) \
41 if (!_prs_uint16s(charmode, name, ps, depth, data16s, len)) return False
42 #define prs_uint32s(charmode, name, ps, depth, data32s, len) \
43 if (!_prs_uint32s(charmode, name, ps, depth, data32s, len)) return False
44 #define prs_buffer2(charmode, name, ps, depth, str) \
45 if (!_prs_buffer2(charmode, name, ps, depth, str)) return False
46 #define prs_string2(charmode, name, ps, depth, str) \
47 if (!_prs_string2(charmode, name, ps, depth, str)) return False
48 #define prs_unistr2(charmode, name, ps, depth, str) \
49 if (!_prs_unistr2(charmode, name, ps, depth, str)) return False
50 #define prs_unistr3(charmode, name, str, ps, depth) \
51 if (!_prs_unistr3(charmode, name, str, ps, depth)) return False
52 #define prs_unistr(name, ps, depth, str) \
53 if (!_prs_unistr(name, ps, depth, str)) return False
54 #define prs_string(name, ps, depth, str, len, max_buf_size) \
55 if (!_prs_string(name, ps, depth, str, len, max_buf_size)) return False
56 #define prs_uint16_pre(name, ps, depth, data16, offset) \
57 if (!_prs_uint16_pre(name, ps, depth, data16, offset)) return False
58 #define prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size) \
59 if (!_prs_uint16_post(name, ps, depth, data16, ptr_uint16, data_size)) return False
60 #define prs_uint32_pre(name, ps, depth, data32, offset) \
61 if (!_prs_uint32_pre(name, ps, depth, data32, offset)) return False
62 #define prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size) \
63 if (!_prs_uint32_post(name, ps, depth, data32, ptr_uint32, data_size)) return False
67 /* well-known RIDs - Relative IDs */
69 /* RIDs - Well-known users ... */
70 #define DOMAIN_USER_RID_ADMIN (0x000001F4L)
71 #define DOMAIN_USER_RID_GUEST (0x000001F5L)
73 /* RIDs - well-known groups ... */
74 #define DOMAIN_GROUP_RID_ADMINS (0x00000200L)
75 #define DOMAIN_GROUP_RID_USERS (0x00000201L)
76 #define DOMAIN_GROUP_RID_GUESTS (0x00000202L)
78 /* RIDs - well-known aliases ... */
79 #define BUILTIN_ALIAS_RID_ADMINS (0x00000220L)
80 #define BUILTIN_ALIAS_RID_USERS (0x00000221L)
81 #define BUILTIN_ALIAS_RID_GUESTS (0x00000222L)
82 #define BUILTIN_ALIAS_RID_POWER_USERS (0x00000223L)
83 #define BUILTIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L)
84 #define BUILTIN_ALIAS_RID_SYSTEM_OPS (0x00000225L)
85 #define BUILTIN_ALIAS_RID_PRINT_OPS (0x00000226L)
86 #define BUILTIN_ALIAS_RID_BACKUP_OPS (0x00000227L)
87 #define BUILTIN_ALIAS_RID_REPLICATOR (0x00000228L)
90 * Masks for mappings between unix uid and gid types and
94 /* Take the bottom bits. */
95 #define RID_TYPE_MASK 2
96 #define RID_MULTIPLIER 4
98 /* The three common types. */
99 #define RID_TYPE_USER 0
100 #define RID_TYPE_GROUP 1
101 #define RID_TYPE_ALIAS 2
103 /* BIGINT - NT-style 64-bit integer */
104 typedef struct bigint_info
113 typedef struct enum_hnd_info
115 uint32 ptr_hnd; /* pointer to enumeration handle */
116 uint32 handle; /* enumeration handle */
120 /* LOOKUP_LEVEL - switch value */
121 typedef struct lookup_level_info
127 /* DOM_SID2 - security id */
128 typedef struct sid_info_2
130 uint32 num_auths; /* length, bytes, including length of len :-) */
136 /* STRHDR - string header */
137 typedef struct header_info
141 uint32 buffer; /* non-zero */
145 /* STRHDR2 - string header, 32-bit lengths */
146 typedef struct header2_info
154 /* UNIHDR - unicode string header */
155 typedef struct unihdr_info
159 uint32 buffer; /* usually has a value of 4 */
163 /* UNIHDR2 - unicode string header and undocumented buffer */
164 typedef struct unihdr2_info
167 uint32 buffer; /* 32 bit buffer pointer */
171 /* clueless as to what maximum length should be */
172 #define MAX_UNISTRLEN 256
173 #define MAX_STRINGLEN 256
174 #define MAX_BUFFERLEN 512
176 /* UNISTR - unicode string size and buffer */
177 typedef struct unistr_info
179 uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */
183 /* BUFHDR - buffer header */
184 typedef struct bufhdr_info
191 /* BUFHDR2 - another buffer header, with info level */
192 typedef struct bufhdr2_info
195 uint32 length; /* uint8 chars */
200 /* BUFFER2 - unicode string, size (in uint8 ascii chars) and buffer */
201 /* pathetic. some stupid team of \PIPE\winreg writers got the concept */
202 /* of a unicode string different from the other \PIPE\ writers */
203 typedef struct buffer2_info
208 uint8 buffer[MAX_UNISTRLEN];
213 typedef struct buffer3_info
216 uint8 buffer[MAX_BUFFERLEN]; /* data */
221 /* BUFFER4 - simple length and buffer */
222 typedef struct buffer4_info
225 uint8 buffer[MAX_BUFFERLEN];
230 typedef struct buffer5_info
233 uint16 *buffer; /* data */
236 /* UNISTR2 - unicode string size (in uint16 unicode chars) and buffer */
237 typedef struct unistr2_info
242 uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */
246 /* STRING2 - string size (in uint8 chars) and buffer */
247 typedef struct string2_info
252 uint8 buffer[MAX_STRINGLEN]; /* uint8 characters. **NOT** necessarily null-terminated */
256 /* UNISTR3 - XXXX not sure about this structure */
257 typedef struct unistr3_info
265 /* DOM_RID2 - domain RID structure for ntlsa pipe */
266 typedef struct domrid2_info
268 uint8 type; /* value is SID_NAME_USE enum */
270 uint32 rid_idx; /* referenced domain index */
274 /* DOM_RID3 - domain RID structure for samr pipe */
275 typedef struct domrid3_info
277 uint32 rid; /* domain-relative (to a SID) id */
278 uint32 type1; /* value is 0x1 */
279 uint32 ptr_type; /* undocumented pointer */
280 uint32 type2; /* value is 0x1 */
281 uint32 unk; /* value is 0x2 */
285 /* DOM_CLNT_SRV - client / server names */
286 typedef struct clnt_srv_info
288 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
289 UNISTR2 uni_logon_srv; /* logon server name */
290 uint32 undoc_buffer2; /* undocumented 32 bit buffer pointer */
291 UNISTR2 uni_comp_name; /* client machine name */
295 /* DOM_LOG_INFO - login info */
296 typedef struct log_info
298 uint32 undoc_buffer; /* undocumented 32 bit buffer pointer */
299 UNISTR2 uni_logon_srv; /* logon server name */
300 UNISTR2 uni_acct_name; /* account name */
301 uint16 sec_chan; /* secure channel type */
302 UNISTR2 uni_comp_name; /* client machine name */
306 /* DOM_CLNT_INFO - client info */
307 typedef struct clnt_info
314 /* DOM_CLNT_INFO2 - client info */
315 typedef struct clnt_info2
323 /* DOM_LOGON_ID - logon id */
324 typedef struct logon_info
332 typedef struct owf_info
339 /* DOM_GID - group id + user attributes */
340 typedef struct gid_info
342 uint32 g_rid; /* a group RID */
347 #define POL_HND_SIZE 20
350 typedef struct lsa_policy_info
352 uint8 data[POL_HND_SIZE]; /* policy handle */
356 #endif /* _RPC_MISC_H */