diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-06-11 23:42:14 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-06-12 16:45:46 +0200 |
commit | 5a1cb7029cdeaaf2bf1c2093ddc00f51a15d95e5 (patch) | |
tree | 95c0f7db7fb90bf9e7dfceb707a659352516e08f /source4/rpc_server | |
parent | 84bda98066e23b7963a6280155eafa88312724a9 (diff) | |
download | samba-5a1cb7029cdeaaf2bf1c2093ddc00f51a15d95e5.tar.gz samba-5a1cb7029cdeaaf2bf1c2093ddc00f51a15d95e5.tar.bz2 samba-5a1cb7029cdeaaf2bf1c2093ddc00f51a15d95e5.zip |
s4:dcesrv_samr_EnumDomainAliases - mostly small fixes
The biggest change consists in the implementation of the Windows Server
return size formula MIN(*r->out.num_entries, 1+(r->in.max_size/SAMR_ENUM_USERS_MULTIPLIER).
Diffstat (limited to 'source4/rpc_server')
-rw-r--r-- | source4/rpc_server/samr/dcesrv_samr.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index 9cb5113480..741a018958 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -1422,7 +1422,7 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call int i, ldb_cnt; uint32_t first, count; struct samr_SamEntry *entries; - const char * const attrs[3] = { "objectSid", "sAMAccountName", NULL }; + const char * const attrs[] = { "objectSid", "sAMAccountName", NULL }; struct samr_SamArray *sam; *r->out.resume_handle = 0; @@ -1443,7 +1443,7 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call "(objectclass=group))", GTYPE_SECURITY_BUILTIN_LOCAL_GROUP, GTYPE_SECURITY_DOMAIN_LOCAL_GROUP); - if (ldb_cnt == -1) { + if (ldb_cnt < 0) { return NT_STATUS_INTERNAL_DB_CORRUPTION; } if (ldb_cnt == 0) { @@ -1482,12 +1482,11 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call first<count && entries[first].idx <= *r->in.resume_handle; first++) ; - if (first == count) { - return NT_STATUS_OK; - } - + /* return the rest, limit by max_size. Note that we + use the w2k3 element size value of 54 */ *r->out.num_entries = count - first; - *r->out.num_entries = MIN(*r->out.num_entries, 1000); + *r->out.num_entries = MIN(*r->out.num_entries, + 1+(r->in.max_size/SAMR_ENUM_USERS_MULTIPLIER)); sam = talloc(mem_ctx, struct samr_SamArray); if (!sam) { @@ -1499,6 +1498,10 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call *r->out.sam = sam; + if (first == count) { + return NT_STATUS_OK; + } + if (*r->out.num_entries < count - first) { *r->out.resume_handle = entries[first+*r->out.num_entries-1].idx; |