Merge branch 'v3-2-test' of ssh://git.samba.org/data/git/samba into v3-2-test
[samba.git] / source3 / include / rpc_lsa.h
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB parameters and setup
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
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 3 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, see <http://www.gnu.org/licenses/>.
21 */
22
23 #ifndef _RPC_LSA_H /* _RPC_LSA_H */
24 #define _RPC_LSA_H 
25
26 /* Opcodes available on PIPE_LSARPC */
27
28 #define LSA_CLOSE              0x00
29 #define LSA_DELETE             0x01
30 #define LSA_ENUM_PRIVS         0x02
31 #define LSA_QUERYSECOBJ        0x03
32 #define LSA_SETSECOBJ          0x04
33 #define LSA_CHANGEPASSWORD     0x05
34 #define LSA_OPENPOLICY         0x06
35 #define LSA_QUERYINFOPOLICY    0x07
36 #define LSA_SETINFOPOLICY      0x08
37 #define LSA_CLEARAUDITLOG      0x09
38 #define LSA_CREATEACCOUNT      0x0a
39 #define LSA_ENUM_ACCOUNTS      0x0b
40 #define LSA_CREATETRUSTDOM     0x0c     /* TODO: implement this one  -- jerry */
41 #define LSA_ENUMTRUSTDOM       0x0d
42 #define LSA_LOOKUPNAMES        0x0e
43 #define LSA_LOOKUPSIDS         0x0f
44 #define LSA_CREATESECRET       0x10     /* TODO: implement this one  -- jerry */
45 #define LSA_OPENACCOUNT        0x11
46 #define LSA_ENUMPRIVSACCOUNT   0x12
47 #define LSA_ADDPRIVS           0x13
48 #define LSA_REMOVEPRIVS        0x14
49 #define LSA_GETQUOTAS          0x15
50 #define LSA_SETQUOTAS          0x16
51 #define LSA_GETSYSTEMACCOUNT   0x17
52 #define LSA_SETSYSTEMACCOUNT   0x18
53 #define LSA_OPENTRUSTDOM       0x19
54 #define LSA_QUERYTRUSTDOMINFO  0x1a
55 #define LSA_SETINFOTRUSTDOM    0x1b
56 #define LSA_OPENSECRET         0x1c     /* TODO: implement this one  -- jerry */
57 #define LSA_SETSECRET          0x1d     /* TODO: implement this one  -- jerry */
58 #define LSA_QUERYSECRET        0x1e
59 #define LSA_LOOKUPPRIVVALUE    0x1f
60 #define LSA_LOOKUPPRIVNAME     0x20
61 #define LSA_PRIV_GET_DISPNAME  0x21
62 #define LSA_DELETEOBJECT       0x22     /* TODO: implement this one  -- jerry */
63 #define LSA_ENUMACCTWITHRIGHT  0x23     /* TODO: implement this one  -- jerry */
64 #define LSA_ENUMACCTRIGHTS     0x24
65 #define LSA_ADDACCTRIGHTS      0x25
66 #define LSA_REMOVEACCTRIGHTS   0x26
67 #define LSA_QUERYTRUSTDOMINFOBYSID  0x27
68 #define LSA_SETTRUSTDOMINFO    0x28
69 #define LSA_DELETETRUSTDOM     0x29
70 #define LSA_STOREPRIVDATA      0x2a
71 #define LSA_RETRPRIVDATA       0x2b
72 #define LSA_OPENPOLICY2        0x2c
73 #define LSA_UNK_GET_CONNUSER   0x2d /* LsaGetConnectedCredentials ? */
74 #define LSA_QUERYINFO2         0x2e
75 #define LSA_QUERYTRUSTDOMINFOBYNAME 0x30
76 #define LSA_QUERYDOMINFOPOL    0x35
77 #define LSA_OPENTRUSTDOMBYNAME 0x37
78
79 #define LSA_LOOKUPSIDS2        0x39
80 #define LSA_LOOKUPNAMES2       0x3a
81 #define LSA_LOOKUPNAMES3       0x44
82 #define LSA_LOOKUPSIDS3        0x4c
83 #define LSA_LOOKUPNAMES4       0x4d
84
85 /* XXXX these are here to get a compile! */
86 #define LSA_LOOKUPRIDS      0xFD
87
88 #define LSA_AUDIT_NUM_CATEGORIES_NT4    7
89 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K  9
90 #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4
91
92 /* level 1 is auditing settings */
93 typedef struct dom_query_1
94 {
95         uint32 percent_full;
96         uint32 log_size;
97         NTTIME retention_time;
98         uint8 shutdown_in_progress;
99         NTTIME time_to_shutdown;
100         uint32 next_audit_record;
101         uint32 unknown;
102 } DOM_QUERY_1;
103
104
105 /* level 2 is auditing settings */
106 typedef struct dom_query_2
107 {
108         uint32 auditing_enabled;
109         uint32 count1; /* usualy 7, at least on nt4sp4 */
110         uint32 count2; /* the same */
111         uint32 ptr;
112         uint32 *auditsettings;
113 } DOM_QUERY_2;
114
115 /* DOM_QUERY - info class 3 and 5 LSA Query response */
116 typedef struct dom_query_info_3
117 {
118         uint16 uni_dom_max_len; /* domain name string length * 2 */
119         uint16 uni_dom_str_len; /* domain name string length * 2 */
120         uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */
121         uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */
122         UNISTR2 uni_domain_name; /* domain name (unicode string) */
123         DOM_SID2 dom_sid; /* domain SID */
124
125 } DOM_QUERY_3;
126
127 /* level 5 is same as level 3. */
128 typedef DOM_QUERY_3 DOM_QUERY_5;
129
130 /* level 6 is server role information */
131 typedef struct dom_query_6
132 {
133         uint16 server_role; /* 2=backup, 3=primary */
134 } DOM_QUERY_6;
135
136 /* level 10 is audit full set info */
137 typedef struct dom_query_10
138 {
139         uint8 shutdown_on_full;
140 } DOM_QUERY_10;
141
142 /* level 11 is audit full query info */
143 typedef struct dom_query_11
144 {
145         uint16 unknown;
146         uint8 shutdown_on_full;
147         uint8 log_is_full;
148 } DOM_QUERY_11;
149
150 /* level 12 is DNS domain info */
151 typedef struct lsa_dns_dom_info
152 {
153         UNIHDR  hdr_nb_dom_name; /* netbios domain name */
154         UNIHDR  hdr_dns_dom_name;
155         UNIHDR  hdr_forest_name;
156
157         struct GUID dom_guid; /* domain GUID */
158
159         UNISTR2 uni_nb_dom_name;
160         UNISTR2 uni_dns_dom_name;
161         UNISTR2 uni_forest_name;
162
163         uint32 ptr_dom_sid;
164         DOM_SID2   dom_sid; /* domain SID */
165 } DOM_QUERY_12;
166
167 typedef struct seq_qos_info
168 {
169         uint32 len; /* 12 */
170         uint16 sec_imp_level; /* 0x02 - impersonation level */
171         uint8  sec_ctxt_mode; /* 0x01 - context tracking mode */
172         uint8  effective_only; /* 0x00 - effective only */
173
174 } LSA_SEC_QOS;
175
176 typedef struct obj_attr_info
177 {
178         uint32 len;          /* 0x18 - length (in bytes) inc. the length field. */
179         uint32 ptr_root_dir; /* 0 - root directory (pointer) */
180         uint32 ptr_obj_name; /* 0 - object name (pointer) */
181         uint32 attributes;   /* 0 - attributes (undocumented) */
182         uint32 ptr_sec_desc; /* 0 - security descriptior (pointer) */
183         uint32 ptr_sec_qos;  /* security quality of service */
184         LSA_SEC_QOS *sec_qos;
185
186 } LSA_OBJ_ATTR;
187
188 /* LSA_Q_OPEN_POL - LSA Query Open Policy */
189 typedef struct lsa_q_open_pol_info
190 {
191         uint32 ptr;         /* undocumented buffer pointer */
192         uint16 system_name; /* 0x5c - system name */
193         LSA_OBJ_ATTR attr ; /* object attributes */
194
195         uint32 des_access; /* desired access attributes */
196
197 } LSA_Q_OPEN_POL;
198
199 /* LSA_R_OPEN_POL - response to LSA Open Policy */
200 typedef struct lsa_r_open_pol_info
201 {
202         POLICY_HND pol; /* policy handle */
203         NTSTATUS status; /* return code */
204
205 } LSA_R_OPEN_POL;
206
207 /* LSA_Q_OPEN_POL2 - LSA Query Open Policy */
208 typedef struct lsa_q_open_pol2_info
209 {
210         uint32       ptr;             /* undocumented buffer pointer */
211         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
212         LSA_OBJ_ATTR attr           ; /* object attributes */
213
214         uint32 des_access; /* desired access attributes */
215
216 } LSA_Q_OPEN_POL2;
217
218 /* LSA_R_OPEN_POL2 - response to LSA Open Policy */
219 typedef struct lsa_r_open_pol2_info
220 {
221         POLICY_HND pol; /* policy handle */
222         NTSTATUS status; /* return code */
223
224 } LSA_R_OPEN_POL2;
225
226
227 #define POLICY_VIEW_LOCAL_INFORMATION    0x00000001
228 #define POLICY_VIEW_AUDIT_INFORMATION    0x00000002
229 #define POLICY_GET_PRIVATE_INFORMATION   0x00000004
230 #define POLICY_TRUST_ADMIN               0x00000008
231 #define POLICY_CREATE_ACCOUNT            0x00000010
232 #define POLICY_CREATE_SECRET             0x00000020
233 #define POLICY_CREATE_PRIVILEGE          0x00000040
234 #define POLICY_SET_DEFAULT_QUOTA_LIMITS  0x00000080
235 #define POLICY_SET_AUDIT_REQUIREMENTS    0x00000100
236 #define POLICY_AUDIT_LOG_ADMIN           0x00000200
237 #define POLICY_SERVER_ADMIN              0x00000400
238 #define POLICY_LOOKUP_NAMES              0x00000800
239
240 #define POLICY_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED_ACCESS  |\
241                             POLICY_VIEW_LOCAL_INFORMATION    |\
242                             POLICY_VIEW_AUDIT_INFORMATION    |\
243                             POLICY_GET_PRIVATE_INFORMATION   |\
244                             POLICY_TRUST_ADMIN               |\
245                             POLICY_CREATE_ACCOUNT            |\
246                             POLICY_CREATE_SECRET             |\
247                             POLICY_CREATE_PRIVILEGE          |\
248                             POLICY_SET_DEFAULT_QUOTA_LIMITS  |\
249                             POLICY_SET_AUDIT_REQUIREMENTS    |\
250                             POLICY_AUDIT_LOG_ADMIN           |\
251                             POLICY_SERVER_ADMIN              |\
252                             POLICY_LOOKUP_NAMES )
253
254
255 #define POLICY_READ       ( STANDARD_RIGHTS_READ_ACCESS      |\
256                             POLICY_VIEW_AUDIT_INFORMATION    |\
257                             POLICY_GET_PRIVATE_INFORMATION)
258
259 #define POLICY_WRITE      ( STD_RIGHT_READ_CONTROL_ACCESS     |\
260                             POLICY_TRUST_ADMIN               |\
261                             POLICY_CREATE_ACCOUNT            |\
262                             POLICY_CREATE_SECRET             |\
263                             POLICY_CREATE_PRIVILEGE          |\
264                             POLICY_SET_DEFAULT_QUOTA_LIMITS  |\
265                             POLICY_SET_AUDIT_REQUIREMENTS    |\
266                             POLICY_AUDIT_LOG_ADMIN           |\
267                             POLICY_SERVER_ADMIN)
268
269 #define POLICY_EXECUTE    ( STANDARD_RIGHTS_EXECUTE_ACCESS   |\
270                             POLICY_VIEW_LOCAL_INFORMATION    |\
271                             POLICY_LOOKUP_NAMES )
272
273 /* LSA_Q_QUERY_SEC_OBJ - LSA query security */
274 typedef struct lsa_query_sec_obj_info
275 {
276         POLICY_HND pol; /* policy handle */
277         uint32 sec_info;
278
279 } LSA_Q_QUERY_SEC_OBJ;
280
281 /* LSA_R_QUERY_SEC_OBJ - probably an open */
282 typedef struct r_lsa_query_sec_obj_info
283 {
284         uint32 ptr;
285         SEC_DESC_BUF *buf;
286
287         NTSTATUS status;         /* return status */
288
289 } LSA_R_QUERY_SEC_OBJ;
290
291 /* LSA_Q_QUERY_INFO - LSA query info policy */
292 typedef struct lsa_query_info
293 {
294         POLICY_HND pol; /* policy handle */
295         uint16 info_class; /* info class */
296
297 } LSA_Q_QUERY_INFO;
298
299 /* LSA_INFO_CTR */
300 typedef struct lsa_info_ctr
301 {
302         uint16 info_class;
303         union {
304                 DOM_QUERY_1 id1;
305                 DOM_QUERY_2 id2;
306                 DOM_QUERY_3 id3;
307                 DOM_QUERY_5 id5;
308                 DOM_QUERY_6 id6;
309                 DOM_QUERY_10 id10;
310                 DOM_QUERY_11 id11;
311                 DOM_QUERY_12 id12;
312         } info;
313
314 } LSA_INFO_CTR;
315
316 typedef LSA_INFO_CTR LSA_INFO_CTR2;
317
318 /* LSA_R_QUERY_INFO - response to LSA query info policy */
319 typedef struct lsa_r_query_info
320 {
321         uint32 dom_ptr; /* undocumented buffer pointer */
322         LSA_INFO_CTR ctr; 
323         NTSTATUS status; /* return code */
324
325 } LSA_R_QUERY_INFO;
326
327 typedef LSA_Q_QUERY_INFO LSA_Q_QUERY_INFO2;
328 typedef LSA_R_QUERY_INFO LSA_R_QUERY_INFO2;
329
330 /*******************************************************/
331
332 typedef struct {
333         POLICY_HND pol; 
334         uint32 enum_context; 
335         uint32 preferred_len;   /* preferred maximum length */
336 } LSA_Q_ENUM_TRUST_DOM;
337
338 typedef struct {
339         UNISTR4 name;
340         DOM_SID2 *sid;
341 } DOMAIN_INFO;
342
343 typedef struct {
344         uint32 count;
345         DOMAIN_INFO *domains;
346 } DOMAIN_LIST;
347
348 typedef struct {
349         uint32 enum_context;
350         uint32 count;
351         DOMAIN_LIST *domlist;
352         NTSTATUS status; 
353 } LSA_R_ENUM_TRUST_DOM;
354
355 /*******************************************************/
356
357 /* LSA_Q_CLOSE */
358 typedef struct lsa_q_close_info
359 {
360         POLICY_HND pol; /* policy handle */
361
362 } LSA_Q_CLOSE;
363
364 /* LSA_R_CLOSE */
365 typedef struct lsa_r_close_info
366 {
367         POLICY_HND pol; /* policy handle.  should be all zeros. */
368
369         NTSTATUS status; /* return code */
370
371 } LSA_R_CLOSE;
372
373
374 #define MAX_REF_DOMAINS 32
375
376 /* DOM_TRUST_HDR */
377 typedef struct dom_trust_hdr
378 {
379         UNIHDR hdr_dom_name; /* referenced domain unicode string headers */
380         uint32 ptr_dom_sid;
381
382 } DOM_TRUST_HDR;
383         
384 /* DOM_TRUST_INFO */
385 typedef struct dom_trust_info
386 {
387         UNISTR2  uni_dom_name; /* domain name unicode string */
388         DOM_SID2 ref_dom     ; /* referenced domain SID */
389
390 } DOM_TRUST_INFO;
391         
392 /* DOM_R_REF */
393 typedef struct dom_ref_info
394 {
395         uint32 num_ref_doms_1; /* num referenced domains */
396         uint32 ptr_ref_dom; /* pointer to referenced domains */
397         uint32 max_entries; /* 32 - max number of entries */
398         uint32 num_ref_doms_2; /* num referenced domains */
399
400         DOM_TRUST_HDR  hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domains */
401         DOM_TRUST_INFO ref_dom    [MAX_REF_DOMAINS]; /* referenced domains */
402
403 } DOM_R_REF;
404
405 /* the domain_idx points to a SID associated with the name */
406
407 /* LSA_TRANS_NAME - translated name */
408 typedef struct lsa_trans_name_info
409 {
410         uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */
411         UNIHDR hdr_name; 
412         uint32 domain_idx; /* index into DOM_R_REF array of SIDs */
413
414 } LSA_TRANS_NAME;
415
416 /* LSA_TRANS_NAME2 - translated name */
417 typedef struct lsa_trans_name_info2
418 {
419         uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */
420         UNIHDR hdr_name; 
421         uint32 domain_idx; /* index into DOM_R_REF array of SIDs */
422         uint32 unknown;
423
424 } LSA_TRANS_NAME2;
425
426 /* This number is based on Win2k and later maximum response allowed */
427 #define MAX_LOOKUP_SIDS 20480   /* 0x5000 */
428
429 /* LSA_TRANS_NAME_ENUM - LSA Translated Name Enumeration container */
430 typedef struct lsa_trans_name_enum_info
431 {
432         uint32 num_entries;
433         uint32 ptr_trans_names;
434         uint32 num_entries2;
435         
436         LSA_TRANS_NAME *name; /* translated names  */
437         UNISTR2 *uni_name;
438
439 } LSA_TRANS_NAME_ENUM;
440
441 /* LSA_TRANS_NAME_ENUM2 - LSA Translated Name Enumeration container 2 */
442 typedef struct lsa_trans_name_enum_info2
443 {
444         uint32 num_entries;
445         uint32 ptr_trans_names;
446         uint32 num_entries2;
447         
448         LSA_TRANS_NAME2 *name; /* translated names  */
449         UNISTR2 *uni_name;
450
451 } LSA_TRANS_NAME_ENUM2;
452
453 /* LSA_SID_ENUM - LSA SID enumeration container */
454 typedef struct lsa_sid_enum_info
455 {
456         uint32 num_entries;
457         uint32 ptr_sid_enum;
458         uint32 num_entries2;
459         
460         uint32 *ptr_sid; /* domain SID pointers to be looked up. */
461         DOM_SID2 *sid; /* domain SIDs to be looked up. */
462
463 } LSA_SID_ENUM;
464
465 /* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */
466 typedef struct lsa_q_lookup_sids
467 {
468         POLICY_HND          pol; /* policy handle */
469         LSA_SID_ENUM        sids;
470         LSA_TRANS_NAME_ENUM names;
471         uint16              level;
472         uint32              mapped_count;
473
474 } LSA_Q_LOOKUP_SIDS;
475
476 /* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */
477 typedef struct lsa_r_lookup_sids
478 {
479         uint32              ptr_dom_ref;
480         DOM_R_REF           *dom_ref; /* domain reference info */
481
482         LSA_TRANS_NAME_ENUM names;
483         uint32              mapped_count;
484
485         NTSTATUS            status; /* return code */
486
487 } LSA_R_LOOKUP_SIDS;
488
489 /* LSA_Q_LOOKUP_SIDS2 - LSA Lookup SIDs 2*/
490 typedef struct lsa_q_lookup_sids2
491 {
492         POLICY_HND          pol; /* policy handle */
493         LSA_SID_ENUM        sids;
494         LSA_TRANS_NAME_ENUM2 names;
495         uint16              level;
496         uint32              mapped_count;
497         uint32              unknown1;
498         uint32              unknown2;
499
500 } LSA_Q_LOOKUP_SIDS2;
501
502 /* LSA_R_LOOKUP_SIDS2 - response to LSA Lookup SIDs 2*/
503 typedef struct lsa_r_lookup_sids2
504 {
505         uint32              ptr_dom_ref;
506         DOM_R_REF           *dom_ref; /* domain reference info */
507
508         LSA_TRANS_NAME_ENUM2 names;
509         uint32              mapped_count;
510
511         NTSTATUS            status; /* return code */
512
513 } LSA_R_LOOKUP_SIDS2;
514
515 /* LSA_Q_LOOKUP_SIDS3 - LSA Lookup SIDs 3 */
516 typedef struct lsa_q_lookup_sids3
517 {
518         LSA_SID_ENUM        sids;
519         LSA_TRANS_NAME_ENUM2 names;
520         uint16              level;
521         uint32              mapped_count;
522         uint32              unknown1;
523         uint32              unknown2;
524
525 } LSA_Q_LOOKUP_SIDS3;
526
527 /* LSA_R_LOOKUP_SIDS3 - response to LSA Lookup SIDs 3 */
528 typedef struct lsa_r_lookup_sids3
529 {
530         uint32              ptr_dom_ref;
531         DOM_R_REF           *dom_ref; /* domain reference info */
532
533         LSA_TRANS_NAME_ENUM2 names;
534         uint32              mapped_count;
535
536         NTSTATUS            status; /* return code */
537
538 } LSA_R_LOOKUP_SIDS3;
539
540 /* LSA_Q_LOOKUP_NAMES - LSA Lookup NAMEs */
541 typedef struct lsa_q_lookup_names
542 {
543         POLICY_HND pol; /* policy handle */
544         uint32 num_entries;
545         uint32 num_entries2;
546         UNIHDR  *hdr_name; /* name buffer pointers */
547         UNISTR2 *uni_name; /* names to be looked up */
548
549         uint32 num_trans_entries;
550         uint32 ptr_trans_sids; /* undocumented domain SID buffer pointer */
551         uint16 lookup_level;
552         uint32 mapped_count;
553
554 } LSA_Q_LOOKUP_NAMES;
555
556 /* LSA_R_LOOKUP_NAMES - response to LSA Lookup NAMEs by name */
557 typedef struct lsa_r_lookup_names
558 {
559         uint32 ptr_dom_ref;
560         DOM_R_REF *dom_ref; /* domain reference info */
561
562         uint32 num_entries;
563         uint32 ptr_entries;
564         uint32 num_entries2;
565         DOM_RID *dom_rid; /* domain RIDs being looked up */
566
567         uint32 mapped_count;
568
569         NTSTATUS status; /* return code */
570 } LSA_R_LOOKUP_NAMES;
571
572 /* LSA_Q_LOOKUP_NAMES2 - LSA Lookup NAMEs 2*/
573 typedef struct lsa_q_lookup_names2
574 {
575         POLICY_HND pol; /* policy handle */
576         uint32 num_entries;
577         uint32 num_entries2;
578         UNIHDR  *hdr_name; /* name buffer pointers */
579         UNISTR2 *uni_name; /* names to be looked up */
580
581         uint32 num_trans_entries;
582         uint32 ptr_trans_sids; /* undocumented domain SID buffer pointer */
583         uint16 lookup_level;
584         uint32 mapped_count;
585         uint32 unknown1;
586         uint32 unknown2;
587
588 } LSA_Q_LOOKUP_NAMES2;
589
590 /* LSA_R_LOOKUP_NAMES2 - response to LSA Lookup NAMEs by name 2 */
591 typedef struct lsa_r_lookup_names2
592 {
593         uint32 ptr_dom_ref;
594         DOM_R_REF *dom_ref; /* domain reference info */
595
596         uint32 num_entries;
597         uint32 ptr_entries;
598         uint32 num_entries2;
599         DOM_RID2 *dom_rid; /* domain RIDs being looked up */
600
601         uint32 mapped_count;
602
603         NTSTATUS status; /* return code */
604 } LSA_R_LOOKUP_NAMES2;
605
606 /* LSA_Q_LOOKUP_NAMES3 - LSA Lookup NAMEs 3 */
607 typedef struct lsa_q_lookup_names3
608 {
609         POLICY_HND pol; /* policy handle */
610         uint32 num_entries;
611         uint32 num_entries2;
612         UNIHDR  *hdr_name; /* name buffer pointers */
613         UNISTR2 *uni_name; /* names to be looked up */
614
615         uint32 num_trans_entries;
616         uint32 ptr_trans_sids; /* undocumented domain SID buffer pointer */
617         uint16 lookup_level;
618         uint32 mapped_count;
619         uint32 unknown1;
620         uint32 unknown2;
621
622 } LSA_Q_LOOKUP_NAMES3;
623
624 /* Sid type used in lookupnames3 and lookupnames4. */
625 typedef struct lsa_translatedsid3 {
626         uint8 sid_type;
627         DOM_SID2 *sid2;
628         uint32 sid_idx;
629         uint32 unknown;
630 } LSA_TRANSLATED_SID3;
631
632 /* LSA_R_LOOKUP_NAMES3 - response to LSA Lookup NAMEs by name 3 */
633 typedef struct lsa_r_lookup_names3
634 {
635         uint32 ptr_dom_ref;
636         DOM_R_REF *dom_ref; /* domain reference info */
637
638         uint32 num_entries;
639         uint32 ptr_entries;
640         uint32 num_entries2;
641         LSA_TRANSLATED_SID3 *trans_sids;
642
643         uint32 mapped_count;
644
645         NTSTATUS status; /* return code */
646 } LSA_R_LOOKUP_NAMES3;
647
648 /* LSA_Q_LOOKUP_NAMES4 - LSA Lookup NAMEs 4 */
649 typedef struct lsa_q_lookup_names4
650 {
651         uint32 num_entries;
652         uint32 num_entries2;
653         UNIHDR  *hdr_name; /* name buffer pointers */
654         UNISTR2 *uni_name; /* names to be looked up */
655
656         uint32 num_trans_entries;
657         uint32 ptr_trans_sids; /* undocumented domain SID buffer pointer */
658         uint16 lookup_level;
659         uint32 mapped_count;
660         uint32 unknown1;
661         uint32 unknown2;
662
663 } LSA_Q_LOOKUP_NAMES4;
664
665 /* LSA_R_LOOKUP_NAMES3 - response to LSA Lookup NAMEs by name 4 */
666 typedef struct lsa_r_lookup_names4
667 {
668         uint32 ptr_dom_ref;
669         DOM_R_REF *dom_ref; /* domain reference info */
670
671         uint32 num_entries;
672         uint32 ptr_entries;
673         uint32 num_entries2;
674         LSA_TRANSLATED_SID3 *trans_sids;
675
676         uint32 mapped_count;
677
678         NTSTATUS status; /* return code */
679 } LSA_R_LOOKUP_NAMES4;
680
681 typedef struct lsa_enum_priv_entry
682 {
683         UNIHDR hdr_name;
684         uint32 luid_low;
685         uint32 luid_high;
686         UNISTR2 name;
687         
688 } LSA_PRIV_ENTRY;
689
690 /* LSA_Q_ENUM_PRIVS - LSA enum privileges */
691 typedef struct lsa_q_enum_privs
692 {
693         POLICY_HND pol; /* policy handle */
694         uint32 enum_context;
695         uint32 pref_max_length;
696 } LSA_Q_ENUM_PRIVS;
697
698 typedef struct lsa_r_enum_privs
699 {
700         uint32 enum_context;
701         uint32 count;
702         uint32 ptr;
703         uint32 count1;
704
705         LSA_PRIV_ENTRY *privs;
706
707         NTSTATUS status;
708 } LSA_R_ENUM_PRIVS;
709
710 /* LSA_Q_ENUM_ACCT_RIGHTS - LSA enum account rights */
711 typedef struct
712 {
713         POLICY_HND pol; /* policy handle */
714         DOM_SID2 sid;
715 } LSA_Q_ENUM_ACCT_RIGHTS;
716
717 /* LSA_R_ENUM_ACCT_RIGHTS - LSA enum account rights */
718 typedef struct
719 {
720         uint32 count;
721         UNISTR4_ARRAY *rights;
722         NTSTATUS status;
723 } LSA_R_ENUM_ACCT_RIGHTS;
724
725
726 /* LSA_Q_ADD_ACCT_RIGHTS - LSA add account rights */
727 typedef struct
728 {
729         POLICY_HND pol; /* policy handle */
730         DOM_SID2 sid;
731         uint32 count;
732         UNISTR4_ARRAY *rights;
733 } LSA_Q_ADD_ACCT_RIGHTS;
734
735 /* LSA_R_ADD_ACCT_RIGHTS - LSA add account rights */
736 typedef struct
737 {
738         NTSTATUS status;
739 } LSA_R_ADD_ACCT_RIGHTS;
740
741
742 /* LSA_Q_REMOVE_ACCT_RIGHTS - LSA remove account rights */
743 typedef struct
744 {
745         POLICY_HND pol; /* policy handle */
746         DOM_SID2 sid;
747         uint32 removeall;
748         uint32 count;
749         UNISTR4_ARRAY *rights;
750 } LSA_Q_REMOVE_ACCT_RIGHTS;
751
752 /* LSA_R_REMOVE_ACCT_RIGHTS - LSA remove account rights */
753 typedef struct
754 {
755         NTSTATUS status;
756 } LSA_R_REMOVE_ACCT_RIGHTS;
757
758
759 /* LSA_Q_PRIV_GET_DISPNAME - LSA get privilege display name */
760 typedef struct lsa_q_priv_get_dispname
761 {
762         POLICY_HND pol; /* policy handle */
763         UNIHDR hdr_name;
764         UNISTR2 name;
765         uint16 lang_id;
766         uint16 lang_id_sys;
767 } LSA_Q_PRIV_GET_DISPNAME;
768
769 typedef struct lsa_r_priv_get_dispname
770 {
771         uint32 ptr_info;
772         UNIHDR hdr_desc;
773         UNISTR2 desc;
774         /* Don't align ! */
775         uint16 lang_id;
776         /* align */
777         NTSTATUS status;
778 } LSA_R_PRIV_GET_DISPNAME;
779
780 /* LSA_Q_ENUM_ACCOUNTS */
781 typedef struct lsa_q_enum_accounts
782 {
783         POLICY_HND pol; /* policy handle */
784         uint32 enum_context;
785         uint32 pref_max_length;
786 } LSA_Q_ENUM_ACCOUNTS;
787
788 /* LSA_R_ENUM_ACCOUNTS */
789 typedef struct lsa_r_enum_accounts
790 {
791         uint32 enum_context;
792         LSA_SID_ENUM sids;
793         NTSTATUS status;
794 } LSA_R_ENUM_ACCOUNTS;
795
796 /* LSA_Q_UNK_GET_CONNUSER - gets username\domain of connected user
797                   called when "Take Ownership" is clicked -SK */
798 typedef struct lsa_q_unk_get_connuser
799 {
800   uint32 ptr_srvname;
801   UNISTR2 uni2_srvname;
802   uint32 unk1; /* 3 unknown uint32's are seen right after uni2_srvname */
803   uint32 unk2; /* unk2 appears to be a ptr, unk1 = unk3 = 0 usually */
804   uint32 unk3; 
805 } LSA_Q_UNK_GET_CONNUSER;
806
807 /* LSA_R_UNK_GET_CONNUSER */
808 typedef struct lsa_r_unk_get_connuser
809 {
810   uint32 ptr_user_name;
811   UNIHDR hdr_user_name;
812   UNISTR2 uni2_user_name;
813   
814   uint32 unk1;
815   
816   uint32 ptr_dom_name;
817   UNIHDR hdr_dom_name;
818   UNISTR2 uni2_dom_name;
819
820   NTSTATUS status;
821 } LSA_R_UNK_GET_CONNUSER;
822
823
824 typedef struct lsa_q_createaccount
825 {
826         POLICY_HND pol; /* policy handle */
827         DOM_SID2 sid;
828         uint32 access; /* access */
829 } LSA_Q_CREATEACCOUNT;
830
831 typedef struct lsa_r_createaccount
832 {
833         POLICY_HND pol; /* policy handle */
834         NTSTATUS status;
835 } LSA_R_CREATEACCOUNT;
836
837
838 typedef struct lsa_q_openaccount
839 {
840         POLICY_HND pol; /* policy handle */
841         DOM_SID2 sid;
842         uint32 access; /* desired access */
843 } LSA_Q_OPENACCOUNT;
844
845 typedef struct lsa_r_openaccount
846 {
847         POLICY_HND pol; /* policy handle */
848         NTSTATUS status;
849 } LSA_R_OPENACCOUNT;
850
851 typedef struct lsa_q_enumprivsaccount
852 {
853         POLICY_HND pol; /* policy handle */
854 } LSA_Q_ENUMPRIVSACCOUNT;
855
856 typedef struct lsa_r_enumprivsaccount
857 {
858         uint32 ptr;
859         uint32 count;
860         PRIVILEGE_SET set;
861         NTSTATUS status;
862 } LSA_R_ENUMPRIVSACCOUNT;
863
864 typedef struct lsa_q_getsystemaccount
865 {
866         POLICY_HND pol; /* policy handle */
867 } LSA_Q_GETSYSTEMACCOUNT;
868
869 typedef struct lsa_r_getsystemaccount
870 {
871         uint32 access;
872         NTSTATUS status;
873 } LSA_R_GETSYSTEMACCOUNT;
874
875
876 typedef struct lsa_q_setsystemaccount
877 {
878         POLICY_HND pol; /* policy handle */
879         uint32 access;
880 } LSA_Q_SETSYSTEMACCOUNT;
881
882 typedef struct lsa_r_setsystemaccount
883 {
884         NTSTATUS status;
885 } LSA_R_SETSYSTEMACCOUNT;
886
887 typedef struct {
888         UNIHDR hdr;
889         UNISTR2 unistring;
890 } LSA_STRING;
891
892 typedef struct {
893         POLICY_HND pol; /* policy handle */
894         LSA_STRING privname;
895 } LSA_Q_LOOKUP_PRIV_VALUE;
896
897 typedef struct {
898         LUID luid;
899         NTSTATUS status;
900 } LSA_R_LOOKUP_PRIV_VALUE;
901
902 typedef struct lsa_q_addprivs
903 {
904         POLICY_HND pol; /* policy handle */
905         uint32 count;
906         PRIVILEGE_SET set;
907 } LSA_Q_ADDPRIVS;
908
909 typedef struct lsa_r_addprivs
910 {
911         NTSTATUS status;
912 } LSA_R_ADDPRIVS;
913
914
915 typedef struct lsa_q_removeprivs
916 {
917         POLICY_HND pol; /* policy handle */
918         uint32 allrights;
919         uint32 ptr;
920         uint32 count;
921         PRIVILEGE_SET set;
922 } LSA_Q_REMOVEPRIVS;
923
924 typedef struct lsa_r_removeprivs
925 {
926         NTSTATUS status;
927 } LSA_R_REMOVEPRIVS;
928
929 /*******************************************************/
930
931 typedef struct {
932         POLICY_HND      handle;
933 } LSA_Q_DELETE_OBJECT;
934
935 typedef struct {
936         NTSTATUS        status;
937 } LSA_R_DELETE_OBJECT;
938
939 #endif /* _RPC_LSA_H */