diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-02-01 17:02:52 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-02-02 11:25:08 +0100 |
commit | adbab7710d1fc4ca31469982dae0ee51e6b19896 (patch) | |
tree | 8170a7a93e1b58dd96a00b19699e2d34bbede6b4 | |
parent | 03c3a613c53903ebc1a18aa9e9d18609c657d1d8 (diff) | |
download | samba-adbab7710d1fc4ca31469982dae0ee51e6b19896.tar.gz samba-adbab7710d1fc4ca31469982dae0ee51e6b19896.tar.bz2 samba-adbab7710d1fc4ca31469982dae0ee51e6b19896.zip |
s3:auth: fix potential gap creation in wbcsids_to_samr_RidWithAttributeArray()
Pair-Programmed-With: Michael Adam <obnox@samba.org>
metze
-rw-r--r-- | source3/auth/server_info.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source3/auth/server_info.c b/source3/auth/server_info.c index 6c2723d699..2f764733c2 100644 --- a/source3/auth/server_info.c +++ b/source3/auth/server_info.c @@ -519,7 +519,7 @@ static NTSTATUS wbcsids_to_samr_RidWithAttributeArray( const struct wbcSidWithAttr *sids, size_t num_sids) { - unsigned int i; + unsigned int i, j = 0; bool ok; groups->rids = talloc_array(mem_ctx, @@ -532,15 +532,16 @@ static NTSTATUS wbcsids_to_samr_RidWithAttributeArray( for (i = 0; i < num_sids; i++) { ok = sid_peek_check_rid(domain_sid, (const struct dom_sid *)&sids[i].sid, - &groups->rids[i].rid); + &groups->rids[j].rid); if (!ok) continue; - groups->rids[i].attributes = SE_GROUP_MANDATORY | + groups->rids[j].attributes = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED; - groups->count++; + j++; } + groups->count = j; return NT_STATUS_OK; } |