"For I have laboured mightily on Luke's code, and hath broken
[abartlet/samba.git/.git] / source / include / rpc_misc.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
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
8    
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.
13    
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.
18    
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.
22 */
23
24 #ifndef _RPC_MISC_H /* _RPC_MISC_H */
25 #define _RPC_MISC_H 
26
27
28 #include "rpc_dce.h"
29
30 /* pipe string names */
31 #define PIPE_SRVSVC   "\\PIPE\\srvsvc"
32 #define PIPE_SAMR     "\\PIPE\\samr"
33 #define PIPE_WINREG   "\\PIPE\\winreg"
34 #define PIPE_WKSSVC   "\\PIPE\\wkssvc"
35 #define PIPE_NETLOGON "\\PIPE\\NETLOGON"
36 #define PIPE_NTLSA    "\\PIPE\\ntlsa"
37 #define PIPE_NTSVCS   "\\PIPE\\ntsvcs"
38 #define PIPE_LSASS    "\\PIPE\\lsass"
39 #define PIPE_LSARPC   "\\PIPE\\lsarpc"
40
41 /* well-known RIDs - Relative IDs */
42
43 /* RIDs - Well-known users ... */
44 #define DOMAIN_USER_RID_ADMIN          (0x000001F4L)
45 #define DOMAIN_USER_RID_GUEST          (0x000001F5L)
46
47 /* RIDs - well-known groups ... */
48 #define DOMAIN_GROUP_RID_ADMINS        (0x00000200L)
49 #define DOMAIN_GROUP_RID_USERS         (0x00000201L)
50 #define DOMAIN_GROUP_RID_GUESTS        (0x00000202L)
51
52 /* RIDs - well-known aliases ... */
53 #define DOMAIN_ALIAS_RID_ADMINS        (0x00000220L)
54 #define DOMAIN_ALIAS_RID_USERS         (0x00000221L)
55 #define DOMAIN_ALIAS_RID_GUESTS        (0x00000222L)
56 #define DOMAIN_ALIAS_RID_POWER_USERS   (0x00000223L)
57
58 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS   (0x00000224L)
59 #define DOMAIN_ALIAS_RID_SYSTEM_OPS    (0x00000225L)
60 #define DOMAIN_ALIAS_RID_PRINT_OPS     (0x00000226L)
61 #define DOMAIN_ALIAS_RID_BACKUP_OPS    (0x00000227L)
62
63 #define DOMAIN_ALIAS_RID_REPLICATOR    (0x00000228L)
64
65 /* ENUM_HND */
66 typedef struct enum_hnd_info
67 {
68         uint32 ptr_hnd;          /* pointer to enumeration handle */
69         uint32 handle;           /* enumeration handle */
70
71 } ENUM_HND;
72
73 /* LOOKUP_LEVEL - switch value */
74 typedef struct lookup_level_info
75 {
76   uint16 value;
77
78 } LOOKUP_LEVEL;
79
80 #define MAXSUBAUTHS 15 /* max sub authorities in a SID */
81
82 /* DOM_SID - security id */
83 typedef struct sid_info
84 {
85   uint8  sid_rev_num;             /* SID revision number */
86   uint8  num_auths;               /* number of sub-authorities */
87   uint8  id_auth[6];              /* Identifier Authority */
88   uint32 sub_auths[MAXSUBAUTHS];  /* pointer to sub-authorities. */
89
90 } DOM_SID;
91
92 /* DOM_SID2 - security id */
93 typedef struct sid_info_2
94 {
95         uint32 num_auths; /* length, bytes, including length of len :-) */
96
97         DOM_SID sid;
98
99 } DOM_SID2;
100
101 /* STRHDR - string header */
102 typedef struct header_info
103 {
104   uint16 str_max_len;
105   uint16 str_str_len;
106   uint32 buffer; /* non-zero */
107
108 } STRHDR;
109
110 /* UNIHDR - unicode string header */
111 typedef struct unihdr_info
112 {
113   uint16 uni_max_len;
114   uint16 uni_str_len;
115   uint32 buffer; /* usually has a value of 4 */
116
117 } UNIHDR;
118
119 /* UNIHDR2 - unicode string header and undocumented buffer */
120 typedef struct unihdr2_info
121 {
122   UNIHDR unihdr;
123   uint32 buffer; /* 32 bit buffer pointer */
124
125 } UNIHDR2;
126
127 /* clueless as to what maximum length should be */
128 #define MAX_UNISTRLEN 256
129 #define MAX_STRINGLEN 256
130
131 /* UNISTR - unicode string size and buffer */
132 typedef struct unistr_info
133 {
134   uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. ***MUST*** be null-terminated */
135
136 } UNISTR;
137
138 /* UNINOTSTR2 - unicode string, size (in uint8 ascii chars) and buffer */
139 /* pathetic.  some stupid team of \PIPE\winreg writers got the concept */
140 /* of a unicode string different from the other \PIPE\ writers */
141 typedef struct uninotstr2_info
142 {
143   uint32 uni_max_len;
144   uint32 undoc;
145   uint32 uni_buf_len;
146   uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */
147
148 } UNINOTSTR2;
149
150 /* UNISTR2 - unicode string size (in uint16 unicode chars) and buffer */
151 typedef struct unistr2_info
152 {
153   uint32 uni_max_len;
154   uint32 undoc;
155   uint32 uni_str_len;
156   uint16 buffer[MAX_UNISTRLEN]; /* unicode characters. **NOT** necessarily null-terminated */
157
158 } UNISTR2;
159
160 /* STRING2 - string size (in uint8 chars) and buffer */
161 typedef struct string2_info
162 {
163   uint32 str_max_len;
164   uint32 undoc;
165   uint32 str_str_len;
166   uint8  buffer[MAX_STRINGLEN]; /* uint8 characters. **NOT** necessarily null-terminated */
167
168 } STRING2;
169
170
171 /* DOM_RID2 - domain RID structure for ntlsa pipe */
172 typedef struct domrid2_info
173 {
174   uint32 type; /* value is 5 */
175   uint32 undoc; /* value is non-zero */
176   uint32 rid;
177   uint32 rid_idx; /* don't know what this is */
178
179 } DOM_RID2;
180
181 /* DOM_RID3 - domain RID structure for samr pipe */
182 typedef struct domrid3_info
183 {
184   uint32 rid;        /* domain-relative (to a SID) id */
185   uint32 type1;      /* value is 0x1 */
186   uint32 ptr_type;   /* undocumented pointer */
187   uint32 type2;      /* value is 0x1 */
188
189 } DOM_RID3;
190
191 /* DOM_RID4 - rid + user attributes */
192 typedef struct domrid4_info
193 {
194   uint32 unknown;      
195   uint16 attr;
196   uint32 rid;  /* user RID */
197
198 } DOM_RID4;
199
200 /* DOM_CLNT_SRV - client / server names */
201 typedef struct clnt_srv_info
202 {
203   uint32  undoc_buffer; /* undocumented 32 bit buffer pointer */
204   UNISTR2 uni_logon_srv; /* logon server name */
205   uint32  undoc_buffer2; /* undocumented 32 bit buffer pointer */
206   UNISTR2 uni_comp_name; /* client machine name */
207
208 } DOM_CLNT_SRV;
209
210 /* DOM_LOG_INFO - login info */
211 typedef struct log_info
212 {
213   uint32  undoc_buffer; /* undocumented 32 bit buffer pointer */
214   UNISTR2 uni_logon_srv; /* logon server name */
215   UNISTR2 uni_acct_name; /* account name */
216   uint16  sec_chan;      /* secure channel type */
217   UNISTR2 uni_comp_name; /* client machine name */
218
219 } DOM_LOG_INFO;
220
221 /* DOM_CLNT_INFO - client info */
222 typedef struct clnt_info
223 {
224   DOM_LOG_INFO login;
225   DOM_CRED     cred;
226
227 } DOM_CLNT_INFO;
228
229 /* DOM_CLNT_INFO2 - client info */
230 typedef struct clnt_info2
231 {
232   DOM_CLNT_SRV login;
233   uint32        ptr_cred;
234   DOM_CRED      cred;
235
236 } DOM_CLNT_INFO2;
237
238 /* DOM_LOGON_ID - logon id */
239 typedef struct logon_info
240 {
241   uint32 low;
242   uint32 high;
243
244 } DOM_LOGON_ID;
245
246 /* ARC4_OWF */
247 typedef struct arc4_owf_info
248 {
249   uint8 data[16];
250
251 } ARC4_OWF;
252
253
254 /* DOM_GID - group id + user attributes */
255 typedef struct gid_info
256 {
257   uint32 g_rid;  /* a group RID */
258   uint32 attr;
259
260 } DOM_GID;
261
262 #define POL_HND_SIZE 20
263
264 /* POLICY_HND */
265 typedef struct lsa_policy_info
266 {
267   uint8 data[POL_HND_SIZE]; /* policy handle */
268
269 } POLICY_HND;
270
271 #endif /* _RPC_MISC_H */
272