1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s4-samr: merge samr_EnumDomainAliases from s3 idl. (fixme: python)

Guenther
This commit is contained in:
Günther Deschner 2008-11-05 13:37:49 +01:00
parent aaca059a35
commit 2efec54b8d
3 changed files with 25 additions and 18 deletions

View File

@ -489,11 +489,11 @@ import "misc.idl", "lsa.idl", "security.idl";
/************************/
/* Function 0x0f */
NTSTATUS samr_EnumDomainAliases(
[in,ref] policy_handle *domain_handle,
[in] policy_handle *domain_handle,
[in,out,ref] uint32 *resume_handle,
[in] samr_AcctFlags acct_flags,
[out,unique] samr_SamArray *sam,
[out] uint32 num_entries
[out,ref] samr_SamArray **sam,
[in] uint32 max_size,
[out,ref] uint32 *num_entries
);
/************************/

View File

@ -1700,10 +1700,11 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call
int ldb_cnt, count, i, first;
struct samr_SamEntry *entries;
const char * const attrs[3] = { "objectSid", "sAMAccountName", NULL };
struct samr_SamArray *sam;
*r->out.resume_handle = 0;
r->out.sam = NULL;
r->out.num_entries = 0;
*r->out.sam = NULL;
*r->out.num_entries = 0;
DCESRV_PULL_HANDLE(h, r->in.domain_handle, SAMR_HANDLE_DOMAIN);
@ -1763,20 +1764,22 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call
return NT_STATUS_OK;
}
r->out.num_entries = count - first;
r->out.num_entries = MIN(r->out.num_entries, 1000);
*r->out.num_entries = count - first;
*r->out.num_entries = MIN(*r->out.num_entries, 1000);
r->out.sam = talloc(mem_ctx, struct samr_SamArray);
if (!r->out.sam) {
sam = talloc(mem_ctx, struct samr_SamArray);
if (!sam) {
return NT_STATUS_NO_MEMORY;
}
r->out.sam->entries = entries+first;
r->out.sam->count = r->out.num_entries;
sam->entries = entries+first;
sam->count = *r->out.num_entries;
if (r->out.num_entries < count - first) {
*r->out.sam = sam;
if (*r->out.num_entries < count - first) {
*r->out.resume_handle =
entries[first+r->out.num_entries-1].idx;
entries[first+*r->out.num_entries-1].idx;
return STATUS_MORE_ENTRIES;
}

View File

@ -3457,6 +3457,8 @@ static bool test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
NTSTATUS status;
struct samr_EnumDomainAliases r;
uint32_t resume_handle=0;
struct samr_SamArray *sam = NULL;
uint32_t num_entries = 0;
int i;
bool ret = true;
@ -3464,7 +3466,9 @@ static bool test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.domain_handle = handle;
r.in.resume_handle = &resume_handle;
r.in.acct_flags = (uint32_t)-1;
r.in.max_size = (uint32_t)-1;
r.out.sam = &sam;
r.out.num_entries = &num_entries;
r.out.resume_handle = &resume_handle;
status = dcerpc_samr_EnumDomainAliases(p, mem_ctx, &r);
@ -3473,12 +3477,12 @@ static bool test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return false;
}
if (!r.out.sam) {
if (!sam) {
return false;
}
for (i=0;i<r.out.sam->count;i++) {
if (!test_OpenAlias(p, mem_ctx, handle, r.out.sam->entries[i].idx)) {
for (i=0;i<sam->count;i++) {
if (!test_OpenAlias(p, mem_ctx, handle, sam->entries[i].idx)) {
ret = false;
}
}