summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-06-15 00:14:27 +0200
committerVolker Lendecke <vl@samba.org>2008-06-15 00:17:27 +0200
commitcd7d7e1e8265324540276010f88b862f0afa68c0 (patch)
tree8548aab982fddbfa67337e9c4a23d38662c348f9
parent101162257c14338eb2df7f331b18bca41813bff7 (diff)
downloadsamba-cd7d7e1e8265324540276010f88b862f0afa68c0.tar.gz
samba-cd7d7e1e8265324540276010f88b862f0afa68c0.tar.bz2
samba-cd7d7e1e8265324540276010f88b862f0afa68c0.zip
Fix group parsing in libwbclient's copy_group_entry()
This (also) fixes a flaw pointed out by the IBM checker. When verifying that I found out that the parsing was not working as I would have expected it to. Jerry, please check! (cherry picked from commit c2c7790155ab02e1e351caf2bed192ce72913663) (This used to be commit 26c05a52b73763dad5ad0525dab6e20014c3f8d6)
-rw-r--r--source3/nsswitch/libwbclient/wbc_pwd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/nsswitch/libwbclient/wbc_pwd.c b/source3/nsswitch/libwbclient/wbc_pwd.c
index baee3c3781..d23c378b5f 100644
--- a/source3/nsswitch/libwbclient/wbc_pwd.c
+++ b/source3/nsswitch/libwbclient/wbc_pwd.c
@@ -97,11 +97,13 @@ static struct group *copy_group_entry(struct winbindd_gr *g,
grp->gr_mem[i] = talloc_strdup(grp, mem_p);
BAIL_ON_PTR_ERROR(grp->gr_mem[i], wbc_status);
- *mem_q = ',';
- mem_p++;
- mem_p = mem_q;
+ if (mem_q == NULL) {
+ i += 1;
+ break;
+ }
+ mem_p = mem_q + 1;
}
- grp->gr_mem[g->num_gr_mem] = NULL;
+ grp->gr_mem[i] = NULL;
wbc_status = WBC_ERR_SUCCESS;