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)
committerVolker Lendecke <vl@samba.org>
Mon, 2 Jun 2008 12:49:03 +0000 (14:49 +0200)
Guenther

source/nsswitch/winbindd_group.c

index c7baecfbaa6532abd144100b26fa3922b35faced..cc8bfb0c404a57a4d1033cb8af2c4b116cda3bfe 100644 (file)
@@ -1398,8 +1398,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 != 0) {
+               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);
 }