From 4ce88f719e38ade76f7bcfd2e5b9932d864e4b20 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 29 Mar 2008 00:47:42 +0100 Subject: Don't let winbind getgroups crash when we have no gids in the token. Guenther (This used to be commit 6a576cfe9b87e69af6acbe9abc04124b8b743fd3) --- source3/winbindd/winbindd_group.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source3/winbindd/winbindd_group.c') diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c index 6a704cf290..5dbd8c55a5 100644 --- a/source3/winbindd/winbindd_group.c +++ b/source3/winbindd/winbindd_group.c @@ -1595,9 +1595,11 @@ static void getgroups_sid2gid_recv(void *private_data, bool success, gid_t gid) } s->state->response.data.num_entries = s->num_token_gids; - /* s->token_gids are talloced */ - s->state->response.extra_data.data = smb_xmemdup(s->token_gids, s->num_token_gids * sizeof(gid_t)); - s->state->response.length += s->num_token_gids * sizeof(gid_t); + if (s->num_token_gids) { + /* s->token_gids are talloced */ + s->state->response.extra_data.data = smb_xmemdup(s->token_gids, s->num_token_gids * sizeof(gid_t)); + s->state->response.length += s->num_token_gids * sizeof(gid_t); + } request_ok(s->state); } -- cgit