From 5dd2bd50768ef57072e27b42faf7790875c7bae8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 23 Jun 2000 17:31:38 +0000 Subject: lib/util_unistr.c: Off-by-one fix for dos_PutUniStr from John Reilly jreilly@hp.com. Memory leak fix for new sec_ctx code (sorry Tim :-). Jeremy. (This used to be commit edaf49c66d5a5ccf6689b358c301e208599a468f) --- source3/smbd/sec_ctx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source3/smbd') diff --git a/source3/smbd/sec_ctx.c b/source3/smbd/sec_ctx.c index e3aac77d8e..bbd801d76b 100644 --- a/source3/smbd/sec_ctx.c +++ b/source3/smbd/sec_ctx.c @@ -184,11 +184,15 @@ void set_sec_ctx(uid_t uid, gid_t gid, int ngroups, gid_t *groups) #ifdef HAVE_SETGROUPS sys_setgroups(ngroups, groups); +#endif sec_ctx_stack[sec_ctx_stack_ndx].ngroups = ngroups; + + if (sec_ctx_stack[sec_ctx_stack_ndx].groups != NULL) + free(sec_ctx_stack[sec_ctx_stack_ndx].groups); + sec_ctx_stack[sec_ctx_stack_ndx].groups = memdup(groups, sizeof(gid_t) * ngroups); -#endif become_id(uid, gid); -- cgit