summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-03-29 00:47:42 +0100
committerGünther Deschner <gd@samba.org>2008-03-29 00:47:42 +0100
commit4ce88f719e38ade76f7bcfd2e5b9932d864e4b20 (patch)
tree55ad04ef33d65dae187338900dcd3da9cc3c597a
parent25da02554bb46064008ce2711bf643b192f174c9 (diff)
downloadsamba-4ce88f719e38ade76f7bcfd2e5b9932d864e4b20.tar.gz
samba-4ce88f719e38ade76f7bcfd2e5b9932d864e4b20.tar.bz2
samba-4ce88f719e38ade76f7bcfd2e5b9932d864e4b20.zip
Don't let winbind getgroups crash when we have no gids in the token.
Guenther (This used to be commit 6a576cfe9b87e69af6acbe9abc04124b8b743fd3)
-rw-r--r--source3/winbindd/winbindd_group.c8
1 files changed, 5 insertions, 3 deletions
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);
}