From a18c6ba9a411b8b87cc67e02f5287786d1aaad20 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 9 Mar 1999 23:22:36 +0000 Subject: Greg Dickie spotted some wierd memory corruption problem with group database enumeration. (This used to be commit b0381bb262f51fca916fb951fc0c7e54a58e2dd3) --- source3/groupdb/builtinunix.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/groupdb/builtinunix.c') diff --git a/source3/groupdb/builtinunix.c b/source3/groupdb/builtinunix.c index 9f00582592..57421cc449 100644 --- a/source3/groupdb/builtinunix.c +++ b/source3/groupdb/builtinunix.c @@ -170,7 +170,7 @@ static LOCAL_GRP *getbltunixpwent(void *vp, LOCAL_GRP_MEMBER **mem, int *num_mem { /* Static buffers we will return. */ static LOCAL_GRP gp_buf; - struct group *unix_grp = NULL; + struct group unix_grp; struct unix_entries *grps = (struct unix_entries *)vp; if (grps == NULL) @@ -200,12 +200,12 @@ static LOCAL_GRP *getbltunixpwent(void *vp, LOCAL_GRP_MEMBER **mem, int *num_mem DOM_NAME_MAP gmep; fstring sid_str; - unix_grp = &grps->grps[grps->grp_idx]; + memcpy(&unix_grp, &grps->grps[grps->grp_idx], sizeof(unix_grp)); DEBUG(10,("getgrpunixpwent: enum unix group entry %s\n", - unix_grp->gr_name)); + unix_grp.gr_name)); - if (!lookupsmbgrpgid(unix_grp->gr_gid, &gmep)) + if (!lookupsmbgrpgid(unix_grp.gr_gid, &gmep)) { continue; } @@ -229,7 +229,7 @@ static LOCAL_GRP *getbltunixpwent(void *vp, LOCAL_GRP_MEMBER **mem, int *num_mem break; } - if (unix_grp == NULL || grps->grp_idx >= grps->num_grps) + if (grps->grp_idx >= grps->num_grps) { return NULL; } @@ -241,8 +241,8 @@ static LOCAL_GRP *getbltunixpwent(void *vp, LOCAL_GRP_MEMBER **mem, int *num_mem (*mem) = NULL; (*num_mem) = 0; - unix_grp = getgrgid(unix_grp->gr_gid); - get_unixbuiltin_members(unix_grp, num_mem, mem); + memcpy(&unix_grp, getgrgid(unix_grp.gr_gid), sizeof(unix_grp)); + get_unixbuiltin_members(&unix_grp, num_mem, mem); } { -- cgit