summaryrefslogtreecommitdiff
path: root/source/groupdb
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-03-09 23:22:36 +0000
committerLuke Leighton <lkcl@samba.org>1999-03-09 23:22:36 +0000
commitb0381bb262f51fca916fb951fc0c7e54a58e2dd3 (patch)
tree9009c51ee0ed30ca4429bbb30b345ed0273789ad /source/groupdb
parentde290627f06915d420d37d2a3ac2f736c4cf8d74 (diff)
downloadsamba-b0381bb262f51fca916fb951fc0c7e54a58e2dd3.tar.gz
Greg Dickie spotted some wierd memory corruption problem with group
database enumeration.
Diffstat (limited to 'source/groupdb')
-rw-r--r--source/groupdb/aliasunix.c14
-rw-r--r--source/groupdb/builtinunix.c14
-rw-r--r--source/groupdb/groupunix.c14
3 files changed, 21 insertions, 21 deletions
diff --git a/source/groupdb/aliasunix.c b/source/groupdb/aliasunix.c
index e4a86d4fcd7..c53692f3282 100644
--- a/source/groupdb/aliasunix.c
+++ b/source/groupdb/aliasunix.c
@@ -170,7 +170,7 @@ static LOCAL_GRP *getalsunixpwent(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 (lp_server_role() == ROLE_DOMAIN_NONE)
@@ -195,12 +195,12 @@ static LOCAL_GRP *getalsunixpwent(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;
}
@@ -224,7 +224,7 @@ static LOCAL_GRP *getalsunixpwent(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;
}
@@ -236,8 +236,8 @@ static LOCAL_GRP *getalsunixpwent(void *vp, LOCAL_GRP_MEMBER **mem, int *num_mem
(*mem) = NULL;
(*num_mem) = 0;
- unix_grp = getgrgid(unix_grp->gr_gid);
- get_unixalias_members(unix_grp, num_mem, mem);
+ memcpy(&unix_grp, getgrgid(unix_grp.gr_gid), sizeof(unix_grp));
+ get_unixalias_members(&unix_grp, num_mem, mem);
}
{
diff --git a/source/groupdb/builtinunix.c b/source/groupdb/builtinunix.c
index 9f00582592f..57421cc449b 100644
--- a/source/groupdb/builtinunix.c
+++ b/source/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);
}
{
diff --git a/source/groupdb/groupunix.c b/source/groupdb/groupunix.c
index 1aeae1ca196..306e499858c 100644
--- a/source/groupdb/groupunix.c
+++ b/source/groupdb/groupunix.c
@@ -170,7 +170,7 @@ static DOMAIN_GRP *getgrpunixpwent(void *vp, DOMAIN_GRP_MEMBER **mem, int *num_m
{
/* Static buffers we will return. */
static DOMAIN_GRP gp_buf;
- struct group *unix_grp = NULL;
+ struct group unix_grp;
struct unix_entries *grps = (struct unix_entries *)vp;
if (grps == NULL)
@@ -204,12 +204,12 @@ static DOMAIN_GRP *getgrpunixpwent(void *vp, DOMAIN_GRP_MEMBER **mem, int *num_m
{
DOM_NAME_MAP gmep;
- 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;
}
@@ -230,7 +230,7 @@ static DOMAIN_GRP *getgrpunixpwent(void *vp, DOMAIN_GRP_MEMBER **mem, int *num_m
break;
}
- if (unix_grp == NULL || grps->grp_idx >= grps->num_grps)
+ if (grps->grp_idx >= grps->num_grps)
{
return NULL;
}
@@ -242,8 +242,8 @@ static DOMAIN_GRP *getgrpunixpwent(void *vp, DOMAIN_GRP_MEMBER **mem, int *num_m
(*mem) = NULL;
(*num_mem) = 0;
- unix_grp = getgrgid(unix_grp->gr_gid);
- get_unixgroup_members(unix_grp, num_mem, mem);
+ memcpy(&unix_grp, getgrgid(unix_grp.gr_gid), sizeof(unix_grp));
+ get_unixgroup_members(&unix_grp, num_mem, mem);
}
{