Getting ready for first Red Hat Linux RPMs for 1.9.19 pre-alpha release
[samba.git] / source / include / rpc_lsa.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_LSA_H /* _RPC_LSA_H */
25 #define _RPC_LSA_H 
26
27 #include "rpc_misc.h"
28
29 enum SID_NAME_USE
30 {
31         SID_NAME_USER    = 1,
32         SID_NAME_DOM_GRP = 2, /* domain group */
33         SID_NAME_WKN_GRP = 5  /* well-known group */
34 };
35
36 /* ntlsa pipe */
37 #define LSA_OPENPOLICY         0x2c
38 #define LSA_QUERYINFOPOLICY    0x07
39 #define LSA_ENUMTRUSTDOM       0x0d
40 #define LSA_CLOSE              0x00
41 #define LSA_OPENSECRET         0x1C
42 #define LSA_LOOKUPSIDS         0x0f
43
44 /* XXXX these are here to get a compile! */
45 #define LSA_LOOKUPRIDS      0xFD
46 #define LSA_LOOKUPNAMES     0xFC
47
48 #define LSA_MAX_GROUPS 32
49 #define LSA_MAX_SIDS 32
50
51 /* DOM_QUERY - info class 3 and 5 LSA Query response */
52 typedef struct dom_query_info
53 {
54   uint16 uni_dom_max_len; /* domain name string length * 2 */
55   uint16 uni_dom_str_len; /* domain name string length * 2 */
56   uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */
57   uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */
58   UNISTR2 uni_domain_name; /* domain name (unicode string) */
59   DOM_SID2 dom_sid; /* domain SID */
60
61 } DOM_QUERY;
62
63 /* level 5 is same as level 3.  we hope. */
64 typedef DOM_QUERY DOM_QUERY_3;
65 typedef DOM_QUERY DOM_QUERY_5;
66
67
68 typedef struct obj_attr_info
69 {
70         uint32 len;          /* 0x18 - length (in bytes) inc. the length field. */
71         uint32 ptr_root_dir; /* 0 - root directory (pointer) */
72         uint32 ptr_obj_name; /* 0 - object name (pointer) */
73         uint32 attributes;   /* 0 - attributes (undocumented) */
74         uint32 ptr_sec_desc; /* 0 - security descriptior (pointer) */
75         uint32 sec_qos;      /* 0 - security quality of service */
76
77 } LSA_OBJ_ATTR;
78
79 /* LSA_Q_OPEN_POL - LSA Query Open Policy */
80 typedef struct lsa_q_open_pol_info
81 {
82         uint32       ptr;             /* undocumented buffer pointer */
83         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
84         LSA_OBJ_ATTR attr           ; /* object attributes */
85
86         uint32 des_access; /* desired access attributes */
87
88 } LSA_Q_OPEN_POL;
89
90 /* LSA_R_OPEN_POL - response to LSA Open Policy */
91 typedef struct lsa_r_open_pol_info
92 {
93         POLICY_HND pol; /* policy handle */
94         uint32 status; /* return code */
95
96 } LSA_R_OPEN_POL;
97
98 /* LSA_Q_QUERY_INFO - LSA query info policy */
99 typedef struct lsa_query_info
100 {
101         POLICY_HND pol; /* policy handle */
102     uint16 info_class; /* info class */
103
104 } LSA_Q_QUERY_INFO;
105
106 /* LSA_R_QUERY_INFO - response to LSA query info policy */
107 typedef struct lsa_r_query_info
108 {
109     uint32 undoc_buffer; /* undocumented buffer pointer */
110     uint16 info_class; /* info class (same as info class in request) */
111     
112         union
113     {
114         DOM_QUERY_3 id3;
115                 DOM_QUERY_5 id5;
116
117     } dom;
118
119         uint32 status; /* return code */
120
121 } LSA_R_QUERY_INFO;
122
123 /* LSA_Q_ENUM_TRUST_DOM - LSA enumerate trusted domains */
124 typedef struct lsa_enum_trust_dom_info
125 {
126         POLICY_HND pol; /* policy handle */
127     uint32 enum_context; /* enumeration context handle */
128     uint32 preferred_len; /* preferred maximum length */
129
130 } LSA_Q_ENUM_TRUST_DOM;
131
132 /* LSA_R_ENUM_TRUST_DOM - response to LSA enumerate trusted domains */
133 typedef struct lsa_r_enum_trust_dom_info
134 {
135         uint32 enum_context; /* enumeration context handle */
136         uint32 num_domains; /* number of domains */
137         uint32 ptr_enum_domains; /* buffer pointer to num domains */
138
139         /* this lot is only added if ptr_enum_domains is non-NULL */
140                 uint32 num_domains2; /* number of domains */
141                 UNIHDR2 hdr_domain_name;
142                 UNISTR2 uni_domain_name;
143                 DOM_SID2 other_domain_sid;
144
145     uint32 status; /* return code */
146
147 } LSA_R_ENUM_TRUST_DOM;
148
149 /* LSA_Q_CLOSE */
150 typedef struct lsa_q_close_info
151 {
152         POLICY_HND pol; /* policy handle */
153
154 } LSA_Q_CLOSE;
155
156 /* LSA_R_CLOSE */
157 typedef struct lsa_r_close_info
158 {
159         POLICY_HND pol; /* policy handle.  should be all zeros. */
160
161         uint32 status; /* return code */
162
163 } LSA_R_CLOSE;
164
165
166 #define MAX_REF_DOMAINS 10
167
168 /* DOM_R_REF */
169 typedef struct dom_ref_info
170 {
171     uint32 undoc_buffer; /* undocumented buffer pointer. */
172     uint32 num_ref_doms_1; /* num referenced domains? */
173     uint32 buffer_dom_name; /* undocumented domain name buffer pointer. */
174     uint32 max_entries; /* 32 - max number of entries */
175     uint32 num_ref_doms_2; /* 4 - num referenced domains? */
176
177     UNIHDR2 hdr_dom_name; /* domain name unicode string header */
178     UNIHDR2 hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domain unicode string headers */
179
180     UNISTR uni_dom_name; /* domain name unicode string */
181     DOM_SID2 ref_dom[MAX_REF_DOMAINS]; /* referenced domain SIDs */
182
183 } DOM_R_REF;
184
185 /* LSA_TRANS_NAME - translated name */
186 typedef struct lsa_trans_name_info
187 {
188         uint32 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */
189
190         UNIHDR  hdr_name; 
191         UNISTR2 uni_name; 
192
193         uint32 domain_idx;
194
195 } LSA_TRANS_NAME;
196
197 #define MAX_LOOKUP_SIDS 10
198
199 /* LSA_TRANS_NAME_ENUM - LSA Translated Name Enumeration container */
200 typedef struct lsa_trans_name_enum_info
201 {
202         uint32 num_entries;
203         uint32 ptr_trans_names;
204         uint32 num_entries2;
205         
206     uint32         ptr_name[MAX_LOOKUP_SIDS]; /* translated name pointers */
207     LSA_TRANS_NAME name    [MAX_LOOKUP_SIDS]; /* translated names  */
208
209 } LSA_TRANS_NAME_ENUM;
210
211 /* LSA_SID_ENUM - LSA SID enumeration container */
212 typedef struct lsa_sid_enum_info
213 {
214         uint32 num_entries;
215         uint32 ptr_sid_enum;
216         uint32 num_entries2;
217         
218     uint32   ptr_sid[MAX_LOOKUP_SIDS]; /* domain SID pointers to be looked up. */
219     DOM_SID2 sid    [MAX_LOOKUP_SIDS]; /* domain SIDs to be looked up. */
220
221 } LSA_SID_ENUM;
222
223 /* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */
224 typedef struct lsa_q_lookup_sids
225 {
226     POLICY_HND          pol_hnd; /* policy handle */
227         LSA_SID_ENUM        sids;
228         LSA_TRANS_NAME_ENUM names;
229         LOOKUP_LEVEL        level;
230         uint32              mapped_count;
231
232 } LSA_Q_LOOKUP_SIDS;
233
234 /* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */
235 typedef struct lsa_r_lookup_sids
236 {
237     DOM_R_REF           *dom_ref; /* domain reference info */
238         LSA_TRANS_NAME_ENUM *names;
239         uint32              mapped_count;
240
241         uint32              status; /* return code */
242
243 } LSA_R_LOOKUP_SIDS;
244
245 /* DOM_NAME - XXXX not sure about this structure */
246 typedef struct dom_name_info
247 {
248     uint32 uni_str_len;
249         UNISTR str;
250
251 } DOM_NAME;
252
253
254 #define UNKNOWN_LEN 1
255
256 /* LSA_Q_LOOKUP_RIDS - LSA Lookup RIDs */
257 typedef struct lsa_q_lookup_rids
258 {
259     POLICY_HND pol_hnd; /* policy handle */
260     uint32 num_entries;
261     uint32 num_entries2;
262     uint32 buffer_dom_sid; /* undocumented domain SID buffer pointer */
263     uint32 buffer_dom_name; /* undocumented domain name buffer pointer */
264     DOM_NAME lookup_name[MAX_LOOKUP_SIDS]; /* names to be looked up */
265     uint8 undoc[UNKNOWN_LEN]; /* completely undocumented bytes of unknown length */
266
267 } LSA_Q_LOOKUP_RIDS;
268
269 /* LSA_R_LOOKUP_RIDS - response to LSA Lookup RIDs by name */
270 typedef struct lsa_r_lookup_rids
271 {
272     DOM_R_REF dom_ref; /* domain reference info */
273
274     uint32 num_entries;
275     uint32 undoc_buffer; /* undocumented buffer pointer */
276
277     uint32 num_entries2; 
278     DOM_RID2 dom_rid[MAX_LOOKUP_SIDS]; /* domain RIDs being looked up */
279
280     uint32 num_entries3; 
281
282   uint32 status; /* return code */
283
284 } LSA_R_LOOKUP_RIDS;
285
286
287 #endif /* _RPC_LSA_H */
288