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