r13456: Add lsa_lookup_names2.
[bbaumbach/samba-autobuild/.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 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 /* Opcodes available on PIPE_LSARPC */
28
29 #define LSA_CLOSE              0x00
30 #define LSA_DELETE             0x01
31 #define LSA_ENUM_PRIVS         0x02
32 #define LSA_QUERYSECOBJ        0x03
33 #define LSA_SETSECOBJ          0x04
34 #define LSA_CHANGEPASSWORD     0x05
35 #define LSA_OPENPOLICY         0x06
36 #define LSA_QUERYINFOPOLICY    0x07
37 #define LSA_SETINFOPOLICY      0x08
38 #define LSA_CLEARAUDITLOG      0x09
39 #define LSA_CREATEACCOUNT      0x0a
40 #define LSA_ENUM_ACCOUNTS      0x0b
41 #define LSA_CREATETRUSTDOM     0x0c     /* TODO: implement this one  -- jerry */
42 #define LSA_ENUMTRUSTDOM       0x0d
43 #define LSA_LOOKUPNAMES        0x0e
44 #define LSA_LOOKUPSIDS         0x0f
45 #define LSA_CREATESECRET       0x10     /* TODO: implement this one  -- jerry */
46 #define LSA_OPENACCOUNT        0x11
47 #define LSA_ENUMPRIVSACCOUNT   0x12
48 #define LSA_ADDPRIVS           0x13
49 #define LSA_REMOVEPRIVS        0x14
50 #define LSA_GETQUOTAS          0x15
51 #define LSA_SETQUOTAS          0x16
52 #define LSA_GETSYSTEMACCOUNT   0x17
53 #define LSA_SETSYSTEMACCOUNT   0x18
54 #define LSA_OPENTRUSTDOM       0x19
55 #define LSA_QUERYTRUSTDOMINFO  0x1a
56 #define LSA_SETINFOTRUSTDOM    0x1b
57 #define LSA_OPENSECRET         0x1c     /* TODO: implement this one  -- jerry */
58 #define LSA_SETSECRET          0x1d     /* TODO: implement this one  -- jerry */
59 #define LSA_QUERYSECRET        0x1e
60 #define LSA_LOOKUPPRIVVALUE    0x1f
61 #define LSA_LOOKUPPRIVNAME     0x20
62 #define LSA_PRIV_GET_DISPNAME  0x21
63 #define LSA_DELETEOBJECT       0x22     /* TODO: implement this one  -- jerry */
64 #define LSA_ENUMACCTWITHRIGHT  0x23     /* TODO: implement this one  -- jerry */
65 #define LSA_ENUMACCTRIGHTS     0x24
66 #define LSA_ADDACCTRIGHTS      0x25
67 #define LSA_REMOVEACCTRIGHTS   0x26
68 #define LSA_QUERYTRUSTDOMINFOBYSID  0x27
69 #define LSA_SETTRUSTDOMINFO    0x28
70 #define LSA_DELETETRUSTDOM     0x29
71 #define LSA_STOREPRIVDATA      0x2a
72 #define LSA_RETRPRIVDATA       0x2b
73 #define LSA_OPENPOLICY2        0x2c
74 #define LSA_UNK_GET_CONNUSER   0x2d /* LsaGetConnectedCredentials ? */
75 #define LSA_QUERYINFO2         0x2e
76 #define LSA_QUERYTRUSTDOMINFOBYNAME 0x30
77 #define LSA_QUERYDOMINFOPOL    0x35
78 #define LSA_OPENTRUSTDOMBYNAME 0x37
79
80 #define LSA_LOOKUPSIDS2        0x39
81 #define LSA_LOOKUPNAMES2       0x3a
82 #define LSA_LOOKUPNAMES3       0x44
83 #define LSA_LOOKUPSIDS3        0x4c
84 #define LSA_LOOKUPNAMES4       0x4d
85
86 /* XXXX these are here to get a compile! */
87 #define LSA_LOOKUPRIDS      0xFD
88
89 /* DOM_QUERY - info class 3 and 5 LSA Query response */
90 typedef struct dom_query_info
91 {
92         uint16 uni_dom_max_len; /* domain name string length * 2 */
93         uint16 uni_dom_str_len; /* domain name string length * 2 */
94         uint32 buffer_dom_name; /* undocumented domain name string buffer pointer */
95         uint32 buffer_dom_sid; /* undocumented domain SID string buffer pointer */
96         UNISTR2 uni_domain_name; /* domain name (unicode string) */
97         DOM_SID2 dom_sid; /* domain SID */
98
99 } DOM_QUERY;
100
101 /* level 5 is same as level 3. */
102 typedef DOM_QUERY DOM_QUERY_3;
103 typedef DOM_QUERY DOM_QUERY_5;
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 *auditsettings;
112 } DOM_QUERY_2;
113
114 /* level 6 is server role information */
115 typedef struct dom_query_6
116 {
117         uint16 server_role; /* 2=backup, 3=primary */
118 } DOM_QUERY_6;
119
120 typedef struct seq_qos_info
121 {
122         uint32 len; /* 12 */
123         uint16 sec_imp_level; /* 0x02 - impersonation level */
124         uint8  sec_ctxt_mode; /* 0x01 - context tracking mode */
125         uint8  effective_only; /* 0x00 - effective only */
126
127 } LSA_SEC_QOS;
128
129 typedef struct obj_attr_info
130 {
131         uint32 len;          /* 0x18 - length (in bytes) inc. the length field. */
132         uint32 ptr_root_dir; /* 0 - root directory (pointer) */
133         uint32 ptr_obj_name; /* 0 - object name (pointer) */
134         uint32 attributes;   /* 0 - attributes (undocumented) */
135         uint32 ptr_sec_desc; /* 0 - security descriptior (pointer) */
136         uint32 ptr_sec_qos;  /* security quality of service */
137         LSA_SEC_QOS *sec_qos;
138
139 } LSA_OBJ_ATTR;
140
141 /* LSA_Q_OPEN_POL - LSA Query Open Policy */
142 typedef struct lsa_q_open_pol_info
143 {
144         uint32 ptr;         /* undocumented buffer pointer */
145         uint16 system_name; /* 0x5c - system name */
146         LSA_OBJ_ATTR attr ; /* object attributes */
147
148         uint32 des_access; /* desired access attributes */
149
150 } LSA_Q_OPEN_POL;
151
152 /* LSA_R_OPEN_POL - response to LSA Open Policy */
153 typedef struct lsa_r_open_pol_info
154 {
155         POLICY_HND pol; /* policy handle */
156         NTSTATUS status; /* return code */
157
158 } LSA_R_OPEN_POL;
159
160 /* LSA_Q_OPEN_POL2 - LSA Query Open Policy */
161 typedef struct lsa_q_open_pol2_info
162 {
163         uint32       ptr;             /* undocumented buffer pointer */
164         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
165         LSA_OBJ_ATTR attr           ; /* object attributes */
166
167         uint32 des_access; /* desired access attributes */
168
169 } LSA_Q_OPEN_POL2;
170
171 /* LSA_R_OPEN_POL2 - response to LSA Open Policy */
172 typedef struct lsa_r_open_pol2_info
173 {
174         POLICY_HND pol; /* policy handle */
175         NTSTATUS status; /* return code */
176
177 } LSA_R_OPEN_POL2;
178
179
180 #define POLICY_VIEW_LOCAL_INFORMATION    0x00000001
181 #define POLICY_VIEW_AUDIT_INFORMATION    0x00000002
182 #define POLICY_GET_PRIVATE_INFORMATION   0x00000004
183 #define POLICY_TRUST_ADMIN               0x00000008
184 #define POLICY_CREATE_ACCOUNT            0x00000010
185 #define POLICY_CREATE_SECRET             0x00000020
186 #define POLICY_CREATE_PRIVILEGE          0x00000040
187 #define POLICY_SET_DEFAULT_QUOTA_LIMITS  0x00000080
188 #define POLICY_SET_AUDIT_REQUIREMENTS    0x00000100
189 #define POLICY_AUDIT_LOG_ADMIN           0x00000200
190 #define POLICY_SERVER_ADMIN              0x00000400
191 #define POLICY_LOOKUP_NAMES              0x00000800
192
193 #define POLICY_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED_ACCESS  |\
194                             POLICY_VIEW_LOCAL_INFORMATION    |\
195                             POLICY_VIEW_AUDIT_INFORMATION    |\
196                             POLICY_GET_PRIVATE_INFORMATION   |\
197                             POLICY_TRUST_ADMIN               |\
198                             POLICY_CREATE_ACCOUNT            |\
199                             POLICY_CREATE_SECRET             |\
200                             POLICY_CREATE_PRIVILEGE          |\
201                             POLICY_SET_DEFAULT_QUOTA_LIMITS  |\
202                             POLICY_SET_AUDIT_REQUIREMENTS    |\
203                             POLICY_AUDIT_LOG_ADMIN           |\
204                             POLICY_SERVER_ADMIN              |\
205                             POLICY_LOOKUP_NAMES )
206
207
208 #define POLICY_READ       ( STANDARD_RIGHTS_READ_ACCESS      |\
209                             POLICY_VIEW_AUDIT_INFORMATION    |\
210                             POLICY_GET_PRIVATE_INFORMATION)
211
212 #define POLICY_WRITE      ( STD_RIGHT_READ_CONTROL_ACCESS     |\
213                             POLICY_TRUST_ADMIN               |\
214                             POLICY_CREATE_ACCOUNT            |\
215                             POLICY_CREATE_SECRET             |\
216                             POLICY_CREATE_PRIVILEGE          |\
217                             POLICY_SET_DEFAULT_QUOTA_LIMITS  |\
218                             POLICY_SET_AUDIT_REQUIREMENTS    |\
219                             POLICY_AUDIT_LOG_ADMIN           |\
220                             POLICY_SERVER_ADMIN)
221
222 #define POLICY_EXECUTE    ( STANDARD_RIGHTS_EXECUTE_ACCESS   |\
223                             POLICY_VIEW_LOCAL_INFORMATION    |\
224                             POLICY_LOOKUP_NAMES )
225
226 /* LSA_Q_QUERY_SEC_OBJ - LSA query security */
227 typedef struct lsa_query_sec_obj_info
228 {
229         POLICY_HND pol; /* policy handle */
230         uint32 sec_info;
231
232 } LSA_Q_QUERY_SEC_OBJ;
233
234 /* LSA_R_QUERY_SEC_OBJ - probably an open */
235 typedef struct r_lsa_query_sec_obj_info
236 {
237         uint32 ptr;
238         SEC_DESC_BUF *buf;
239
240         NTSTATUS status;         /* return status */
241
242 } LSA_R_QUERY_SEC_OBJ;
243
244 /* LSA_Q_QUERY_INFO - LSA query info policy */
245 typedef struct lsa_query_info
246 {
247         POLICY_HND pol; /* policy handle */
248     uint16 info_class; /* info class */
249
250 } LSA_Q_QUERY_INFO;
251
252 /* LSA_INFO_UNION */
253 typedef union lsa_info_union
254 {
255         DOM_QUERY_2 id2;
256         DOM_QUERY_3 id3;
257         DOM_QUERY_5 id5;
258         DOM_QUERY_6 id6;
259 } LSA_INFO_UNION;
260
261 /* LSA_R_QUERY_INFO - response to LSA query info policy */
262 typedef struct lsa_r_query_info
263 {
264     uint32 undoc_buffer; /* undocumented buffer pointer */
265     uint16 info_class; /* info class (same as info class in request) */
266    
267         LSA_INFO_UNION dom; 
268
269         NTSTATUS status; /* return code */
270
271 } LSA_R_QUERY_INFO;
272
273 /* LSA_DNS_DOM_INFO - DNS domain info - info class 12*/
274 typedef struct lsa_dns_dom_info
275 {
276         UNIHDR  hdr_nb_dom_name; /* netbios domain name */
277         UNIHDR  hdr_dns_dom_name;
278         UNIHDR  hdr_forest_name;
279
280         struct uuid dom_guid; /* domain GUID */
281
282         UNISTR2 uni_nb_dom_name;
283         UNISTR2 uni_dns_dom_name;
284         UNISTR2 uni_forest_name;
285
286         uint32 ptr_dom_sid;
287         DOM_SID2   dom_sid; /* domain SID */
288 } LSA_DNS_DOM_INFO;
289
290 typedef union lsa_info2_union
291 {
292         LSA_DNS_DOM_INFO dns_dom_info;
293 } LSA_INFO2_UNION;
294
295 /* LSA_Q_QUERY_INFO2 - LSA query info */
296 typedef struct lsa_q_query_info2
297 {
298         POLICY_HND pol;    /* policy handle */
299         uint16 info_class; /* info class */
300 } LSA_Q_QUERY_INFO2;
301
302 typedef struct lsa_r_query_info2
303 {
304         uint32 ptr;    /* pointer to info struct */
305         uint16 info_class;
306         LSA_INFO2_UNION info; /* so far the only one */
307         NTSTATUS status;
308 } LSA_R_QUERY_INFO2;
309
310 /*******************************************************/
311
312 typedef struct {
313         POLICY_HND pol; 
314         uint32 enum_context; 
315         uint32 preferred_len;   /* preferred maximum length */
316 } LSA_Q_ENUM_TRUST_DOM;
317
318 typedef struct {
319         UNISTR4 name;
320         DOM_SID2 *sid;
321 } DOMAIN_INFO;
322
323 typedef struct {
324         uint32 count;
325         DOMAIN_INFO *domains;
326 } DOMAIN_LIST;
327
328 typedef struct {
329         uint32 enum_context;
330         uint32 count;
331         DOMAIN_LIST *domlist;
332         NTSTATUS status; 
333 } LSA_R_ENUM_TRUST_DOM;
334
335 /*******************************************************/
336
337 /* LSA_Q_CLOSE */
338 typedef struct lsa_q_close_info
339 {
340         POLICY_HND pol; /* policy handle */
341
342 } LSA_Q_CLOSE;
343
344 /* LSA_R_CLOSE */
345 typedef struct lsa_r_close_info
346 {
347         POLICY_HND pol; /* policy handle.  should be all zeros. */
348
349         NTSTATUS status; /* return code */
350
351 } LSA_R_CLOSE;
352
353
354 #define MAX_REF_DOMAINS 32
355
356 /* DOM_TRUST_HDR */
357 typedef struct dom_trust_hdr
358 {
359         UNIHDR hdr_dom_name; /* referenced domain unicode string headers */
360         uint32 ptr_dom_sid;
361
362 } DOM_TRUST_HDR;
363         
364 /* DOM_TRUST_INFO */
365 typedef struct dom_trust_info
366 {
367         UNISTR2  uni_dom_name; /* domain name unicode string */
368         DOM_SID2 ref_dom     ; /* referenced domain SID */
369
370 } DOM_TRUST_INFO;
371         
372 /* DOM_R_REF */
373 typedef struct dom_ref_info
374 {
375         uint32 num_ref_doms_1; /* num referenced domains */
376         uint32 ptr_ref_dom; /* pointer to referenced domains */
377         uint32 max_entries; /* 32 - max number of entries */
378         uint32 num_ref_doms_2; /* num referenced domains */
379
380         DOM_TRUST_HDR  hdr_ref_dom[MAX_REF_DOMAINS]; /* referenced domains */
381         DOM_TRUST_INFO ref_dom    [MAX_REF_DOMAINS]; /* referenced domains */
382
383 } DOM_R_REF;
384
385 /* the domain_idx points to a SID associated with the name */
386
387 /* LSA_TRANS_NAME - translated name */
388 typedef struct lsa_trans_name_info
389 {
390         uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */
391         UNIHDR hdr_name; 
392         uint32 domain_idx; /* index into DOM_R_REF array of SIDs */
393
394 } LSA_TRANS_NAME;
395
396 /* LSA_TRANS_NAME2 - translated name */
397 typedef struct lsa_trans_name_info2
398 {
399         uint16 sid_name_use; /* value is 5 for a well-known group; 2 for a domain group; 1 for a user... */
400         UNIHDR hdr_name; 
401         uint32 domain_idx; /* index into DOM_R_REF array of SIDs */
402         uint32 unknown;
403
404 } LSA_TRANS_NAME2;
405
406 /* This number is based on Win2k and later maximum response allowed */
407 #define MAX_LOOKUP_SIDS 20480   /* 0x5000 */
408
409 /* LSA_TRANS_NAME_ENUM - LSA Translated Name Enumeration container */
410 typedef struct lsa_trans_name_enum_info
411 {
412         uint32 num_entries;
413         uint32 ptr_trans_names;
414         uint32 num_entries2;
415         
416         LSA_TRANS_NAME *name; /* translated names  */
417         UNISTR2 *uni_name;
418
419 } LSA_TRANS_NAME_ENUM;
420
421 /* LSA_TRANS_NAME_ENUM2 - LSA Translated Name Enumeration container 2 */
422 typedef struct lsa_trans_name_enum_info2
423 {
424         uint32 num_entries;
425         uint32 ptr_trans_names;
426         uint32 num_entries2;
427         
428         LSA_TRANS_NAME2 *name; /* translated names  */
429         UNISTR2 *uni_name;
430
431 } LSA_TRANS_NAME_ENUM2;
432
433 /* LSA_SID_ENUM - LSA SID enumeration container */
434 typedef struct lsa_sid_enum_info
435 {
436         uint32 num_entries;
437         uint32 ptr_sid_enum;
438         uint32 num_entries2;
439         
440         uint32 *ptr_sid; /* domain SID pointers to be looked up. */
441         DOM_SID2 *sid; /* domain SIDs to be looked up. */
442
443 } LSA_SID_ENUM;
444
445 /* LSA_Q_LOOKUP_SIDS - LSA Lookup SIDs */
446 typedef struct lsa_q_lookup_sids
447 {
448         POLICY_HND          pol; /* policy handle */
449         LSA_SID_ENUM        sids;
450         LSA_TRANS_NAME_ENUM names;
451         uint16              level;
452         uint32              mapped_count;
453
454 } LSA_Q_LOOKUP_SIDS;
455
456 /* LSA_R_LOOKUP_SIDS - response to LSA Lookup SIDs */
457 typedef struct lsa_r_lookup_sids
458 {
459         uint32              ptr_dom_ref;
460         DOM_R_REF           *dom_ref; /* domain reference info */
461
462         LSA_TRANS_NAME_ENUM *names;
463         uint32              mapped_count;
464
465         NTSTATUS            status; /* return code */
466
467 } LSA_R_LOOKUP_SIDS;
468
469 /* LSA_Q_LOOKUP_SIDS2 - LSA Lookup SIDs 2*/
470 typedef struct lsa_q_lookup_sids2
471 {
472         POLICY_HND          pol; /* policy handle */
473         LSA_SID_ENUM        sids;
474         LSA_TRANS_NAME_ENUM2 names;
475         uint16              level;
476         uint32              mapped_count;
477         uint32              unknown1;
478         uint32              unknown2;
479
480 } LSA_Q_LOOKUP_SIDS2;
481
482 /* LSA_R_LOOKUP_SIDS2 - response to LSA Lookup SIDs 2*/
483 typedef struct lsa_r_lookup_sids2
484 {
485         uint32              ptr_dom_ref;
486         DOM_R_REF           *dom_ref; /* domain reference info */
487
488         LSA_TRANS_NAME_ENUM2 *names;
489         uint32              mapped_count;
490
491         NTSTATUS            status; /* return code */
492
493 } LSA_R_LOOKUP_SIDS2;
494
495 /* LSA_Q_LOOKUP_SIDS3 - LSA Lookup SIDs 3 */
496 typedef struct lsa_q_lookup_sids3
497 {
498         LSA_SID_ENUM        sids;
499         LSA_TRANS_NAME_ENUM2 names;
500         uint16              level;
501         uint32              mapped_count;
502         uint32              unknown1;
503         uint32              unknown2;
504
505 } LSA_Q_LOOKUP_SIDS3;
506
507 /* LSA_R_LOOKUP_SIDS3 - response to LSA Lookup SIDs 3 */
508 typedef struct lsa_r_lookup_sids3
509 {
510         uint32              ptr_dom_ref;
511         DOM_R_REF           *dom_ref; /* domain reference info */
512
513         LSA_TRANS_NAME_ENUM2 *names;
514         uint32              mapped_count;
515
516         NTSTATUS            status; /* return code */
517
518 } LSA_R_LOOKUP_SIDS3;
519
520 /* LSA_Q_LOOKUP_NAMES - LSA Lookup NAMEs */
521 typedef struct lsa_q_lookup_names
522 {
523         POLICY_HND pol; /* policy handle */
524         uint32 num_entries;
525         uint32 num_entries2;
526         UNIHDR  *hdr_name; /* name buffer pointers */
527         UNISTR2 *uni_name; /* names to be looked up */
528
529         uint32 num_trans_entries;
530         uint32 ptr_trans_sids; /* undocumented domain SID buffer pointer */
531         uint32 lookup_level;
532         uint32 mapped_count;
533
534 } LSA_Q_LOOKUP_NAMES;
535
536 /* LSA_R_LOOKUP_NAMES - response to LSA Lookup NAMEs by name */
537 typedef struct lsa_r_lookup_names
538 {
539         uint32 ptr_dom_ref;
540         DOM_R_REF *dom_ref; /* domain reference info */
541
542         uint32 num_entries;
543         uint32 ptr_entries;
544         uint32 num_entries2;
545         DOM_RID *dom_rid; /* domain RIDs being looked up */
546
547         uint32 mapped_count;
548
549         NTSTATUS status; /* return code */
550 } LSA_R_LOOKUP_NAMES;
551
552 /* LSA_Q_LOOKUP_NAMES2 - LSA Lookup NAMEs 2*/
553 typedef struct lsa_q_lookup_names2
554 {
555         POLICY_HND pol; /* policy handle */
556         uint32 num_entries;
557         uint32 num_entries2;
558         UNIHDR  *hdr_name; /* name buffer pointers */
559         UNISTR2 *uni_name; /* names to be looked up */
560
561         uint32 num_trans_entries;
562         uint32 ptr_trans_sids; /* undocumented domain SID buffer pointer */
563         uint32 lookup_level;
564         uint32 mapped_count;
565         uint32 unknown1;
566         uint32 unknown2;
567
568 } LSA_Q_LOOKUP_NAMES2;
569
570 /* LSA_R_LOOKUP_NAMES2 - response to LSA Lookup NAMEs by name 2 */
571 typedef struct lsa_r_lookup_names2
572 {
573         uint32 ptr_dom_ref;
574         DOM_R_REF *dom_ref; /* domain reference info */
575
576         uint32 num_entries;
577         uint32 ptr_entries;
578         uint32 num_entries2;
579         DOM_RID2 *dom_rid; /* domain RIDs being looked up */
580
581         uint32 mapped_count;
582
583         NTSTATUS status; /* return code */
584 } LSA_R_LOOKUP_NAMES2;
585
586 typedef struct lsa_enum_priv_entry
587 {
588         UNIHDR hdr_name;
589         uint32 luid_low;
590         uint32 luid_high;
591         UNISTR2 name;
592         
593 } LSA_PRIV_ENTRY;
594
595 /* LSA_Q_ENUM_PRIVS - LSA enum privileges */
596 typedef struct lsa_q_enum_privs
597 {
598         POLICY_HND pol; /* policy handle */
599         uint32 enum_context;
600         uint32 pref_max_length;
601 } LSA_Q_ENUM_PRIVS;
602
603 typedef struct lsa_r_enum_privs
604 {
605         uint32 enum_context;
606         uint32 count;
607         uint32 ptr;
608         uint32 count1;
609
610         LSA_PRIV_ENTRY *privs;
611
612         NTSTATUS status;
613 } LSA_R_ENUM_PRIVS;
614
615 /* LSA_Q_ENUM_ACCT_RIGHTS - LSA enum account rights */
616 typedef struct
617 {
618         POLICY_HND pol; /* policy handle */
619         DOM_SID2 sid;
620 } LSA_Q_ENUM_ACCT_RIGHTS;
621
622 /* LSA_R_ENUM_ACCT_RIGHTS - LSA enum account rights */
623 typedef struct
624 {
625         uint32 count;
626         UNISTR4_ARRAY *rights;
627         NTSTATUS status;
628 } LSA_R_ENUM_ACCT_RIGHTS;
629
630
631 /* LSA_Q_ADD_ACCT_RIGHTS - LSA add account rights */
632 typedef struct
633 {
634         POLICY_HND pol; /* policy handle */
635         DOM_SID2 sid;
636         uint32 count;
637         UNISTR4_ARRAY *rights;
638 } LSA_Q_ADD_ACCT_RIGHTS;
639
640 /* LSA_R_ADD_ACCT_RIGHTS - LSA add account rights */
641 typedef struct
642 {
643         NTSTATUS status;
644 } LSA_R_ADD_ACCT_RIGHTS;
645
646
647 /* LSA_Q_REMOVE_ACCT_RIGHTS - LSA remove account rights */
648 typedef struct
649 {
650         POLICY_HND pol; /* policy handle */
651         DOM_SID2 sid;
652         uint32 removeall;
653         uint32 count;
654         UNISTR4_ARRAY *rights;
655 } LSA_Q_REMOVE_ACCT_RIGHTS;
656
657 /* LSA_R_REMOVE_ACCT_RIGHTS - LSA remove account rights */
658 typedef struct
659 {
660         NTSTATUS status;
661 } LSA_R_REMOVE_ACCT_RIGHTS;
662
663
664 /* LSA_Q_PRIV_GET_DISPNAME - LSA get privilege display name */
665 typedef struct lsa_q_priv_get_dispname
666 {
667         POLICY_HND pol; /* policy handle */
668         UNIHDR hdr_name;
669         UNISTR2 name;
670         uint16 lang_id;
671         uint16 lang_id_sys;
672 } LSA_Q_PRIV_GET_DISPNAME;
673
674 typedef struct lsa_r_priv_get_dispname
675 {
676         uint32 ptr_info;
677         UNIHDR hdr_desc;
678         UNISTR2 desc;
679         /* Don't align ! */
680         uint16 lang_id;
681         /* align */
682         NTSTATUS status;
683 } LSA_R_PRIV_GET_DISPNAME;
684
685 /* LSA_Q_ENUM_ACCOUNTS */
686 typedef struct lsa_q_enum_accounts
687 {
688         POLICY_HND pol; /* policy handle */
689         uint32 enum_context;
690         uint32 pref_max_length;
691 } LSA_Q_ENUM_ACCOUNTS;
692
693 /* LSA_R_ENUM_ACCOUNTS */
694 typedef struct lsa_r_enum_accounts
695 {
696         uint32 enum_context;
697         LSA_SID_ENUM sids;
698         NTSTATUS status;
699 } LSA_R_ENUM_ACCOUNTS;
700
701 /* LSA_Q_UNK_GET_CONNUSER - gets username\domain of connected user
702                   called when "Take Ownership" is clicked -SK */
703 typedef struct lsa_q_unk_get_connuser
704 {
705   uint32 ptr_srvname;
706   UNISTR2 uni2_srvname;
707   uint32 unk1; /* 3 unknown uint32's are seen right after uni2_srvname */
708   uint32 unk2; /* unk2 appears to be a ptr, unk1 = unk3 = 0 usually */
709   uint32 unk3; 
710 } LSA_Q_UNK_GET_CONNUSER;
711
712 /* LSA_R_UNK_GET_CONNUSER */
713 typedef struct lsa_r_unk_get_connuser
714 {
715   uint32 ptr_user_name;
716   UNIHDR hdr_user_name;
717   UNISTR2 uni2_user_name;
718   
719   uint32 unk1;
720   
721   uint32 ptr_dom_name;
722   UNIHDR hdr_dom_name;
723   UNISTR2 uni2_dom_name;
724
725   NTSTATUS status;
726 } LSA_R_UNK_GET_CONNUSER;
727
728
729 typedef struct lsa_q_createaccount
730 {
731         POLICY_HND pol; /* policy handle */
732         DOM_SID2 sid;
733         uint32 access; /* access */
734 } LSA_Q_CREATEACCOUNT;
735
736 typedef struct lsa_r_createaccount
737 {
738         POLICY_HND pol; /* policy handle */
739         NTSTATUS status;
740 } LSA_R_CREATEACCOUNT;
741
742
743 typedef struct lsa_q_openaccount
744 {
745         POLICY_HND pol; /* policy handle */
746         DOM_SID2 sid;
747         uint32 access; /* desired access */
748 } LSA_Q_OPENACCOUNT;
749
750 typedef struct lsa_r_openaccount
751 {
752         POLICY_HND pol; /* policy handle */
753         NTSTATUS status;
754 } LSA_R_OPENACCOUNT;
755
756 typedef struct lsa_q_enumprivsaccount
757 {
758         POLICY_HND pol; /* policy handle */
759 } LSA_Q_ENUMPRIVSACCOUNT;
760
761 typedef struct lsa_r_enumprivsaccount
762 {
763         uint32 ptr;
764         uint32 count;
765         PRIVILEGE_SET set;
766         NTSTATUS status;
767 } LSA_R_ENUMPRIVSACCOUNT;
768
769 typedef struct lsa_q_getsystemaccount
770 {
771         POLICY_HND pol; /* policy handle */
772 } LSA_Q_GETSYSTEMACCOUNT;
773
774 typedef struct lsa_r_getsystemaccount
775 {
776         uint32 access;
777         NTSTATUS status;
778 } LSA_R_GETSYSTEMACCOUNT;
779
780
781 typedef struct lsa_q_setsystemaccount
782 {
783         POLICY_HND pol; /* policy handle */
784         uint32 access;
785 } LSA_Q_SETSYSTEMACCOUNT;
786
787 typedef struct lsa_r_setsystemaccount
788 {
789         NTSTATUS status;
790 } LSA_R_SETSYSTEMACCOUNT;
791
792 typedef struct {
793         UNIHDR hdr;
794         UNISTR2 unistring;
795 } LSA_STRING;
796
797 typedef struct {
798         POLICY_HND pol; /* policy handle */
799         LSA_STRING privname;
800 } LSA_Q_LOOKUP_PRIV_VALUE;
801
802 typedef struct {
803         LUID luid;
804         NTSTATUS status;
805 } LSA_R_LOOKUP_PRIV_VALUE;
806
807 typedef struct lsa_q_addprivs
808 {
809         POLICY_HND pol; /* policy handle */
810         uint32 count;
811         PRIVILEGE_SET set;
812 } LSA_Q_ADDPRIVS;
813
814 typedef struct lsa_r_addprivs
815 {
816         NTSTATUS status;
817 } LSA_R_ADDPRIVS;
818
819
820 typedef struct lsa_q_removeprivs
821 {
822         POLICY_HND pol; /* policy handle */
823         uint32 allrights;
824         uint32 ptr;
825         uint32 count;
826         PRIVILEGE_SET set;
827 } LSA_Q_REMOVEPRIVS;
828
829 typedef struct lsa_r_removeprivs
830 {
831         NTSTATUS status;
832 } LSA_R_REMOVEPRIVS;
833
834 /*******************************************************/
835 #if 0 /* jerry, I think this not correct - gd */
836 typedef struct {
837         POLICY_HND      handle;
838         uint32          count;  /* ??? this is what ethereal calls it */
839         DOM_SID         sid;
840 } LSA_Q_OPEN_TRUSTED_DOMAIN;
841 #endif
842
843 /* LSA_Q_OPEN_TRUSTED_DOMAIN - LSA Query Open Trusted Domain */
844 typedef struct lsa_q_open_trusted_domain
845 {
846         POLICY_HND      pol;    /* policy handle */
847         DOM_SID2        sid;    /* domain sid */
848         uint32  access_mask;    /* access mask */
849         
850 } LSA_Q_OPEN_TRUSTED_DOMAIN;
851
852 /* LSA_R_OPEN_TRUSTED_DOMAIN - response to LSA Query Open Trusted Domain */
853 typedef struct {
854         POLICY_HND      handle; /* trustdom policy handle */
855         NTSTATUS        status; /* return code */
856 } LSA_R_OPEN_TRUSTED_DOMAIN;
857
858
859 /*******************************************************/
860
861 /* LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME - LSA Query Open Trusted Domain by Name*/
862 typedef struct lsa_q_open_trusted_domain_by_name
863 {
864         POLICY_HND      pol;    /* policy handle */
865         LSA_STRING      name;   /* domain name */
866         uint32  access_mask;    /* access mask */
867         
868 } LSA_Q_OPEN_TRUSTED_DOMAIN_BY_NAME;
869
870 /* LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME - response to LSA Query Open Trusted Domain by Name */
871 typedef struct {
872         POLICY_HND      handle; /* trustdom policy handle */
873         NTSTATUS        status; /* return code */
874 } LSA_R_OPEN_TRUSTED_DOMAIN_BY_NAME;
875
876
877 /*******************************************************/
878
879
880 typedef struct {
881         POLICY_HND      handle; 
882         UNISTR4         secretname;
883         uint32          access;
884 } LSA_Q_OPEN_SECRET;
885
886 typedef struct {
887         POLICY_HND      handle;
888         NTSTATUS        status;
889 } LSA_R_OPEN_SECRET;
890
891
892 /*******************************************************/
893
894 typedef struct {
895         POLICY_HND      handle;
896 } LSA_Q_DELETE_OBJECT;
897
898 typedef struct {
899         NTSTATUS        status;
900 } LSA_R_DELETE_OBJECT;
901
902
903 /*******************************************************/
904
905 typedef struct {
906         POLICY_HND      handle;
907         UNISTR4         secretname;
908         uint32          access;
909 } LSA_Q_CREATE_SECRET;
910
911 typedef struct {
912         POLICY_HND      handle;
913         NTSTATUS        status;
914 } LSA_R_CREATE_SECRET;
915
916
917 /*******************************************************/
918
919 typedef struct {
920         POLICY_HND      handle; 
921         UNISTR4         secretname;
922         uint32          access;
923 } LSA_Q_CREATE_TRUSTED_DOMAIN;
924
925 typedef struct {
926         POLICY_HND      handle;
927         NTSTATUS        status;
928 } LSA_R_CREATE_TRUSTED_DOMAIN;
929
930
931 /*******************************************************/
932
933 typedef struct {
934         uint32  size;   /* size is written on the wire twice so I 
935                            can only assume that one is supposed to 
936                            be a max length and one is a size */
937         UNISTR2 *data;  /* not really a UNICODE string but the parsing 
938                            is the same */
939 } LSA_DATA_BLOB;
940
941 typedef struct {
942         POLICY_HND      handle; 
943         LSA_DATA_BLOB   *old_value;
944         LSA_DATA_BLOB   *new_value;
945 } LSA_Q_SET_SECRET;
946
947 typedef struct {
948         NTSTATUS        status;
949 } LSA_R_SET_SECRET;
950
951 /* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */
952 typedef struct lsa_query_trusted_domain_info
953 {
954         POLICY_HND      pol;            /* policy handle */
955         uint16          info_class;     /* info class */
956
957 } LSA_Q_QUERY_TRUSTED_DOMAIN_INFO;
958
959 /* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID - LSA query trusted domain info */
960 typedef struct lsa_query_trusted_domain_info_by_sid
961 {
962         POLICY_HND      pol;            /* policy handle */
963         DOM_SID2        dom_sid;        /* domain sid */
964         uint16          info_class;     /* info class */
965         
966 } LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_SID;
967
968 /* LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME - LSA query trusted domain info */
969 typedef struct lsa_query_trusted_domain_info_by_name
970 {
971         POLICY_HND      pol;            /* policy handle */
972         LSA_STRING      domain_name;    /* domain name */
973         uint16          info_class;     /* info class */
974         
975 } LSA_Q_QUERY_TRUSTED_DOMAIN_INFO_BY_NAME;
976
977 typedef struct trusted_domain_info_name {
978         LSA_STRING      netbios_name; 
979 } TRUSTED_DOMAIN_INFO_NAME;
980
981 typedef struct trusted_domain_info_posix_offset {
982         uint32          posix_offset;
983 } TRUSTED_DOMAIN_INFO_POSIX_OFFSET;
984
985 typedef struct lsa_data_buf {
986         uint32 size;
987         uint32 offset;
988         uint32 length;
989         uint8 *data;
990 } LSA_DATA_BUF;
991
992 typedef struct lsa_data_buf_hdr {
993         uint32 length;
994         uint32 size;
995         uint32 data_ptr;
996 } LSA_DATA_BUF_HDR;
997
998
999 typedef struct lsa_data_buf2 {
1000         uint32 size;
1001         uint8 *data;
1002 } LSA_DATA_BUF2;
1003
1004 typedef struct trusted_domain_info_password {
1005         uint32 ptr_password;
1006         uint32 ptr_old_password;
1007         LSA_DATA_BUF_HDR password_hdr;
1008         LSA_DATA_BUF_HDR old_password_hdr;
1009         LSA_DATA_BUF password;
1010         LSA_DATA_BUF old_password;
1011 } TRUSTED_DOMAIN_INFO_PASSWORD;
1012
1013 typedef struct trusted_domain_info_basic {
1014         LSA_STRING      netbios_name;
1015         DOM_SID2        sid;
1016 } TRUSTED_DOMAIN_INFO_BASIC;
1017
1018 typedef struct trusted_domain_info_ex {
1019         LSA_STRING      domain_name;
1020         LSA_STRING      netbios_name;
1021         DOM_SID2        sid;
1022         uint32          trust_direction;
1023         uint32          trust_type;
1024         uint32          trust_attributes;
1025 } TRUSTED_DOMAIN_INFO_EX;
1026
1027 typedef struct trust_domain_info_buffer {
1028         NTTIME          last_update_time;
1029         uint32          secret_type;
1030         LSA_DATA_BUF2   data;
1031 } LSA_TRUSTED_DOMAIN_INFO_BUFFER;
1032
1033 typedef struct trusted_domain_info_auth_info {
1034         uint32 incoming_count;
1035         LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_current_auth_info;
1036         LSA_TRUSTED_DOMAIN_INFO_BUFFER incoming_previous_auth_info;
1037         uint32 outgoing_count;
1038         LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_current_auth_info;
1039         LSA_TRUSTED_DOMAIN_INFO_BUFFER outgoing_previous_auth_info;
1040 } TRUSTED_DOMAIN_INFO_AUTH_INFO;
1041
1042 typedef struct trusted_domain_info_full_info {
1043         TRUSTED_DOMAIN_INFO_EX          info_ex;
1044         TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset;
1045         TRUSTED_DOMAIN_INFO_AUTH_INFO   auth_info;
1046 } TRUSTED_DOMAIN_INFO_FULL_INFO;
1047
1048 typedef struct trusted_domain_info_11 {
1049         TRUSTED_DOMAIN_INFO_EX          info_ex;
1050         LSA_DATA_BUF2                   data1;
1051 } TRUSTED_DOMAIN_INFO_11;
1052
1053 typedef struct trusted_domain_info_all {
1054         TRUSTED_DOMAIN_INFO_EX          info_ex;
1055         LSA_DATA_BUF2                   data1;
1056         TRUSTED_DOMAIN_INFO_POSIX_OFFSET posix_offset;
1057         TRUSTED_DOMAIN_INFO_AUTH_INFO   auth_info;
1058 } TRUSTED_DOMAIN_INFO_ALL;
1059
1060 /* LSA_TRUSTED_DOMAIN_INFO */
1061 typedef union lsa_trusted_domain_info
1062 {
1063         uint16                                  info_class;
1064         TRUSTED_DOMAIN_INFO_NAME                name;
1065         /* deprecated - gd
1066         TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO    controllers; */
1067         TRUSTED_DOMAIN_INFO_POSIX_OFFSET        posix_offset;
1068         TRUSTED_DOMAIN_INFO_PASSWORD            password;
1069         TRUSTED_DOMAIN_INFO_BASIC               basic;
1070         TRUSTED_DOMAIN_INFO_EX                  info_ex;
1071         TRUSTED_DOMAIN_INFO_AUTH_INFO           auth_info;
1072         TRUSTED_DOMAIN_INFO_FULL_INFO           full_info;
1073         TRUSTED_DOMAIN_INFO_11                  info11;
1074         TRUSTED_DOMAIN_INFO_ALL                 info_all;
1075
1076 } LSA_TRUSTED_DOMAIN_INFO;
1077
1078 /* LSA_R_QUERY_TRUSTED_DOMAIN_INFO - LSA query trusted domain info */
1079 typedef struct r_lsa_query_trusted_domain_info
1080 {
1081         LSA_TRUSTED_DOMAIN_INFO *info;
1082         NTSTATUS status;
1083 } LSA_R_QUERY_TRUSTED_DOMAIN_INFO;
1084
1085 typedef struct dom_info_kerberos {
1086         uint32 enforce_restrictions;
1087         NTTIME service_tkt_lifetime;
1088         NTTIME user_tkt_lifetime;
1089         NTTIME user_tkt_renewaltime;
1090         NTTIME clock_skew;
1091         NTTIME unknown6;
1092 } LSA_DOM_INFO_POLICY_KERBEROS;
1093
1094 typedef struct dom_info_efs {
1095         uint32 blob_len;
1096         UNISTR2 efs_blob;
1097 } LSA_DOM_INFO_POLICY_EFS;
1098
1099 typedef struct lsa_dom_info_union {
1100         uint16 info_class;
1101         LSA_DOM_INFO_POLICY_EFS efs_policy;
1102         LSA_DOM_INFO_POLICY_KERBEROS krb_policy;
1103 } LSA_DOM_INFO_UNION;
1104
1105 /* LSA_Q_QUERY_DOM_INFO_POLICY - LSA query info */
1106 typedef struct lsa_q_query_dom_info_policy
1107 {
1108         POLICY_HND pol;    /* policy handle */
1109         uint16 info_class; /* info class */
1110 } LSA_Q_QUERY_DOM_INFO_POLICY;
1111
1112 typedef struct lsa_r_query_dom_info_policy
1113 {
1114         LSA_DOM_INFO_UNION *info;
1115         NTSTATUS status;
1116 } LSA_R_QUERY_DOM_INFO_POLICY;
1117
1118
1119 #endif /* _RPC_LSA_H */