summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse/parse_lsa.c')
-rw-r--r--source3/rpc_parse/parse_lsa.c136
1 files changed, 68 insertions, 68 deletions
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index 649cb7845a..ab3d3fcfe8 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -6,6 +6,7 @@
* Copyright (C) Paul Ashton 1997,
* Copyright (C) Andrew Bartlett 2002,
* Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002.
+ * Copyright (C) Gerald )Jerry) Carter 2005
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -516,100 +517,99 @@ void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 en
DEBUG(5, ("init_r_enum_trust_dom\n"));
- r_e->enum_context = enum_context;
- r_e->num_domains = num_domains;
- r_e->ptr_enum_domains = 0;
- r_e->num_domains2 = num_domains;
-
- if (num_domains != 0) {
+ r_e->enum_context = enum_context;
+ r_e->count = num_domains;
+
+ if ( num_domains != 0 ) {
- /*
- * allocating empty arrays of unicode headers, strings
- * and sids of enumerated trusted domains
- */
- if (!(r_e->hdr_domain_name = TALLOC_ARRAY(ctx,UNIHDR2,num_domains))) {
- r_e->status = NT_STATUS_NO_MEMORY;
- return;
- }
+ /* allocate container memory */
- if (!(r_e->uni_domain_name = TALLOC_ARRAY(ctx,UNISTR2,num_domains))) {
- r_e->status = NT_STATUS_NO_MEMORY;
- return;
- }
-
- if (!(r_e->domain_sid = TALLOC_ARRAY(ctx,DOM_SID2,num_domains))) {
+ r_e->domlist = TALLOC_P( ctx, DOMAIN_LIST );
+ r_e->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, r_e->count );
+
+ if ( !r_e->domlist || !r_e->domlist->domains ) {
r_e->status = NT_STATUS_NO_MEMORY;
return;
}
+
+ r_e->domlist->count = r_e->count;
+
+ /* initialize the list of domains and their sid */
+
+ for (i = 0; i < num_domains; i++) {
+ if ( !(r_e->domlist->domains[i].sid = TALLOC_P(ctx, DOM_SID2)) ) {
+ r_e->status = NT_STATUS_NO_MEMORY;
+ return;
+ }
- for (i = 0; i < num_domains; i++) {
-
- /* don't know what actually is this for */
- r_e->ptr_enum_domains = 1;
-
- init_dom_sid2(&r_e->domain_sid[i], &(td[i])->sid);
-
- init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name);
- init_uni_hdr2(&r_e->hdr_domain_name[i], &r_e->uni_domain_name[i]);
-
- };
+ init_dom_sid2(r_e->domlist->domains[i].sid, &(td[i])->sid);
+ init_unistr4_w(ctx, &r_e->domlist->domains[i].name, (td[i])->name);
+ }
}
}
/*******************************************************************
- Reads or writes an LSA_R_ENUM_TRUST_DOM structure.
********************************************************************/
-BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *r_e,
- prs_struct *ps, int depth)
+BOOL lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIST *domlist )
{
- prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
+ int i;
+
+ prs_debug(ps, depth, desc, "lsa_io_domain_list");
depth++;
- if(!prs_uint32("enum_context ", ps, depth, &r_e->enum_context))
- return False;
- if(!prs_uint32("num_domains ", ps, depth, &r_e->num_domains))
- return False;
- if(!prs_uint32("ptr_enum_domains", ps, depth, &r_e->ptr_enum_domains))
+ if(!prs_uint32("count", ps, depth, &domlist->count))
return False;
- if (r_e->ptr_enum_domains) {
- int i, num_domains;
+ if ( domlist->count == 0 )
+ return True;
+
+ if ( UNMARSHALLING(ps) ) {
+ if ( !(domlist->domains = PRS_ALLOC_MEM( ps, DOMAIN_INFO, domlist->count )) )
+ return False;
+ }
+
+ /* headers */
+
+ for ( i=0; i<domlist->count; i++ ) {
+ if ( !prs_unistr4_hdr("name_header", ps, depth, &domlist->domains[i].name) )
+ return False;
+ if ( !smb_io_dom_sid2_p("sid_header", ps, depth, &domlist->domains[i].sid) )
+ return False;
+ }
- if(!prs_uint32("num_domains2", ps, depth, &r_e->num_domains2))
+ /* data */
+
+ for ( i=0; i<domlist->count; i++ ) {
+ if ( !prs_unistr4_str("name", ps, depth, &domlist->domains[i].name) )
return False;
+ if( !smb_io_dom_sid2("sid", domlist->domains[i].sid, ps, depth) )
+ return False;
+ }
+
+ return True;
+}
- num_domains = r_e->num_domains2;
+/*******************************************************************
+ Reads or writes an LSA_R_ENUM_TRUST_DOM structure.
+********************************************************************/
- if (UNMARSHALLING(ps)) {
- if (!(r_e->hdr_domain_name = PRS_ALLOC_MEM(ps,UNIHDR2,num_domains)))
- return False;
+BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *r_e,
+ prs_struct *ps, int depth)
+{
+ prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom");
+ depth++;
- if (!(r_e->uni_domain_name = PRS_ALLOC_MEM(ps,UNISTR2,num_domains)))
- return False;
+ if(!prs_uint32("enum_context", ps, depth, &r_e->enum_context))
+ return False;
- if (!(r_e->domain_sid = PRS_ALLOC_MEM(ps,DOM_SID2,num_domains)))
- return False;
- }
+ if(!prs_uint32("count", ps, depth, &r_e->count))
+ return False;
- for (i = 0; i < num_domains; i++) {
- if(!smb_io_unihdr2 ("", &r_e->hdr_domain_name[i], ps,
- depth))
- return False;
- }
+ if ( !prs_pointer("trusted_domains", ps, depth, (void**)&r_e->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list))
+ return False;
- for (i = 0; i < num_domains; i++) {
- if(!smb_io_unistr2 ("", &r_e->uni_domain_name[i],
- r_e->hdr_domain_name[i].buffer,
- ps, depth))
- return False;
- if(!smb_io_dom_sid2("", &r_e->domain_sid[i], ps,
- depth))
- return False;
- }
- }
-
if(!prs_ntstatus("status", ps, depth, &r_e->status))
return False;