--- smbd/sec_ctx.c.orig Thu Mar 1 05:54:08 2007 +++ smbd/sec_ctx.c Thu May 31 02:06:39 2007 @@ -192,7 +192,7 @@ if (sec_ctx_stack_ndx == MAX_SEC_CTX_DEPTH) { DEBUG(0, ("Security context stack overflow!\n")); - smb_panic("Security context stack overflow!\n"); + smb_panic("Security context stack overflow!"); } /* Store previous user context */ @@ -246,7 +246,14 @@ gain_root(); #ifdef HAVE_SETGROUPS - sys_setgroups(ngroups, groups); + gid_t *new_groups; + if (!(new_groups = SMB_MALLOC_ARRAY(gid_t, ngroups+1))) { + smb_panic("malloc for groups failed"); + } + new_groups[0] = gid; + memcpy(&new_groups[1], groups, sizeof(gid_t) * ngroups); + sys_setgroups(ngroups+1, new_groups); + SAFE_FREE(new_groups); #endif ctx_p->ut.ngroups = ngroups; @@ -262,7 +269,7 @@ ctx_p->ut.groups = (gid_t *)memdup(groups, sizeof(gid_t) * ngroups); if (!ctx_p->ut.groups) { - smb_panic("memdup failed"); + smb_panic("memdup for groups failed"); } } else { ctx_p->ut.groups = NULL; @@ -315,7 +322,7 @@ if (sec_ctx_stack_ndx == 0) { DEBUG(0, ("Security context stack underflow!\n")); - smb_panic("Security context stack underflow!\n"); + smb_panic("Security context stack underflow!"); } ctx_p = &sec_ctx_stack[sec_ctx_stack_ndx];