summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_samr.c22
-rw-r--r--source3/rpc_server/srv_samr_nt.c98
2 files changed, 35 insertions, 85 deletions
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index 2321d56b77..771c1e3341 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -365,27 +365,7 @@ static bool api_samr_lookup_domain(pipes_struct *p)
static bool api_samr_enum_domains(pipes_struct *p)
{
- SAMR_Q_ENUM_DOMAINS q_u;
- SAMR_R_ENUM_DOMAINS r_u;
- prs_struct *data = &p->in_data.data;
- prs_struct *rdata = &p->out_data.rdata;
-
- ZERO_STRUCT(q_u);
- ZERO_STRUCT(r_u);
-
- if(!samr_io_q_enum_domains("", &q_u, data, 0)) {
- DEBUG(0,("api_samr_enum_domains: Unable to unmarshall SAMR_Q_ENUM_DOMAINS.\n"));
- return False;
- }
-
- r_u.status = _samr_enum_domains(p, &q_u, &r_u);
-
- if(!samr_io_r_enum_domains("", &r_u, rdata, 0)) {
- DEBUG(0,("api_samr_enum_domains: Unable to marshall SAMR_R_ENUM_DOMAINS.\n"));
- return False;
- }
-
- return True;
+ return proxy_samr_call(p, NDR_SAMR_ENUMDOMAINS);
}
/*******************************************************************
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 4c242dc323..6619e0651e 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -2993,74 +2993,54 @@ NTSTATUS _samr_LookupDomain(pipes_struct *p,
return status;
}
-/******************************************************************
-makes a SAMR_R_ENUM_DOMAINS structure.
-********************************************************************/
-
-static bool make_enum_domains(TALLOC_CTX *ctx, SAM_ENTRY **pp_sam,
- UNISTR2 **pp_uni_name, uint32 num_sam_entries, fstring doms[])
-{
- uint32 i;
- SAM_ENTRY *sam;
- UNISTR2 *uni_name;
-
- DEBUG(5, ("make_enum_domains\n"));
-
- *pp_sam = NULL;
- *pp_uni_name = NULL;
-
- if (num_sam_entries == 0)
- return True;
-
- sam = TALLOC_ZERO_ARRAY(ctx, SAM_ENTRY, num_sam_entries);
- uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_sam_entries);
-
- if (sam == NULL || uni_name == NULL)
- return False;
-
- for (i = 0; i < num_sam_entries; i++) {
- init_unistr2(&uni_name[i], doms[i], UNI_FLAGS_NONE);
- init_sam_entry(&sam[i], &uni_name[i], 0);
- }
-
- *pp_sam = sam;
- *pp_uni_name = uni_name;
-
- return True;
-}
-
/**********************************************************************
- api_samr_enum_domains
+ _samr_EnumDomains
**********************************************************************/
-NTSTATUS _samr_enum_domains(pipes_struct *p, SAMR_Q_ENUM_DOMAINS *q_u, SAMR_R_ENUM_DOMAINS *r_u)
+NTSTATUS _samr_EnumDomains(pipes_struct *p,
+ struct samr_EnumDomains *r)
{
+ NTSTATUS status;
struct samr_info *info;
- uint32 num_entries = 2;
- fstring dom[2];
- const char *name;
-
- r_u->status = NT_STATUS_OK;
+ uint32_t num_entries = 2;
+ struct samr_SamEntry *entry_array = NULL;
+ struct samr_SamArray *sam;
- if (!find_policy_by_hnd(p, &q_u->pol, (void**)(void *)&info))
+ if (!find_policy_by_hnd(p, r->in.connect_handle, (void**)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
- if (!NT_STATUS_IS_OK(r_u->status = access_check_samr_function(info->acc_granted, SA_RIGHT_SAM_ENUM_DOMAINS, "_samr_enum_domains"))) {
- return r_u->status;
+ status = access_check_samr_function(info->acc_granted,
+ SA_RIGHT_SAM_ENUM_DOMAINS,
+ "_samr_EnumDomains");
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
- name = get_global_sam_name();
-
- fstrcpy(dom[0],name);
- strupper_m(dom[0]);
- fstrcpy(dom[1],"Builtin");
+ sam = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray);
+ if (!sam) {
+ return NT_STATUS_NO_MEMORY;
+ }
- if (!make_enum_domains(p->mem_ctx, &r_u->sam, &r_u->uni_dom_name, num_entries, dom))
+ entry_array = TALLOC_ZERO_ARRAY(p->mem_ctx,
+ struct samr_SamEntry,
+ num_entries);
+ if (!entry_array) {
return NT_STATUS_NO_MEMORY;
+ }
- init_samr_r_enum_domains(r_u, q_u->start_idx + num_entries, num_entries);
+ entry_array[0].idx = 0;
+ init_lsa_String(&entry_array[0].name, get_global_sam_name());
- return r_u->status;
+ entry_array[1].idx = 1;
+ init_lsa_String(&entry_array[1].name, "Builtin");
+
+ sam->count = num_entries;
+ sam->entries = entry_array;
+
+ *r->out.sam = sam;
+ *r->out.num_entries = num_entries;
+
+ return status;
}
/*******************************************************************
@@ -5218,16 +5198,6 @@ NTSTATUS _samr_Shutdown(pipes_struct *p,
/****************************************************************
****************************************************************/
-NTSTATUS _samr_EnumDomains(pipes_struct *p,
- struct samr_EnumDomains *r)
-{
- p->rng_fault_state = true;
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
-/****************************************************************
-****************************************************************/
-
NTSTATUS _samr_EnumDomainGroups(pipes_struct *p,
struct samr_EnumDomainGroups *r)
{