Don't let winbind getgroups crash when we have no gids in the token.
authorGünther Deschner <gd@samba.org>
Fri, 28 Mar 2008 23:47:42 +0000 (00:47 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 28 Mar 2008 23:47:42 +0000 (00:47 +0100)
Guenther
(This used to be commit 6a576cfe9b87e69af6acbe9abc04124b8b743fd3)

source3/winbindd/winbindd_group.c

index 6a704cf2902d349a15ad9aa552eecd3cb4bfedba..5dbd8c55a5d59663c9a79bab68ea3a60b87b4561 100644 (file)
@@ -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);
 }