summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-11 23:44:46 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-06-12 16:45:47 +0200
commit0171f714b4caf6ef67ea36729106b89e91706002 (patch)
treefd20e09d085413165ebf39f3fd7afc98394e9a66 /source4
parentf2c3d39e7223f6bd162f3a38efa1b568aee621de (diff)
downloadsamba-0171f714b4caf6ef67ea36729106b89e91706002.tar.gz
samba-0171f714b4caf6ef67ea36729106b89e91706002.tar.bz2
samba-0171f714b4caf6ef67ea36729106b89e91706002.zip
s4:dcesrv_samr_EnumDomainGroups - mostly small fixes
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 2b7a8d17d6..12249eb066 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -1074,7 +1074,7 @@ static NTSTATUS dcesrv_samr_EnumDomainGroups(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;
@@ -1093,7 +1093,7 @@ static NTSTATUS dcesrv_samr_EnumDomainGroups(struct dcesrv_call_state *dce_call,
"(&(|(groupType=%d)(groupType=%d))(objectClass=group))",
GTYPE_SECURITY_UNIVERSAL_GROUP,
GTYPE_SECURITY_GLOBAL_GROUP);
- if (ldb_cnt == -1) {
+ if (ldb_cnt < 0) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -1128,7 +1128,7 @@ static NTSTATUS dcesrv_samr_EnumDomainGroups(struct dcesrv_call_state *dce_call,
first<count && entries[first].idx <= *r->in.resume_handle;
first++) ;
- /* return the rest, limit by max_size. Note that we
+ /* 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,
@@ -1144,6 +1144,10 @@ static NTSTATUS dcesrv_samr_EnumDomainGroups(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;
return STATUS_MORE_ENTRIES;