2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
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) Andrew Bartlett 2002,
8 * Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002.
9 * Copyright (C) Gerald )Jerry) Carter 2005
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #define DBGC_CLASS DBGC_RPC_PARSE
31 static BOOL
lsa_io_trans_names(const char *desc
, LSA_TRANS_NAME_ENUM
*trn
, prs_struct
*ps
, int depth
);
33 /*******************************************************************
34 Inits a LSA_TRANS_NAME structure.
35 ********************************************************************/
37 void init_lsa_trans_name(LSA_TRANS_NAME
*trn
, UNISTR2
*uni_name
,
38 uint16 sid_name_use
, const char *name
, uint32 idx
)
40 trn
->sid_name_use
= sid_name_use
;
41 init_unistr2(uni_name
, name
, UNI_FLAGS_NONE
);
42 init_uni_hdr(&trn
->hdr_name
, uni_name
);
43 trn
->domain_idx
= idx
;
46 /*******************************************************************
47 Reads or writes a LSA_TRANS_NAME structure.
48 ********************************************************************/
50 static BOOL
lsa_io_trans_name(const char *desc
, LSA_TRANS_NAME
*trn
, prs_struct
*ps
,
53 prs_debug(ps
, depth
, desc
, "lsa_io_trans_name");
59 if(!prs_uint16("sid_name_use", ps
, depth
, &trn
->sid_name_use
))
64 if(!smb_io_unihdr ("hdr_name", &trn
->hdr_name
, ps
, depth
))
66 if(!prs_uint32("domain_idx ", ps
, depth
, &trn
->domain_idx
))
72 /*******************************************************************
73 Reads or writes a DOM_R_REF structure.
74 ********************************************************************/
76 static BOOL
lsa_io_dom_r_ref(const char *desc
, DOM_R_REF
*r_r
, prs_struct
*ps
,
81 prs_debug(ps
, depth
, desc
, "lsa_io_dom_r_ref");
87 if(!prs_uint32("num_ref_doms_1", ps
, depth
, &r_r
->num_ref_doms_1
)) /* num referenced domains? */
89 if(!prs_uint32("ptr_ref_dom ", ps
, depth
, &r_r
->ptr_ref_dom
)) /* undocumented buffer pointer. */
91 if(!prs_uint32("max_entries ", ps
, depth
, &r_r
->max_entries
)) /* 32 - max number of entries */
94 SMB_ASSERT_ARRAY(r_r
->hdr_ref_dom
, r_r
->num_ref_doms_1
);
96 if (r_r
->ptr_ref_dom
!= 0) {
98 if(!prs_uint32("num_ref_doms_2", ps
, depth
, &r_r
->num_ref_doms_2
)) /* 4 - num referenced domains? */
101 SMB_ASSERT_ARRAY(r_r
->ref_dom
, r_r
->num_ref_doms_2
);
103 for (i
= 0; i
< r_r
->num_ref_doms_1
; i
++) {
106 slprintf(t
, sizeof(t
) - 1, "dom_ref[%d] ", i
);
107 if(!smb_io_unihdr(t
, &r_r
->hdr_ref_dom
[i
].hdr_dom_name
, ps
, depth
))
110 slprintf(t
, sizeof(t
) - 1, "sid_ptr[%d] ", i
);
111 if(!prs_uint32(t
, ps
, depth
, &r_r
->hdr_ref_dom
[i
].ptr_dom_sid
))
115 for (i
= 0; i
< r_r
->num_ref_doms_2
; i
++) {
118 if (r_r
->hdr_ref_dom
[i
].hdr_dom_name
.buffer
!= 0) {
119 slprintf(t
, sizeof(t
) - 1, "dom_ref[%d] ", i
);
120 if(!smb_io_unistr2(t
, &r_r
->ref_dom
[i
].uni_dom_name
, True
, ps
, depth
)) /* domain name unicode string */
126 if (r_r
->hdr_ref_dom
[i
].ptr_dom_sid
!= 0) {
127 slprintf(t
, sizeof(t
) - 1, "sid_ptr[%d] ", i
);
128 if(!smb_io_dom_sid2(t
, &r_r
->ref_dom
[i
].ref_dom
, ps
, depth
)) /* referenced domain SIDs */
137 /*******************************************************************
138 Inits an LSA_SEC_QOS structure.
139 ********************************************************************/
141 void init_lsa_sec_qos(LSA_SEC_QOS
*qos
, uint16 imp_lev
, uint8 ctxt
, uint8 eff
)
143 DEBUG(5, ("init_lsa_sec_qos\n"));
145 qos
->len
= 0x0c; /* length of quality of service block, in bytes */
146 qos
->sec_imp_level
= imp_lev
;
147 qos
->sec_ctxt_mode
= ctxt
;
148 qos
->effective_only
= eff
;
151 /*******************************************************************
152 Reads or writes an LSA_SEC_QOS structure.
153 ********************************************************************/
155 static BOOL
lsa_io_sec_qos(const char *desc
, LSA_SEC_QOS
*qos
, prs_struct
*ps
,
160 prs_debug(ps
, depth
, desc
, "lsa_io_obj_qos");
166 start
= prs_offset(ps
);
168 /* these pointers had _better_ be zero, because we don't know
171 if(!prs_uint32("len ", ps
, depth
, &qos
->len
)) /* 0x18 - length (in bytes) inc. the length field. */
173 if(!prs_uint16("sec_imp_level ", ps
, depth
, &qos
->sec_imp_level
))
175 if(!prs_uint8 ("sec_ctxt_mode ", ps
, depth
, &qos
->sec_ctxt_mode
))
177 if(!prs_uint8 ("effective_only", ps
, depth
, &qos
->effective_only
))
180 if (qos
->len
!= prs_offset(ps
) - start
) {
181 DEBUG(3,("lsa_io_sec_qos: length %x does not match size %x\n",
182 qos
->len
, prs_offset(ps
) - start
));
188 /*******************************************************************
189 Inits an LSA_OBJ_ATTR structure.
190 ********************************************************************/
192 static void init_lsa_obj_attr(LSA_OBJ_ATTR
*attr
, uint32 attributes
, LSA_SEC_QOS
*qos
)
194 DEBUG(5, ("init_lsa_obj_attr\n"));
196 attr
->len
= 0x18; /* length of object attribute block, in bytes */
197 attr
->ptr_root_dir
= 0;
198 attr
->ptr_obj_name
= 0;
199 attr
->attributes
= attributes
;
200 attr
->ptr_sec_desc
= 0;
203 attr
->ptr_sec_qos
= 1;
206 attr
->ptr_sec_qos
= 0;
207 attr
->sec_qos
= NULL
;
211 /*******************************************************************
212 Reads or writes an LSA_OBJ_ATTR structure.
213 ********************************************************************/
215 static BOOL
lsa_io_obj_attr(const char *desc
, LSA_OBJ_ATTR
*attr
, prs_struct
*ps
,
218 prs_debug(ps
, depth
, desc
, "lsa_io_obj_attr");
224 /* these pointers had _better_ be zero, because we don't know
227 if(!prs_uint32("len ", ps
, depth
, &attr
->len
)) /* 0x18 - length (in bytes) inc. the length field. */
229 if(!prs_uint32("ptr_root_dir", ps
, depth
, &attr
->ptr_root_dir
)) /* 0 - root directory (pointer) */
231 if(!prs_uint32("ptr_obj_name", ps
, depth
, &attr
->ptr_obj_name
)) /* 0 - object name (pointer) */
233 if(!prs_uint32("attributes ", ps
, depth
, &attr
->attributes
)) /* 0 - attributes (undocumented) */
235 if(!prs_uint32("ptr_sec_desc", ps
, depth
, &attr
->ptr_sec_desc
)) /* 0 - security descriptior (pointer) */
237 if(!prs_uint32("ptr_sec_qos ", ps
, depth
, &attr
->ptr_sec_qos
)) /* security quality of service (pointer) */
240 if (attr
->ptr_sec_qos
!= 0) {
241 if (UNMARSHALLING(ps
))
242 if (!(attr
->sec_qos
= PRS_ALLOC_MEM(ps
,LSA_SEC_QOS
,1)))
245 if(!lsa_io_sec_qos("sec_qos", attr
->sec_qos
, ps
, depth
))
253 /*******************************************************************
254 Inits an LSA_Q_OPEN_POL structure.
255 ********************************************************************/
257 void init_q_open_pol(LSA_Q_OPEN_POL
*r_q
, uint16 system_name
,
258 uint32 attributes
, uint32 desired_access
,
261 DEBUG(5, ("init_open_pol: attr:%d da:%d\n", attributes
,
264 r_q
->ptr
= 1; /* undocumented pointer */
266 r_q
->des_access
= desired_access
;
268 r_q
->system_name
= system_name
;
269 init_lsa_obj_attr(&r_q
->attr
, attributes
, qos
);
272 /*******************************************************************
273 Reads or writes an LSA_Q_OPEN_POL structure.
274 ********************************************************************/
276 BOOL
lsa_io_q_open_pol(const char *desc
, LSA_Q_OPEN_POL
*r_q
, prs_struct
*ps
,
279 prs_debug(ps
, depth
, desc
, "lsa_io_q_open_pol");
282 if(!prs_uint32("ptr ", ps
, depth
, &r_q
->ptr
))
284 if(!prs_uint16("system_name", ps
, depth
, &r_q
->system_name
))
289 if(!lsa_io_obj_attr("", &r_q
->attr
, ps
, depth
))
292 if(!prs_uint32("des_access", ps
, depth
, &r_q
->des_access
))
298 /*******************************************************************
299 Reads or writes an LSA_R_OPEN_POL structure.
300 ********************************************************************/
302 BOOL
lsa_io_r_open_pol(const char *desc
, LSA_R_OPEN_POL
*r_p
, prs_struct
*ps
,
305 prs_debug(ps
, depth
, desc
, "lsa_io_r_open_pol");
308 if(!smb_io_pol_hnd("", &r_p
->pol
, ps
, depth
))
311 if(!prs_ntstatus("status", ps
, depth
, &r_p
->status
))
317 /*******************************************************************
318 Inits an LSA_Q_OPEN_POL2 structure.
319 ********************************************************************/
321 void init_q_open_pol2(LSA_Q_OPEN_POL2
*r_q
, const char *server_name
,
322 uint32 attributes
, uint32 desired_access
,
325 DEBUG(5, ("init_q_open_pol2: attr:%d da:%d\n", attributes
,
328 r_q
->ptr
= 1; /* undocumented pointer */
330 r_q
->des_access
= desired_access
;
332 init_unistr2(&r_q
->uni_server_name
, server_name
, UNI_STR_TERMINATE
);
334 init_lsa_obj_attr(&r_q
->attr
, attributes
, qos
);
337 /*******************************************************************
338 Reads or writes an LSA_Q_OPEN_POL2 structure.
339 ********************************************************************/
341 BOOL
lsa_io_q_open_pol2(const char *desc
, LSA_Q_OPEN_POL2
*r_q
, prs_struct
*ps
,
344 prs_debug(ps
, depth
, desc
, "lsa_io_q_open_pol2");
347 if(!prs_uint32("ptr ", ps
, depth
, &r_q
->ptr
))
350 if(!smb_io_unistr2 ("", &r_q
->uni_server_name
, r_q
->ptr
, ps
, depth
))
352 if(!lsa_io_obj_attr("", &r_q
->attr
, ps
, depth
))
355 if(!prs_uint32("des_access", ps
, depth
, &r_q
->des_access
))
361 /*******************************************************************
362 Reads or writes an LSA_R_OPEN_POL2 structure.
363 ********************************************************************/
365 BOOL
lsa_io_r_open_pol2(const char *desc
, LSA_R_OPEN_POL2
*r_p
, prs_struct
*ps
,
368 prs_debug(ps
, depth
, desc
, "lsa_io_r_open_pol2");
371 if(!smb_io_pol_hnd("", &r_p
->pol
, ps
, depth
))
374 if(!prs_ntstatus("status", ps
, depth
, &r_p
->status
))
380 /*******************************************************************
381 makes an LSA_Q_QUERY_SEC_OBJ structure.
382 ********************************************************************/
384 void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ
*q_q
, const POLICY_HND
*hnd
,
387 DEBUG(5, ("init_q_query_sec_obj\n"));
390 q_q
->sec_info
= sec_info
;
395 /*******************************************************************
396 Reads or writes an LSA_Q_QUERY_SEC_OBJ structure.
397 ********************************************************************/
399 BOOL
lsa_io_q_query_sec_obj(const char *desc
, LSA_Q_QUERY_SEC_OBJ
*q_q
,
400 prs_struct
*ps
, int depth
)
402 prs_debug(ps
, depth
, desc
, "lsa_io_q_query_sec_obj");
405 if (!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
408 if (!prs_uint32("sec_info", ps
, depth
, &q_q
->sec_info
))
414 /*******************************************************************
415 Reads or writes a LSA_R_QUERY_SEC_OBJ structure.
416 ********************************************************************/
418 BOOL
lsa_io_r_query_sec_obj(const char *desc
, LSA_R_QUERY_SEC_OBJ
*r_u
,
419 prs_struct
*ps
, int depth
)
421 prs_debug(ps
, depth
, desc
, "lsa_io_r_query_sec_obj");
427 if (!prs_uint32("ptr", ps
, depth
, &r_u
->ptr
))
431 if (!sec_io_desc_buf("sec", &r_u
->buf
, ps
, depth
))
435 if (!prs_ntstatus("status", ps
, depth
, &r_u
->status
))
441 /*******************************************************************
442 Inits an LSA_Q_QUERY_INFO structure.
443 ********************************************************************/
445 void init_q_query(LSA_Q_QUERY_INFO
*q_q
, POLICY_HND
*hnd
, uint16 info_class
)
447 DEBUG(5, ("init_q_query\n"));
449 memcpy(&q_q
->pol
, hnd
, sizeof(q_q
->pol
));
451 q_q
->info_class
= info_class
;
454 /*******************************************************************
455 Reads or writes an LSA_Q_QUERY_INFO structure.
456 ********************************************************************/
458 BOOL
lsa_io_q_query(const char *desc
, LSA_Q_QUERY_INFO
*q_q
, prs_struct
*ps
,
461 prs_debug(ps
, depth
, desc
, "lsa_io_q_query");
464 if(!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
467 if(!prs_uint16("info_class", ps
, depth
, &q_q
->info_class
))
473 /*******************************************************************
474 makes an LSA_Q_ENUM_TRUST_DOM structure.
475 ********************************************************************/
476 BOOL
init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM
* q_e
, POLICY_HND
*pol
,
477 uint32 enum_context
, uint32 preferred_len
)
479 DEBUG(5, ("init_q_enum_trust_dom\n"));
482 q_e
->enum_context
= enum_context
;
483 q_e
->preferred_len
= preferred_len
;
488 /*******************************************************************
489 Reads or writes an LSA_Q_ENUM_TRUST_DOM structure.
490 ********************************************************************/
492 BOOL
lsa_io_q_enum_trust_dom(const char *desc
, LSA_Q_ENUM_TRUST_DOM
*q_e
,
493 prs_struct
*ps
, int depth
)
495 prs_debug(ps
, depth
, desc
, "lsa_io_q_enum_trust_dom");
498 if(!smb_io_pol_hnd("", &q_e
->pol
, ps
, depth
))
501 if(!prs_uint32("enum_context ", ps
, depth
, &q_e
->enum_context
))
503 if(!prs_uint32("preferred_len", ps
, depth
, &q_e
->preferred_len
))
509 /*******************************************************************
510 Inits an LSA_R_ENUM_TRUST_DOM structure.
511 ********************************************************************/
513 void init_r_enum_trust_dom(TALLOC_CTX
*ctx
, LSA_R_ENUM_TRUST_DOM
*r_e
, uint32 enum_context
,
514 uint32 req_num_domains
, uint32 num_domains
, TRUSTDOM
**td
)
518 DEBUG(5, ("init_r_enum_trust_dom\n"));
520 r_e
->enum_context
= enum_context
;
521 r_e
->count
= num_domains
;
523 if ( num_domains
!= 0 ) {
525 /* allocate container memory */
527 r_e
->domlist
= TALLOC_P( ctx
, DOMAIN_LIST
);
528 r_e
->domlist
->domains
= TALLOC_ARRAY( ctx
, DOMAIN_INFO
, r_e
->count
);
530 if ( !r_e
->domlist
|| !r_e
->domlist
->domains
) {
531 r_e
->status
= NT_STATUS_NO_MEMORY
;
535 r_e
->domlist
->count
= r_e
->count
;
537 /* initialize the list of domains and their sid */
539 for (i
= 0; i
< num_domains
; i
++) {
540 if ( !(r_e
->domlist
->domains
[i
].sid
= TALLOC_P(ctx
, DOM_SID2
)) ) {
541 r_e
->status
= NT_STATUS_NO_MEMORY
;
545 init_dom_sid2(r_e
->domlist
->domains
[i
].sid
, &(td
[i
])->sid
);
546 init_unistr4_w(ctx
, &r_e
->domlist
->domains
[i
].name
, (td
[i
])->name
);
552 /*******************************************************************
553 ********************************************************************/
555 BOOL
lsa_io_domain_list( const char *desc
, prs_struct
*ps
, int depth
, DOMAIN_LIST
*domlist
)
559 prs_debug(ps
, depth
, desc
, "lsa_io_domain_list");
562 if(!prs_uint32("count", ps
, depth
, &domlist
->count
))
565 if ( domlist
->count
== 0 )
568 if ( UNMARSHALLING(ps
) ) {
569 if ( !(domlist
->domains
= PRS_ALLOC_MEM( ps
, DOMAIN_INFO
, domlist
->count
)) )
575 for ( i
=0; i
<domlist
->count
; i
++ ) {
576 if ( !prs_unistr4_hdr("name_header", ps
, depth
, &domlist
->domains
[i
].name
) )
578 if ( !smb_io_dom_sid2_p("sid_header", ps
, depth
, &domlist
->domains
[i
].sid
) )
584 for ( i
=0; i
<domlist
->count
; i
++ ) {
585 if ( !prs_unistr4_str("name", ps
, depth
, &domlist
->domains
[i
].name
) )
587 if( !smb_io_dom_sid2("sid", domlist
->domains
[i
].sid
, ps
, depth
) )
594 /*******************************************************************
595 Reads or writes an LSA_R_ENUM_TRUST_DOM structure.
596 ********************************************************************/
598 BOOL
lsa_io_r_enum_trust_dom(const char *desc
, LSA_R_ENUM_TRUST_DOM
*r_e
,
599 prs_struct
*ps
, int depth
)
601 prs_debug(ps
, depth
, desc
, "lsa_io_r_enum_trust_dom");
604 if(!prs_uint32("enum_context", ps
, depth
, &r_e
->enum_context
))
607 if(!prs_uint32("count", ps
, depth
, &r_e
->count
))
610 if ( !prs_pointer("trusted_domains", ps
, depth
, (void**)&r_e
->domlist
, sizeof(DOMAIN_LIST
), (PRS_POINTER_CAST
)lsa_io_domain_list
))
613 if(!prs_ntstatus("status", ps
, depth
, &r_e
->status
))
619 /*******************************************************************
620 reads or writes a dom query structure.
621 ********************************************************************/
623 static BOOL
lsa_io_dom_query(const char *desc
, DOM_QUERY
*d_q
, prs_struct
*ps
, int depth
)
628 prs_debug(ps
, depth
, desc
, "lsa_io_dom_query");
634 if(!prs_uint16("uni_dom_max_len", ps
, depth
, &d_q
->uni_dom_max_len
)) /* domain name string length * 2 */
636 if(!prs_uint16("uni_dom_str_len", ps
, depth
, &d_q
->uni_dom_str_len
)) /* domain name string length * 2 */
639 if(!prs_uint32("buffer_dom_name", ps
, depth
, &d_q
->buffer_dom_name
)) /* undocumented domain name string buffer pointer */
641 if(!prs_uint32("buffer_dom_sid ", ps
, depth
, &d_q
->buffer_dom_sid
)) /* undocumented domain SID string buffer pointer */
644 if(!smb_io_unistr2("unistr2", &d_q
->uni_domain_name
, d_q
->buffer_dom_name
, ps
, depth
)) /* domain name (unicode string) */
650 if (d_q
->buffer_dom_sid
!= 0) {
651 if(!smb_io_dom_sid2("", &d_q
->dom_sid
, ps
, depth
)) /* domain SID */
654 memset((char *)&d_q
->dom_sid
, '\0', sizeof(d_q
->dom_sid
));
660 /*******************************************************************
661 reads or writes a structure.
662 ********************************************************************/
664 static BOOL
lsa_io_dom_query_2(const char *desc
, DOM_QUERY_2
*d_q
, prs_struct
*ps
, int depth
)
671 prs_debug(ps
, depth
, desc
, "lsa_io_dom_query_2");
677 if (!prs_uint32("auditing_enabled", ps
, depth
, &d_q
->auditing_enabled
))
679 if (!prs_uint32("ptr ", ps
, depth
, &ptr
))
681 if (!prs_uint32("count1", ps
, depth
, &d_q
->count1
))
683 if (!prs_uint32("count2", ps
, depth
, &d_q
->count2
))
686 if (UNMARSHALLING(ps
)) {
687 d_q
->auditsettings
= TALLOC_ZERO_ARRAY(ps
->mem_ctx
, uint32
, d_q
->count2
);
690 if (d_q
->auditsettings
== NULL
) {
691 DEBUG(1, ("lsa_io_dom_query_2: NULL auditsettings!\n"));
695 if (!prs_uint32s(False
, "auditsettings", ps
, depth
, d_q
->auditsettings
, d_q
->count2
))
701 /*******************************************************************
702 Reads or writes a dom query structure.
703 ********************************************************************/
705 static BOOL
lsa_io_dom_query_3(const char *desc
, DOM_QUERY_3
*d_q
, prs_struct
*ps
, int depth
)
707 return lsa_io_dom_query("", d_q
, ps
, depth
);
710 /*******************************************************************
711 Reads or writes a dom query structure.
712 ********************************************************************/
714 static BOOL
lsa_io_dom_query_5(const char *desc
, DOM_QUERY_5
*d_q
, prs_struct
*ps
, int depth
)
716 return lsa_io_dom_query("", d_q
, ps
, depth
);
719 /*******************************************************************
720 Reads or writes a dom query structure.
721 ********************************************************************/
723 static BOOL
lsa_io_dom_query_6(const char *desc
, DOM_QUERY_6
*d_q
, prs_struct
*ps
, int depth
)
728 prs_debug(ps
, depth
, desc
, "lsa_io_dom_query_6");
731 if (!prs_uint16("server_role", ps
, depth
, &d_q
->server_role
))
737 /*******************************************************************
738 Reads or writes an LSA_R_QUERY_INFO structure.
739 ********************************************************************/
741 BOOL
lsa_io_r_query(const char *desc
, LSA_R_QUERY_INFO
*r_q
, prs_struct
*ps
,
744 prs_debug(ps
, depth
, desc
, "lsa_io_r_query");
747 if(!prs_uint32("undoc_buffer", ps
, depth
, &r_q
->undoc_buffer
))
750 if (r_q
->undoc_buffer
!= 0) {
751 if(!prs_uint16("info_class", ps
, depth
, &r_q
->info_class
))
757 switch (r_q
->info_class
) {
759 if(!lsa_io_dom_query_2("", &r_q
->dom
.id2
, ps
, depth
))
763 if(!lsa_io_dom_query_3("", &r_q
->dom
.id3
, ps
, depth
))
767 if(!lsa_io_dom_query_5("", &r_q
->dom
.id5
, ps
, depth
))
771 if(!lsa_io_dom_query_6("", &r_q
->dom
.id6
, ps
, depth
))
783 if(!prs_ntstatus("status", ps
, depth
, &r_q
->status
))
789 /*******************************************************************
790 Inits a LSA_SID_ENUM structure.
791 ********************************************************************/
793 static void init_lsa_sid_enum(TALLOC_CTX
*mem_ctx
, LSA_SID_ENUM
*sen
,
794 int num_entries
, const DOM_SID
*sids
)
798 DEBUG(5, ("init_lsa_sid_enum\n"));
800 sen
->num_entries
= num_entries
;
801 sen
->ptr_sid_enum
= (num_entries
!= 0);
802 sen
->num_entries2
= num_entries
;
804 /* Allocate memory for sids and sid pointers */
806 if (num_entries
== 0) return;
808 if ((sen
->ptr_sid
= TALLOC_ZERO_ARRAY(mem_ctx
, uint32
, num_entries
)) == NULL
) {
809 DEBUG(3, ("init_lsa_sid_enum(): out of memory for ptr_sid\n"));
813 if ((sen
->sid
= TALLOC_ZERO_ARRAY(mem_ctx
, DOM_SID2
, num_entries
)) == NULL
) {
814 DEBUG(3, ("init_lsa_sid_enum(): out of memory for sids\n"));
818 /* Copy across SIDs and SID pointers */
820 for (i
= 0; i
< num_entries
; i
++) {
822 init_dom_sid2(&sen
->sid
[i
], &sids
[i
]);
826 /*******************************************************************
827 Reads or writes a LSA_SID_ENUM structure.
828 ********************************************************************/
830 static BOOL
lsa_io_sid_enum(const char *desc
, LSA_SID_ENUM
*sen
, prs_struct
*ps
,
835 prs_debug(ps
, depth
, desc
, "lsa_io_sid_enum");
841 if(!prs_uint32("num_entries ", ps
, depth
, &sen
->num_entries
))
843 if(!prs_uint32("ptr_sid_enum", ps
, depth
, &sen
->ptr_sid_enum
))
847 if the ptr is NULL, leave here. checked from a real w2k trace.
851 if (sen
->ptr_sid_enum
==0)
854 if(!prs_uint32("num_entries2", ps
, depth
, &sen
->num_entries2
))
857 /* Mallocate memory if we're unpacking from the wire */
859 if (UNMARSHALLING(ps
)) {
860 if ((sen
->ptr_sid
= PRS_ALLOC_MEM( ps
, uint32
, sen
->num_entries
)) == NULL
) {
861 DEBUG(3, ("init_lsa_sid_enum(): out of memory for "
866 if ((sen
->sid
= PRS_ALLOC_MEM( ps
, DOM_SID2
, sen
->num_entries
)) == NULL
) {
867 DEBUG(3, ("init_lsa_sid_enum(): out of memory for "
873 for (i
= 0; i
< sen
->num_entries
; i
++) {
876 slprintf(temp
, sizeof(temp
) - 1, "ptr_sid[%d]", i
);
877 if(!prs_uint32(temp
, ps
, depth
, &sen
->ptr_sid
[i
])) {
882 for (i
= 0; i
< sen
->num_entries
; i
++) {
885 slprintf(temp
, sizeof(temp
) - 1, "sid[%d]", i
);
886 if(!smb_io_dom_sid2(temp
, &sen
->sid
[i
], ps
, depth
)) {
894 /*******************************************************************
895 Inits an LSA_R_ENUM_TRUST_DOM structure.
896 ********************************************************************/
898 void init_q_lookup_sids(TALLOC_CTX
*mem_ctx
, LSA_Q_LOOKUP_SIDS
*q_l
,
899 POLICY_HND
*hnd
, int num_sids
, const DOM_SID
*sids
,
902 DEBUG(5, ("init_q_lookup_sids\n"));
906 memcpy(&q_l
->pol
, hnd
, sizeof(q_l
->pol
));
907 init_lsa_sid_enum(mem_ctx
, &q_l
->sids
, num_sids
, sids
);
912 /*******************************************************************
913 Reads or writes a LSA_Q_LOOKUP_SIDS structure.
914 ********************************************************************/
916 BOOL
lsa_io_q_lookup_sids(const char *desc
, LSA_Q_LOOKUP_SIDS
*q_s
, prs_struct
*ps
,
919 prs_debug(ps
, depth
, desc
, "lsa_io_q_lookup_sids");
925 if(!smb_io_pol_hnd("pol_hnd", &q_s
->pol
, ps
, depth
)) /* policy handle */
927 if(!lsa_io_sid_enum("sids ", &q_s
->sids
, ps
, depth
)) /* sids to be looked up */
929 if(!lsa_io_trans_names("names ", &q_s
->names
, ps
, depth
)) /* translated names */
932 if(!prs_uint16("level", ps
, depth
, &q_s
->level
)) /* lookup level */
937 if(!prs_uint32("mapped_count", ps
, depth
, &q_s
->mapped_count
))
943 /*******************************************************************
944 Reads or writes a structure.
945 ********************************************************************/
947 static BOOL
lsa_io_trans_names(const char *desc
, LSA_TRANS_NAME_ENUM
*trn
,
948 prs_struct
*ps
, int depth
)
952 prs_debug(ps
, depth
, desc
, "lsa_io_trans_names");
958 if(!prs_uint32("num_entries ", ps
, depth
, &trn
->num_entries
))
960 if(!prs_uint32("ptr_trans_names", ps
, depth
, &trn
->ptr_trans_names
))
963 if (trn
->ptr_trans_names
!= 0) {
964 if(!prs_uint32("num_entries2 ", ps
, depth
,
968 if (UNMARSHALLING(ps
)) {
969 if ((trn
->name
= PRS_ALLOC_MEM(ps
, LSA_TRANS_NAME
, trn
->num_entries
)) == NULL
) {
973 if ((trn
->uni_name
= PRS_ALLOC_MEM(ps
, UNISTR2
, trn
->num_entries
)) == NULL
) {
978 for (i
= 0; i
< trn
->num_entries2
; i
++) {
980 slprintf(t
, sizeof(t
) - 1, "name[%d] ", i
);
982 if(!lsa_io_trans_name(t
, &trn
->name
[i
], ps
, depth
)) /* translated name */
986 for (i
= 0; i
< trn
->num_entries2
; i
++) {
988 slprintf(t
, sizeof(t
) - 1, "name[%d] ", i
);
990 if(!smb_io_unistr2(t
, &trn
->uni_name
[i
], trn
->name
[i
].hdr_name
.buffer
, ps
, depth
))
1000 /*******************************************************************
1001 Reads or writes a structure.
1002 ********************************************************************/
1004 BOOL
lsa_io_r_lookup_sids(const char *desc
, LSA_R_LOOKUP_SIDS
*r_s
,
1005 prs_struct
*ps
, int depth
)
1007 prs_debug(ps
, depth
, desc
, "lsa_io_r_lookup_sids");
1013 if(!prs_uint32("ptr_dom_ref", ps
, depth
, &r_s
->ptr_dom_ref
))
1016 if (r_s
->ptr_dom_ref
!= 0)
1017 if(!lsa_io_dom_r_ref ("dom_ref", r_s
->dom_ref
, ps
, depth
)) /* domain reference info */
1020 if(!lsa_io_trans_names("names ", r_s
->names
, ps
, depth
)) /* translated names */
1026 if(!prs_uint32("mapped_count", ps
, depth
, &r_s
->mapped_count
))
1029 if(!prs_ntstatus("status ", ps
, depth
, &r_s
->status
))
1035 /*******************************************************************
1037 ********************************************************************/
1039 void init_q_lookup_names(TALLOC_CTX
*mem_ctx
, LSA_Q_LOOKUP_NAMES
*q_l
,
1040 POLICY_HND
*hnd
, int num_names
, const char **names
)
1044 DEBUG(5, ("init_q_lookup_names\n"));
1049 q_l
->num_entries
= num_names
;
1050 q_l
->num_entries2
= num_names
;
1051 q_l
->lookup_level
= 1;
1053 if ((q_l
->uni_name
= TALLOC_ZERO_ARRAY(mem_ctx
, UNISTR2
, num_names
)) == NULL
) {
1054 DEBUG(3, ("init_q_lookup_names(): out of memory\n"));
1058 if ((q_l
->hdr_name
= TALLOC_ZERO_ARRAY(mem_ctx
, UNIHDR
, num_names
)) == NULL
) {
1059 DEBUG(3, ("init_q_lookup_names(): out of memory\n"));
1063 for (i
= 0; i
< num_names
; i
++) {
1064 init_unistr2(&q_l
->uni_name
[i
], names
[i
], UNI_FLAGS_NONE
);
1065 init_uni_hdr(&q_l
->hdr_name
[i
], &q_l
->uni_name
[i
]);
1069 /*******************************************************************
1070 reads or writes a structure.
1071 ********************************************************************/
1073 BOOL
lsa_io_q_lookup_names(const char *desc
, LSA_Q_LOOKUP_NAMES
*q_r
,
1074 prs_struct
*ps
, int depth
)
1078 prs_debug(ps
, depth
, desc
, "lsa_io_q_lookup_names");
1084 if(!smb_io_pol_hnd("", &q_r
->pol
, ps
, depth
)) /* policy handle */
1089 if(!prs_uint32("num_entries ", ps
, depth
, &q_r
->num_entries
))
1091 if(!prs_uint32("num_entries2 ", ps
, depth
, &q_r
->num_entries2
))
1094 if (UNMARSHALLING(ps
)) {
1095 if (q_r
->num_entries
) {
1096 if ((q_r
->hdr_name
= PRS_ALLOC_MEM(ps
, UNIHDR
, q_r
->num_entries
)) == NULL
)
1098 if ((q_r
->uni_name
= PRS_ALLOC_MEM(ps
, UNISTR2
, q_r
->num_entries
)) == NULL
)
1103 for (i
= 0; i
< q_r
->num_entries
; i
++) {
1106 if(!smb_io_unihdr("hdr_name", &q_r
->hdr_name
[i
], ps
, depth
)) /* pointer names */
1110 for (i
= 0; i
< q_r
->num_entries
; i
++) {
1113 if(!smb_io_unistr2("dom_name", &q_r
->uni_name
[i
], q_r
->hdr_name
[i
].buffer
, ps
, depth
)) /* names to be looked up */
1119 if(!prs_uint32("num_trans_entries ", ps
, depth
, &q_r
->num_trans_entries
))
1121 if(!prs_uint32("ptr_trans_sids ", ps
, depth
, &q_r
->ptr_trans_sids
))
1123 if(!prs_uint32("lookup_level ", ps
, depth
, &q_r
->lookup_level
))
1125 if(!prs_uint32("mapped_count ", ps
, depth
, &q_r
->mapped_count
))
1131 /*******************************************************************
1132 reads or writes a structure.
1133 ********************************************************************/
1135 BOOL
lsa_io_r_lookup_names(const char *desc
, LSA_R_LOOKUP_NAMES
*r_r
,
1136 prs_struct
*ps
, int depth
)
1140 prs_debug(ps
, depth
, desc
, "lsa_io_r_lookup_names");
1146 if(!prs_uint32("ptr_dom_ref", ps
, depth
, &r_r
->ptr_dom_ref
))
1149 if (r_r
->ptr_dom_ref
!= 0)
1150 if(!lsa_io_dom_r_ref("", r_r
->dom_ref
, ps
, depth
))
1153 if(!prs_uint32("num_entries", ps
, depth
, &r_r
->num_entries
))
1155 if(!prs_uint32("ptr_entries", ps
, depth
, &r_r
->ptr_entries
))
1158 if (r_r
->ptr_entries
!= 0) {
1159 if(!prs_uint32("num_entries2", ps
, depth
, &r_r
->num_entries2
))
1162 if (r_r
->num_entries2
!= r_r
->num_entries
) {
1167 if (UNMARSHALLING(ps
)) {
1168 if ((r_r
->dom_rid
= PRS_ALLOC_MEM(ps
, DOM_RID2
, r_r
->num_entries2
))
1170 DEBUG(3, ("lsa_io_r_lookup_names(): out of memory\n"));
1175 for (i
= 0; i
< r_r
->num_entries2
; i
++)
1176 if(!smb_io_dom_rid2("", &r_r
->dom_rid
[i
], ps
, depth
)) /* domain RIDs being looked up */
1180 if(!prs_uint32("mapped_count", ps
, depth
, &r_r
->mapped_count
))
1183 if(!prs_ntstatus("status ", ps
, depth
, &r_r
->status
))
1190 /*******************************************************************
1191 Inits an LSA_Q_CLOSE structure.
1192 ********************************************************************/
1194 void init_lsa_q_close(LSA_Q_CLOSE
*q_c
, POLICY_HND
*hnd
)
1196 DEBUG(5, ("init_lsa_q_close\n"));
1198 memcpy(&q_c
->pol
, hnd
, sizeof(q_c
->pol
));
1201 /*******************************************************************
1202 Reads or writes an LSA_Q_CLOSE structure.
1203 ********************************************************************/
1205 BOOL
lsa_io_q_close(const char *desc
, LSA_Q_CLOSE
*q_c
, prs_struct
*ps
, int depth
)
1207 prs_debug(ps
, depth
, desc
, "lsa_io_q_close");
1210 if(!smb_io_pol_hnd("", &q_c
->pol
, ps
, depth
))
1216 /*******************************************************************
1217 Reads or writes an LSA_R_CLOSE structure.
1218 ********************************************************************/
1220 BOOL
lsa_io_r_close(const char *desc
, LSA_R_CLOSE
*r_c
, prs_struct
*ps
, int depth
)
1222 prs_debug(ps
, depth
, desc
, "lsa_io_r_close");
1225 if(!smb_io_pol_hnd("", &r_c
->pol
, ps
, depth
))
1228 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1234 /*******************************************************************
1235 Reads or writes an LSA_Q_OPEN_SECRET structure.
1236 ********************************************************************/
1238 BOOL
lsa_io_q_open_secret(const char *desc
, LSA_Q_OPEN_SECRET
*q_c
, prs_struct
*ps
, int depth
)
1240 prs_debug(ps
, depth
, desc
, "lsa_io_q_open_secret");
1243 /* Don't bother to read or write at present... */
1247 /*******************************************************************
1248 Reads or writes an LSA_R_OPEN_SECRET structure.
1249 ********************************************************************/
1251 BOOL
lsa_io_r_open_secret(const char *desc
, LSA_R_OPEN_SECRET
*r_c
, prs_struct
*ps
, int depth
)
1253 prs_debug(ps
, depth
, desc
, "lsa_io_r_open_secret");
1259 if(!prs_uint32("dummy1", ps
, depth
, &r_c
->dummy1
))
1261 if(!prs_uint32("dummy2", ps
, depth
, &r_c
->dummy2
))
1263 if(!prs_uint32("dummy3", ps
, depth
, &r_c
->dummy3
))
1265 if(!prs_uint32("dummy4", ps
, depth
, &r_c
->dummy4
))
1267 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1273 /*******************************************************************
1274 Inits an LSA_Q_ENUM_PRIVS structure.
1275 ********************************************************************/
1277 void init_q_enum_privs(LSA_Q_ENUM_PRIVS
*q_q
, POLICY_HND
*hnd
, uint32 enum_context
, uint32 pref_max_length
)
1279 DEBUG(5, ("init_q_enum_privs\n"));
1281 memcpy(&q_q
->pol
, hnd
, sizeof(q_q
->pol
));
1283 q_q
->enum_context
= enum_context
;
1284 q_q
->pref_max_length
= pref_max_length
;
1287 /*******************************************************************
1288 reads or writes a structure.
1289 ********************************************************************/
1290 BOOL
lsa_io_q_enum_privs(const char *desc
, LSA_Q_ENUM_PRIVS
*q_q
, prs_struct
*ps
, int depth
)
1295 prs_debug(ps
, depth
, desc
, "lsa_io_q_enum_privs");
1298 if (!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1301 if(!prs_uint32("enum_context ", ps
, depth
, &q_q
->enum_context
))
1303 if(!prs_uint32("pref_max_length", ps
, depth
, &q_q
->pref_max_length
))
1309 /*******************************************************************
1310 reads or writes a structure.
1311 ********************************************************************/
1312 static BOOL
lsa_io_priv_entries(const char *desc
, LSA_PRIV_ENTRY
*entries
, uint32 count
, prs_struct
*ps
, int depth
)
1316 if (entries
== NULL
)
1319 prs_debug(ps
, depth
, desc
, "lsa_io_priv_entries");
1325 for (i
= 0; i
< count
; i
++) {
1326 if (!smb_io_unihdr("", &entries
[i
].hdr_name
, ps
, depth
))
1328 if(!prs_uint32("luid_low ", ps
, depth
, &entries
[i
].luid_low
))
1330 if(!prs_uint32("luid_high", ps
, depth
, &entries
[i
].luid_high
))
1334 for (i
= 0; i
< count
; i
++)
1335 if (!smb_io_unistr2("", &entries
[i
].name
, entries
[i
].hdr_name
.buffer
, ps
, depth
))
1341 /*******************************************************************
1342 Inits an LSA_R_ENUM_PRIVS structure.
1343 ********************************************************************/
1345 void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS
*r_u
, uint32 enum_context
,
1346 uint32 count
, LSA_PRIV_ENTRY
*entries
)
1348 DEBUG(5, ("init_lsa_r_enum_privs\n"));
1350 r_u
->enum_context
=enum_context
;
1353 if (entries
!=NULL
) {
1364 /*******************************************************************
1365 reads or writes a structure.
1366 ********************************************************************/
1367 BOOL
lsa_io_r_enum_privs(const char *desc
, LSA_R_ENUM_PRIVS
*r_q
, prs_struct
*ps
, int depth
)
1372 prs_debug(ps
, depth
, desc
, "lsa_io_r_enum_privs");
1378 if(!prs_uint32("enum_context", ps
, depth
, &r_q
->enum_context
))
1380 if(!prs_uint32("count", ps
, depth
, &r_q
->count
))
1382 if(!prs_uint32("ptr", ps
, depth
, &r_q
->ptr
))
1386 if(!prs_uint32("count1", ps
, depth
, &r_q
->count1
))
1389 if (UNMARSHALLING(ps
))
1390 if (!(r_q
->privs
= PRS_ALLOC_MEM(ps
, LSA_PRIV_ENTRY
, r_q
->count1
)))
1393 if (!lsa_io_priv_entries("", r_q
->privs
, r_q
->count1
, ps
, depth
))
1400 if(!prs_ntstatus("status", ps
, depth
, &r_q
->status
))
1406 void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME
*trn
, POLICY_HND
*hnd
, const char *name
, uint16 lang_id
, uint16 lang_id_sys
)
1408 memcpy(&trn
->pol
, hnd
, sizeof(trn
->pol
));
1410 init_unistr2(&trn
->name
, name
, UNI_FLAGS_NONE
);
1411 init_uni_hdr(&trn
->hdr_name
, &trn
->name
);
1412 trn
->lang_id
= lang_id
;
1413 trn
->lang_id_sys
= lang_id_sys
;
1416 /*******************************************************************
1417 reads or writes a structure.
1418 ********************************************************************/
1419 BOOL
lsa_io_q_priv_get_dispname(const char *desc
, LSA_Q_PRIV_GET_DISPNAME
*q_q
, prs_struct
*ps
, int depth
)
1424 prs_debug(ps
, depth
, desc
, "lsa_io_q_priv_get_dispname");
1430 if (!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1433 if (!smb_io_unihdr("hdr_name", &q_q
->hdr_name
, ps
, depth
))
1436 if (!smb_io_unistr2("name", &q_q
->name
, q_q
->hdr_name
.buffer
, ps
, depth
))
1439 if(!prs_uint16("lang_id ", ps
, depth
, &q_q
->lang_id
))
1441 if(!prs_uint16("lang_id_sys", ps
, depth
, &q_q
->lang_id_sys
))
1447 /*******************************************************************
1448 reads or writes a structure.
1449 ********************************************************************/
1450 BOOL
lsa_io_r_priv_get_dispname(const char *desc
, LSA_R_PRIV_GET_DISPNAME
*r_q
, prs_struct
*ps
, int depth
)
1455 prs_debug(ps
, depth
, desc
, "lsa_io_r_priv_get_dispname");
1461 if (!prs_uint32("ptr_info", ps
, depth
, &r_q
->ptr_info
))
1465 if (!smb_io_unihdr("hdr_name", &r_q
->hdr_desc
, ps
, depth
))
1468 if (!smb_io_unistr2("desc", &r_q
->desc
, r_q
->hdr_desc
.buffer
, ps
, depth
))
1475 if(!prs_uint16("lang_id", ps
, depth
, &r_q
->lang_id
))
1480 if(!prs_ntstatus("status", ps
, depth
, &r_q
->status
))
1487 initialise a LSA_Q_ENUM_ACCOUNTS structure
1489 void init_lsa_q_enum_accounts(LSA_Q_ENUM_ACCOUNTS
*trn
, POLICY_HND
*hnd
, uint32 enum_context
, uint32 pref_max_length
)
1491 memcpy(&trn
->pol
, hnd
, sizeof(trn
->pol
));
1493 trn
->enum_context
= enum_context
;
1494 trn
->pref_max_length
= pref_max_length
;
1497 /*******************************************************************
1498 reads or writes a structure.
1499 ********************************************************************/
1500 BOOL
lsa_io_q_enum_accounts(const char *desc
, LSA_Q_ENUM_ACCOUNTS
*q_q
, prs_struct
*ps
, int depth
)
1505 prs_debug(ps
, depth
, desc
, "lsa_io_q_enum_accounts");
1508 if (!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
1511 if(!prs_uint32("enum_context ", ps
, depth
, &q_q
->enum_context
))
1513 if(!prs_uint32("pref_max_length", ps
, depth
, &q_q
->pref_max_length
))
1520 /*******************************************************************
1521 Inits an LSA_R_ENUM_PRIVS structure.
1522 ********************************************************************/
1524 void init_lsa_r_enum_accounts(LSA_R_ENUM_ACCOUNTS
*r_u
, uint32 enum_context
)
1526 DEBUG(5, ("init_lsa_r_enum_accounts\n"));
1528 r_u
->enum_context
=enum_context
;
1529 if (r_u
->enum_context
!=0) {
1530 r_u
->sids
.num_entries
=enum_context
;
1531 r_u
->sids
.ptr_sid_enum
=1;
1532 r_u
->sids
.num_entries2
=enum_context
;
1534 r_u
->sids
.num_entries
=0;
1535 r_u
->sids
.ptr_sid_enum
=0;
1536 r_u
->sids
.num_entries2
=0;
1540 /*******************************************************************
1541 reads or writes a structure.
1542 ********************************************************************/
1543 BOOL
lsa_io_r_enum_accounts(const char *desc
, LSA_R_ENUM_ACCOUNTS
*r_q
, prs_struct
*ps
, int depth
)
1548 prs_debug(ps
, depth
, desc
, "lsa_io_r_enum_accounts");
1554 if(!prs_uint32("enum_context", ps
, depth
, &r_q
->enum_context
))
1557 if (!lsa_io_sid_enum("sids", &r_q
->sids
, ps
, depth
))
1563 if(!prs_ntstatus("status", ps
, depth
, &r_q
->status
))
1570 /*******************************************************************
1571 Reads or writes an LSA_Q_UNK_GET_CONNUSER structure.
1572 ********************************************************************/
1574 BOOL
lsa_io_q_unk_get_connuser(const char *desc
, LSA_Q_UNK_GET_CONNUSER
*q_c
, prs_struct
*ps
, int depth
)
1576 prs_debug(ps
, depth
, desc
, "lsa_io_q_unk_get_connuser");
1582 if(!prs_uint32("ptr_srvname", ps
, depth
, &q_c
->ptr_srvname
))
1585 if(!smb_io_unistr2("uni2_srvname", &q_c
->uni2_srvname
, q_c
->ptr_srvname
, ps
, depth
)) /* server name to be looked up */
1591 if(!prs_uint32("unk1", ps
, depth
, &q_c
->unk1
))
1593 if(!prs_uint32("unk2", ps
, depth
, &q_c
->unk2
))
1595 if(!prs_uint32("unk3", ps
, depth
, &q_c
->unk3
))
1598 /* Don't bother to read or write at present... */
1602 /*******************************************************************
1603 Reads or writes an LSA_R_UNK_GET_CONNUSER structure.
1604 ********************************************************************/
1606 BOOL
lsa_io_r_unk_get_connuser(const char *desc
, LSA_R_UNK_GET_CONNUSER
*r_c
, prs_struct
*ps
, int depth
)
1608 prs_debug(ps
, depth
, desc
, "lsa_io_r_unk_get_connuser");
1614 if(!prs_uint32("ptr_user_name", ps
, depth
, &r_c
->ptr_user_name
))
1616 if(!smb_io_unihdr("hdr_user_name", &r_c
->hdr_user_name
, ps
, depth
))
1618 if(!smb_io_unistr2("uni2_user_name", &r_c
->uni2_user_name
, r_c
->ptr_user_name
, ps
, depth
))
1624 if(!prs_uint32("unk1", ps
, depth
, &r_c
->unk1
))
1627 if(!prs_uint32("ptr_dom_name", ps
, depth
, &r_c
->ptr_dom_name
))
1629 if(!smb_io_unihdr("hdr_dom_name", &r_c
->hdr_dom_name
, ps
, depth
))
1631 if(!smb_io_unistr2("uni2_dom_name", &r_c
->uni2_dom_name
, r_c
->ptr_dom_name
, ps
, depth
))
1637 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1643 void init_lsa_q_create_account(LSA_Q_CREATEACCOUNT
*trn
, POLICY_HND
*hnd
, DOM_SID
*sid
, uint32 desired_access
)
1645 memcpy(&trn
->pol
, hnd
, sizeof(trn
->pol
));
1647 init_dom_sid2(&trn
->sid
, sid
);
1648 trn
->access
= desired_access
;
1652 /*******************************************************************
1653 Reads or writes an LSA_Q_CREATEACCOUNT structure.
1654 ********************************************************************/
1656 BOOL
lsa_io_q_create_account(const char *desc
, LSA_Q_CREATEACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1658 prs_debug(ps
, depth
, desc
, "lsa_io_q_create_account");
1664 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
1667 if(!smb_io_dom_sid2("sid", &r_c
->sid
, ps
, depth
)) /* domain SID */
1670 if(!prs_uint32("access", ps
, depth
, &r_c
->access
))
1676 /*******************************************************************
1677 Reads or writes an LSA_R_CREATEACCOUNT structure.
1678 ********************************************************************/
1680 BOOL
lsa_io_r_create_account(const char *desc
, LSA_R_CREATEACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1682 prs_debug(ps
, depth
, desc
, "lsa_io_r_open_account");
1688 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
1691 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1698 void init_lsa_q_open_account(LSA_Q_OPENACCOUNT
*trn
, POLICY_HND
*hnd
, DOM_SID
*sid
, uint32 desired_access
)
1700 memcpy(&trn
->pol
, hnd
, sizeof(trn
->pol
));
1702 init_dom_sid2(&trn
->sid
, sid
);
1703 trn
->access
= desired_access
;
1706 /*******************************************************************
1707 Reads or writes an LSA_Q_OPENACCOUNT structure.
1708 ********************************************************************/
1710 BOOL
lsa_io_q_open_account(const char *desc
, LSA_Q_OPENACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1712 prs_debug(ps
, depth
, desc
, "lsa_io_q_open_account");
1718 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
1721 if(!smb_io_dom_sid2("sid", &r_c
->sid
, ps
, depth
)) /* domain SID */
1724 if(!prs_uint32("access", ps
, depth
, &r_c
->access
))
1730 /*******************************************************************
1731 Reads or writes an LSA_R_OPENACCOUNT structure.
1732 ********************************************************************/
1734 BOOL
lsa_io_r_open_account(const char *desc
, LSA_R_OPENACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1736 prs_debug(ps
, depth
, desc
, "lsa_io_r_open_account");
1742 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
1745 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1752 void init_lsa_q_enum_privsaccount(LSA_Q_ENUMPRIVSACCOUNT
*trn
, POLICY_HND
*hnd
)
1754 memcpy(&trn
->pol
, hnd
, sizeof(trn
->pol
));
1758 /*******************************************************************
1759 Reads or writes an LSA_Q_ENUMPRIVSACCOUNT structure.
1760 ********************************************************************/
1762 BOOL
lsa_io_q_enum_privsaccount(const char *desc
, LSA_Q_ENUMPRIVSACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1764 prs_debug(ps
, depth
, desc
, "lsa_io_q_enum_privsaccount");
1770 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
1776 /*******************************************************************
1777 Reads or writes an LUID structure.
1778 ********************************************************************/
1780 static BOOL
lsa_io_luid(const char *desc
, LUID
*r_c
, prs_struct
*ps
, int depth
)
1782 prs_debug(ps
, depth
, desc
, "lsa_io_luid");
1788 if(!prs_uint32("low", ps
, depth
, &r_c
->low
))
1791 if(!prs_uint32("high", ps
, depth
, &r_c
->high
))
1797 /*******************************************************************
1798 Reads or writes an LUID_ATTR structure.
1799 ********************************************************************/
1801 static BOOL
lsa_io_luid_attr(const char *desc
, LUID_ATTR
*r_c
, prs_struct
*ps
, int depth
)
1803 prs_debug(ps
, depth
, desc
, "lsa_io_luid_attr");
1809 if (!lsa_io_luid(desc
, &r_c
->luid
, ps
, depth
))
1812 if(!prs_uint32("attr", ps
, depth
, &r_c
->attr
))
1818 /*******************************************************************
1819 Reads or writes an PRIVILEGE_SET structure.
1820 ********************************************************************/
1822 static BOOL
lsa_io_privilege_set(const char *desc
, PRIVILEGE_SET
*r_c
, prs_struct
*ps
, int depth
)
1826 prs_debug(ps
, depth
, desc
, "lsa_io_privilege_set");
1832 if(!prs_uint32("count", ps
, depth
, &r_c
->count
))
1834 if(!prs_uint32("control", ps
, depth
, &r_c
->control
))
1837 for (i
=0; i
<r_c
->count
; i
++) {
1838 if (!lsa_io_luid_attr(desc
, &r_c
->set
[i
], ps
, depth
))
1845 NTSTATUS
init_lsa_r_enum_privsaccount(TALLOC_CTX
*mem_ctx
, LSA_R_ENUMPRIVSACCOUNT
*r_u
, LUID_ATTR
*set
, uint32 count
, uint32 control
)
1847 NTSTATUS ret
= NT_STATUS_OK
;
1852 if ( !NT_STATUS_IS_OK(ret
= privilege_set_init_by_ctx(mem_ctx
, &(r_u
->set
))) )
1855 r_u
->set
.count
= count
;
1857 if (!NT_STATUS_IS_OK(ret
= dup_luid_attr(r_u
->set
.mem_ctx
, &(r_u
->set
.set
), set
, count
)))
1860 DEBUG(10,("init_lsa_r_enum_privsaccount: %d privileges\n", r_u
->count
));
1865 /*******************************************************************
1866 Reads or writes an LSA_R_ENUMPRIVSACCOUNT structure.
1867 ********************************************************************/
1869 BOOL
lsa_io_r_enum_privsaccount(const char *desc
, LSA_R_ENUMPRIVSACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1871 prs_debug(ps
, depth
, desc
, "lsa_io_r_enum_privsaccount");
1877 if(!prs_uint32("ptr", ps
, depth
, &r_c
->ptr
))
1881 if(!prs_uint32("count", ps
, depth
, &r_c
->count
))
1884 /* malloc memory if unmarshalling here */
1886 if (UNMARSHALLING(ps
) && r_c
->count
!= 0) {
1887 if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps
->mem_ctx
, &(r_c
->set
))))
1890 if (!(r_c
->set
.set
= PRS_ALLOC_MEM(ps
,LUID_ATTR
,r_c
->count
)))
1895 if(!lsa_io_privilege_set(desc
, &r_c
->set
, ps
, depth
))
1899 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1907 /*******************************************************************
1908 Reads or writes an LSA_Q_GETSYSTEMACCOUNTstructure.
1909 ********************************************************************/
1911 BOOL
lsa_io_q_getsystemaccount(const char *desc
, LSA_Q_GETSYSTEMACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1913 prs_debug(ps
, depth
, desc
, "lsa_io_q_getsystemaccount");
1919 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
1925 /*******************************************************************
1926 Reads or writes an LSA_R_GETSYSTEMACCOUNTstructure.
1927 ********************************************************************/
1929 BOOL
lsa_io_r_getsystemaccount(const char *desc
, LSA_R_GETSYSTEMACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1931 prs_debug(ps
, depth
, desc
, "lsa_io_r_getsystemaccount");
1937 if(!prs_uint32("access", ps
, depth
, &r_c
->access
))
1940 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1947 /*******************************************************************
1948 Reads or writes an LSA_Q_SETSYSTEMACCOUNT structure.
1949 ********************************************************************/
1951 BOOL
lsa_io_q_setsystemaccount(const char *desc
, LSA_Q_SETSYSTEMACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1953 prs_debug(ps
, depth
, desc
, "lsa_io_q_setsystemaccount");
1959 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
1962 if(!prs_uint32("access", ps
, depth
, &r_c
->access
))
1968 /*******************************************************************
1969 Reads or writes an LSA_R_SETSYSTEMACCOUNT structure.
1970 ********************************************************************/
1972 BOOL
lsa_io_r_setsystemaccount(const char *desc
, LSA_R_SETSYSTEMACCOUNT
*r_c
, prs_struct
*ps
, int depth
)
1974 prs_debug(ps
, depth
, desc
, "lsa_io_r_setsystemaccount");
1980 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
1987 static void init_lsa_string( LSA_STRING
*uni
, const char *string
)
1989 init_unistr2(&uni
->unistring
, string
, UNI_FLAGS_NONE
);
1990 init_uni_hdr(&uni
->hdr
, &uni
->unistring
);
1993 void init_lsa_q_lookup_priv_value(LSA_Q_LOOKUP_PRIV_VALUE
*q_u
, POLICY_HND
*hnd
, const char *name
)
1995 memcpy(&q_u
->pol
, hnd
, sizeof(q_u
->pol
));
1996 init_lsa_string( &q_u
->privname
, name
);
1999 BOOL
smb_io_lsa_string( const char *desc
, LSA_STRING
*string
, prs_struct
*ps
, int depth
)
2001 prs_debug(ps
, depth
, desc
, "smb_io_lsa_string");
2004 if(!smb_io_unihdr ("hdr", &string
->hdr
, ps
, depth
))
2006 if(!smb_io_unistr2("unistring", &string
->unistring
, string
->hdr
.buffer
, ps
, depth
))
2012 /*******************************************************************
2013 Reads or writes an LSA_Q_LOOKUP_PRIV_VALUE structure.
2014 ********************************************************************/
2016 BOOL
lsa_io_q_lookup_priv_value(const char *desc
, LSA_Q_LOOKUP_PRIV_VALUE
*r_c
, prs_struct
*ps
, int depth
)
2018 prs_debug(ps
, depth
, desc
, "lsa_io_q_lookup_priv_value");
2024 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
2026 if(!smb_io_lsa_string("privname", &r_c
->privname
, ps
, depth
))
2032 /*******************************************************************
2033 Reads or writes an LSA_R_LOOKUP_PRIV_VALUE structure.
2034 ********************************************************************/
2036 BOOL
lsa_io_r_lookup_priv_value(const char *desc
, LSA_R_LOOKUP_PRIV_VALUE
*r_c
, prs_struct
*ps
, int depth
)
2038 prs_debug(ps
, depth
, desc
, "lsa_io_r_lookup_priv_value");
2044 if(!lsa_io_luid("luid", &r_c
->luid
, ps
, depth
))
2047 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
2054 /*******************************************************************
2055 Reads or writes an LSA_Q_ADDPRIVS structure.
2056 ********************************************************************/
2058 BOOL
lsa_io_q_addprivs(const char *desc
, LSA_Q_ADDPRIVS
*r_c
, prs_struct
*ps
, int depth
)
2060 prs_debug(ps
, depth
, desc
, "lsa_io_q_addprivs");
2066 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
2069 if(!prs_uint32("count", ps
, depth
, &r_c
->count
))
2072 if (UNMARSHALLING(ps
) && r_c
->count
!=0) {
2073 if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps
->mem_ctx
, &(r_c
->set
))))
2076 if (!(r_c
->set
.set
= PRS_ALLOC_MEM(ps
, LUID_ATTR
, r_c
->count
)))
2080 if(!lsa_io_privilege_set(desc
, &r_c
->set
, ps
, depth
))
2086 /*******************************************************************
2087 Reads or writes an LSA_R_ADDPRIVS structure.
2088 ********************************************************************/
2090 BOOL
lsa_io_r_addprivs(const char *desc
, LSA_R_ADDPRIVS
*r_c
, prs_struct
*ps
, int depth
)
2092 prs_debug(ps
, depth
, desc
, "lsa_io_r_addprivs");
2098 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
2104 /*******************************************************************
2105 Reads or writes an LSA_Q_REMOVEPRIVS structure.
2106 ********************************************************************/
2108 BOOL
lsa_io_q_removeprivs(const char *desc
, LSA_Q_REMOVEPRIVS
*r_c
, prs_struct
*ps
, int depth
)
2110 prs_debug(ps
, depth
, desc
, "lsa_io_q_removeprivs");
2116 if(!smb_io_pol_hnd("pol", &r_c
->pol
, ps
, depth
))
2119 if(!prs_uint32("allrights", ps
, depth
, &r_c
->allrights
))
2122 if(!prs_uint32("ptr", ps
, depth
, &r_c
->ptr
))
2126 * JFM: I'm not sure at all if the count is inside the ptr
2127 * never seen one with ptr=0
2131 if(!prs_uint32("count", ps
, depth
, &r_c
->count
))
2134 if (UNMARSHALLING(ps
) && r_c
->count
!=0) {
2135 if (!NT_STATUS_IS_OK(privilege_set_init_by_ctx(ps
->mem_ctx
, &(r_c
->set
))))
2138 if (!(r_c
->set
.set
= PRS_ALLOC_MEM(ps
, LUID_ATTR
, r_c
->count
)))
2142 if(!lsa_io_privilege_set(desc
, &r_c
->set
, ps
, depth
))
2149 /*******************************************************************
2150 Reads or writes an LSA_R_REMOVEPRIVS structure.
2151 ********************************************************************/
2153 BOOL
lsa_io_r_removeprivs(const char *desc
, LSA_R_REMOVEPRIVS
*r_c
, prs_struct
*ps
, int depth
)
2155 prs_debug(ps
, depth
, desc
, "lsa_io_r_removeprivs");
2161 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
2167 BOOL
policy_handle_is_valid(const POLICY_HND
*hnd
)
2169 POLICY_HND zero_pol
;
2171 ZERO_STRUCT(zero_pol
);
2172 return ((memcmp(&zero_pol
, hnd
, sizeof(POLICY_HND
)) == 0) ? False
: True
);
2175 /*******************************************************************
2176 Reads or writes an LSA_DNS_DOM_INFO structure.
2177 ********************************************************************/
2179 BOOL
lsa_io_dns_dom_info(const char *desc
, LSA_DNS_DOM_INFO
*info
,
2180 prs_struct
*ps
, int depth
)
2182 prs_debug(ps
, depth
, desc
, "lsa_io_dns_dom_info");
2187 if(!smb_io_unihdr("nb_name", &info
->hdr_nb_dom_name
, ps
, depth
))
2189 if(!smb_io_unihdr("dns_name", &info
->hdr_dns_dom_name
, ps
, depth
))
2191 if(!smb_io_unihdr("forest", &info
->hdr_forest_name
, ps
, depth
))
2196 if ( !smb_io_uuid("dom_guid", &info
->dom_guid
, ps
, depth
) )
2201 if(!prs_uint32("dom_sid", ps
, depth
, &info
->ptr_dom_sid
))
2204 if(!smb_io_unistr2("nb_name", &info
->uni_nb_dom_name
,
2205 info
->hdr_nb_dom_name
.buffer
, ps
, depth
))
2207 if(!smb_io_unistr2("dns_name", &info
->uni_dns_dom_name
,
2208 info
->hdr_dns_dom_name
.buffer
, ps
, depth
))
2210 if(!smb_io_unistr2("forest", &info
->uni_forest_name
,
2211 info
->hdr_forest_name
.buffer
, ps
, depth
))
2214 if(!smb_io_dom_sid2("dom_sid", &info
->dom_sid
, ps
, depth
))
2221 /*******************************************************************
2222 Inits an LSA_Q_QUERY_INFO2 structure.
2223 ********************************************************************/
2225 void init_q_query2(LSA_Q_QUERY_INFO2
*q_q
, POLICY_HND
*hnd
, uint16 info_class
)
2227 DEBUG(5, ("init_q_query2\n"));
2229 memcpy(&q_q
->pol
, hnd
, sizeof(q_q
->pol
));
2231 q_q
->info_class
= info_class
;
2234 /*******************************************************************
2235 Reads or writes an LSA_Q_QUERY_DNSDOMINFO structure.
2236 ********************************************************************/
2238 BOOL
lsa_io_q_query_info2(const char *desc
, LSA_Q_QUERY_INFO2
*q_c
,
2239 prs_struct
*ps
, int depth
)
2241 prs_debug(ps
, depth
, desc
, "lsa_io_q_query_info2");
2247 if(!smb_io_pol_hnd("pol", &q_c
->pol
, ps
, depth
))
2250 if(!prs_uint16("info_class", ps
, depth
, &q_c
->info_class
))
2256 /*******************************************************************
2257 Reads or writes an LSA_R_QUERY_DNSDOMINFO structure.
2258 ********************************************************************/
2260 BOOL
lsa_io_r_query_info2(const char *desc
, LSA_R_QUERY_INFO2
*r_c
,
2261 prs_struct
*ps
, int depth
)
2263 prs_debug(ps
, depth
, desc
, "lsa_io_r_query_info2");
2269 if(!prs_uint32("ptr", ps
, depth
, &r_c
->ptr
))
2271 if(!prs_uint16("info_class", ps
, depth
, &r_c
->info_class
))
2273 switch(r_c
->info_class
) {
2275 if (!lsa_io_dns_dom_info("info12", &r_c
->info
.dns_dom_info
,
2280 DEBUG(0,("lsa_io_r_query_info2: unknown info class %d\n",
2287 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
2293 /*******************************************************************
2294 Inits an LSA_Q_ENUM_ACCT_RIGHTS structure.
2295 ********************************************************************/
2296 void init_q_enum_acct_rights(LSA_Q_ENUM_ACCT_RIGHTS
*q_q
,
2301 DEBUG(5, ("init_q_enum_acct_rights\n"));
2304 init_dom_sid2(&q_q
->sid
, sid
);
2307 /*******************************************************************
2308 ********************************************************************/
2309 NTSTATUS
init_r_enum_acct_rights( LSA_R_ENUM_ACCT_RIGHTS
*r_u
, PRIVILEGE_SET
*privileges
)
2313 const char **privname_array
= NULL
;
2316 for ( i
=0; i
<privileges
->count
; i
++ ) {
2317 privname
= luid_to_privilege_name( &privileges
->set
[i
].luid
);
2319 if ( !add_string_to_array( get_talloc_ctx(), privname
, &privname_array
, &num_priv
) )
2320 return NT_STATUS_NO_MEMORY
;
2325 r_u
->rights
= TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY
);
2327 if ( !init_unistr4_array( r_u
->rights
, num_priv
, privname_array
) )
2328 return NT_STATUS_NO_MEMORY
;
2330 r_u
->count
= num_priv
;
2333 return NT_STATUS_OK
;
2336 /*******************************************************************
2337 reads or writes a LSA_Q_ENUM_ACCT_RIGHTS structure.
2338 ********************************************************************/
2339 BOOL
lsa_io_q_enum_acct_rights(const char *desc
, LSA_Q_ENUM_ACCT_RIGHTS
*q_q
, prs_struct
*ps
, int depth
)
2345 prs_debug(ps
, depth
, desc
, "lsa_io_q_enum_acct_rights");
2348 if (!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
2351 if(!smb_io_dom_sid2("sid", &q_q
->sid
, ps
, depth
))
2358 /*******************************************************************
2359 reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
2360 ********************************************************************/
2361 BOOL
lsa_io_r_enum_acct_rights(const char *desc
, LSA_R_ENUM_ACCT_RIGHTS
*r_c
, prs_struct
*ps
, int depth
)
2363 prs_debug(ps
, depth
, desc
, "lsa_io_r_enum_acct_rights");
2366 if(!prs_uint32("count ", ps
, depth
, &r_c
->count
))
2369 if ( !prs_pointer("rights", ps
, depth
, (void**)&r_c
->rights
, sizeof(UNISTR4_ARRAY
), (PRS_POINTER_CAST
)prs_unistr4_array
) )
2375 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
2382 /*******************************************************************
2383 Inits an LSA_Q_ADD_ACCT_RIGHTS structure.
2384 ********************************************************************/
2385 void init_q_add_acct_rights( LSA_Q_ADD_ACCT_RIGHTS
*q_q
, POLICY_HND
*hnd
,
2386 DOM_SID
*sid
, uint32 count
, const char **rights
)
2388 DEBUG(5, ("init_q_add_acct_rights\n"));
2391 init_dom_sid2(&q_q
->sid
, sid
);
2393 q_q
->rights
= TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY
);
2394 init_unistr4_array( q_q
->rights
, count
, rights
);
2400 /*******************************************************************
2401 reads or writes a LSA_Q_ADD_ACCT_RIGHTS structure.
2402 ********************************************************************/
2403 BOOL
lsa_io_q_add_acct_rights(const char *desc
, LSA_Q_ADD_ACCT_RIGHTS
*q_q
, prs_struct
*ps
, int depth
)
2405 prs_debug(ps
, depth
, desc
, "lsa_io_q_add_acct_rights");
2408 if (!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
2411 if(!smb_io_dom_sid2("sid", &q_q
->sid
, ps
, depth
))
2414 if(!prs_uint32("count", ps
, depth
, &q_q
->count
))
2417 if ( !prs_pointer("rights", ps
, depth
, (void**)&q_q
->rights
, sizeof(UNISTR4_ARRAY
), (PRS_POINTER_CAST
)prs_unistr4_array
) )
2423 /*******************************************************************
2424 reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
2425 ********************************************************************/
2426 BOOL
lsa_io_r_add_acct_rights(const char *desc
, LSA_R_ADD_ACCT_RIGHTS
*r_c
, prs_struct
*ps
, int depth
)
2428 prs_debug(ps
, depth
, desc
, "lsa_io_r_add_acct_rights");
2431 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
2438 /*******************************************************************
2439 Inits an LSA_Q_REMOVE_ACCT_RIGHTS structure.
2440 ********************************************************************/
2441 void init_q_remove_acct_rights(LSA_Q_REMOVE_ACCT_RIGHTS
*q_q
,
2446 const char **rights
)
2448 DEBUG(5, ("init_q_remove_acct_rights\n"));
2452 init_dom_sid2(&q_q
->sid
, sid
);
2454 q_q
->removeall
= removeall
;
2457 q_q
->rights
= TALLOC_P( get_talloc_ctx(), UNISTR4_ARRAY
);
2458 init_unistr4_array( q_q
->rights
, count
, rights
);
2462 /*******************************************************************
2463 reads or writes a LSA_Q_REMOVE_ACCT_RIGHTS structure.
2464 ********************************************************************/
2465 BOOL
lsa_io_q_remove_acct_rights(const char *desc
, LSA_Q_REMOVE_ACCT_RIGHTS
*q_q
, prs_struct
*ps
, int depth
)
2467 prs_debug(ps
, depth
, desc
, "lsa_io_q_remove_acct_rights");
2470 if (!smb_io_pol_hnd("", &q_q
->pol
, ps
, depth
))
2473 if(!smb_io_dom_sid2("sid", &q_q
->sid
, ps
, depth
))
2476 if(!prs_uint32("removeall", ps
, depth
, &q_q
->removeall
))
2479 if(!prs_uint32("count", ps
, depth
, &q_q
->count
))
2482 if ( !prs_pointer("rights", ps
, depth
, (void**)&q_q
->rights
, sizeof(UNISTR4_ARRAY
), (PRS_POINTER_CAST
)prs_unistr4_array
) )
2488 /*******************************************************************
2489 reads or writes a LSA_R_ENUM_ACCT_RIGHTS structure.
2490 ********************************************************************/
2491 BOOL
lsa_io_r_remove_acct_rights(const char *desc
, LSA_R_REMOVE_ACCT_RIGHTS
*r_c
, prs_struct
*ps
, int depth
)
2493 prs_debug(ps
, depth
, desc
, "lsa_io_r_remove_acct_rights");
2496 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))