diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/rpc_lsa.h | 23 | ||||
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 85 | ||||
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 165 |
3 files changed, 0 insertions, 273 deletions
diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 7a8520111d..724a980b45 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -137,29 +137,6 @@ /*******************************************************/ -typedef struct { - POLICY_HND pol; - uint32 enum_context; - uint32 preferred_len; /* preferred maximum length */ -} LSA_Q_ENUM_TRUST_DOM; - -typedef struct { - UNISTR4 name; - DOM_SID2 *sid; -} DOMAIN_INFO; - -typedef struct { - uint32 count; - DOMAIN_INFO *domains; -} DOMAIN_LIST; - -typedef struct { - uint32 enum_context; - uint32 count; - DOMAIN_LIST *domlist; - NTSTATUS status; -} LSA_R_ENUM_TRUST_DOM; - /*******************************************************/ #define MAX_REF_DOMAINS 32 diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index d547c3e7be..c42938d6e9 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -452,91 +452,6 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, return result; } -/** - * Enumerate list of trusted domains - * - * @param cli client state (cli_state) structure of the connection - * @param mem_ctx memory context - * @param pol opened lsa policy handle - * @param enum_ctx enumeration context ie. index of first returned domain entry - * @param pref_num_domains preferred max number of entries returned in one response - * @param num_domains total number of trusted domains returned by response - * @param domain_names returned trusted domain names - * @param domain_sids returned trusted domain sids - * - * @return nt status code of response - **/ - -NTSTATUS rpccli_lsa_enum_trust_dom(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint32 *enum_ctx, - uint32 *num_domains, - char ***domain_names, DOM_SID **domain_sids) -{ - prs_struct qbuf, rbuf; - LSA_Q_ENUM_TRUST_DOM in; - LSA_R_ENUM_TRUST_DOM out; - int i; - fstring tmp; - - ZERO_STRUCT(in); - ZERO_STRUCT(out); - - /* 64k is enough for about 2000 trusted domains */ - - init_q_enum_trust_dom(&in, pol, *enum_ctx, 0x10000); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_ENUMTRUSTDOM, - in, out, - qbuf, rbuf, - lsa_io_q_enum_trust_dom, - lsa_io_r_enum_trust_dom, - NT_STATUS_UNSUCCESSFUL ); - - - /* check for an actual error */ - - if ( !NT_STATUS_IS_OK(out.status) - && !NT_STATUS_EQUAL(out.status, NT_STATUS_NO_MORE_ENTRIES) - && !NT_STATUS_EQUAL(out.status, STATUS_MORE_ENTRIES) ) - { - return out.status; - } - - /* Return output parameters */ - - *num_domains = out.count; - *enum_ctx = out.enum_context; - - if ( out.count ) { - - /* Allocate memory for trusted domain names and sids */ - - if ( !(*domain_names = TALLOC_ARRAY(mem_ctx, char *, out.count)) ) { - DEBUG(0, ("cli_lsa_enum_trust_dom(): out of memory\n")); - return NT_STATUS_NO_MEMORY; - } - - if ( !(*domain_sids = TALLOC_ARRAY(mem_ctx, DOM_SID, out.count)) ) { - DEBUG(0, ("cli_lsa_enum_trust_dom(): out of memory\n")); - return NT_STATUS_NO_MEMORY; - } - - /* Copy across names and sids */ - - for (i = 0; i < out.count; i++) { - - rpcstr_pull( tmp, out.domlist->domains[i].name.string->buffer, - sizeof(tmp), out.domlist->domains[i].name.length, 0); - (*domain_names)[i] = talloc_strdup(mem_ctx, tmp); - - sid_copy(&(*domain_sids)[i], &out.domlist->domains[i].sid->sid ); - } - } - - return out.status; -} - /** Enumerate list of SIDs */ NTSTATUS rpccli_lsa_enum_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 12dd6e126b..c4a7c057a6 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -216,171 +216,6 @@ void init_lsa_obj_attr(struct lsa_ObjectAttribute *r, } /******************************************************************* -makes an LSA_Q_ENUM_TRUST_DOM structure. -********************************************************************/ -bool init_q_enum_trust_dom(LSA_Q_ENUM_TRUST_DOM * q_e, POLICY_HND *pol, - uint32 enum_context, uint32 preferred_len) -{ - DEBUG(5, ("init_q_enum_trust_dom\n")); - - q_e->pol = *pol; - q_e->enum_context = enum_context; - q_e->preferred_len = preferred_len; - - return True; -} - -/******************************************************************* - Reads or writes an LSA_Q_ENUM_TRUST_DOM structure. -********************************************************************/ - -bool lsa_io_q_enum_trust_dom(const char *desc, LSA_Q_ENUM_TRUST_DOM *q_e, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_enum_trust_dom"); - depth++; - - if(!smb_io_pol_hnd("", &q_e->pol, ps, depth)) - return False; - - if(!prs_uint32("enum_context ", ps, depth, &q_e->enum_context)) - return False; - if(!prs_uint32("preferred_len", ps, depth, &q_e->preferred_len)) - return False; - - return True; -} - -/******************************************************************* - Inits an LSA_R_ENUM_TRUST_DOM structure. -********************************************************************/ - -void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *out, - uint32 enum_context, uint32 num_domains, - struct trustdom_info **td) -{ - unsigned int i; - - DEBUG(5, ("init_r_enum_trust_dom\n")); - - out->enum_context = enum_context; - out->count = num_domains; - - if ( num_domains != 0 ) { - - /* allocate container memory */ - - out->domlist = TALLOC_P( ctx, DOMAIN_LIST ); - - if ( !out->domlist ) { - out->status = NT_STATUS_NO_MEMORY; - return; - } - - if (out->count) { - out->domlist->domains = TALLOC_ARRAY( ctx, DOMAIN_INFO, - out->count ); - if ( !out->domlist->domains ) { - out->status = NT_STATUS_NO_MEMORY; - return; - } - } else { - out->domlist->domains = NULL; - } - - out->domlist->count = out->count; - - /* initialize the list of domains and their sid */ - - for (i = 0; i < num_domains; i++) { - smb_ucs2_t *name; - if ( !(out->domlist->domains[i].sid = - TALLOC_P(ctx, DOM_SID2)) ) { - out->status = NT_STATUS_NO_MEMORY; - return; - } - - init_dom_sid2(out->domlist->domains[i].sid, - &(td[i])->sid); - if (push_ucs2_talloc(ctx, &name, (td[i])->name) == (size_t)-1){ - out->status = NT_STATUS_NO_MEMORY; - return; - } - init_unistr4_w(ctx, &out->domlist->domains[i].name, - name); - } - } - -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_domain_list( const char *desc, prs_struct *ps, int depth, DOMAIN_LIST *domlist ) -{ - int i; - - prs_debug(ps, depth, desc, "lsa_io_domain_list"); - depth++; - - if(!prs_uint32("count", ps, depth, &domlist->count)) - return False; - - 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; - } - - /* 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; -} - -/******************************************************************* - 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 *out, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_enum_trust_dom"); - depth++; - - if(!prs_uint32("enum_context", ps, depth, &out->enum_context)) - return False; - - if(!prs_uint32("count", ps, depth, &out->count)) - return False; - - if ( !prs_pointer("trusted_domains", ps, depth, (void*)&out->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - -/******************************************************************* Inits a LSA_SID_ENUM structure. ********************************************************************/ |