summaryrefslogtreecommitdiffstats
path: root/source/groupdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-23 02:52:38 +0000
committerJeremy Allison <jra@samba.org>2002-11-23 02:52:38 +0000
commit19f86f1f72aca924e9e320e20a175b5d21de45ad (patch)
tree77348639b31dcb086253f9543e107ce16d902c2d /source/groupdb
parent0ac3af1a27b8f1b9935bbcb6f3ec0b11d01bfcbd (diff)
downloadsamba-19f86f1f72aca924e9e320e20a175b5d21de45ad.tar.gz
samba-19f86f1f72aca924e9e320e20a175b5d21de45ad.tar.xz
samba-19f86f1f72aca924e9e320e20a175b5d21de45ad.zip
Lots of fixes for error paths where tdb_fetch() data need freeing.
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>. Jeremy.
Diffstat (limited to 'source/groupdb')
-rw-r--r--source/groupdb/mapping.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/source/groupdb/mapping.c b/source/groupdb/mapping.c
index 0a2c1f3239d..943183c061d 100644
--- a/source/groupdb/mapping.c
+++ b/source/groupdb/mapping.c
@@ -498,8 +498,9 @@ BOOL remove_privilege(PRIVILEGE_SET *priv_set, LUID_ATTR set)
}
/****************************************************************************
-return the sid and the type of the unix group
+ Return the sid and the type of the unix group.
****************************************************************************/
+
BOOL get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map, BOOL with_priv)
{
TDB_DATA kbuf, dbuf;
@@ -523,7 +524,8 @@ BOOL get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map, BOOL with_priv)
kbuf.dsize = strlen(key)+1;
dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr) return False;
+ if (!dbuf.dptr)
+ return False;
ret = tdb_unpack(dbuf.dptr, dbuf.dsize, "ddffd",
&map->gid, &map->sid_name_use, &map->nt_name, &map->comment, &map->systemaccount);
@@ -559,10 +561,10 @@ BOOL get_group_map_from_sid(DOM_SID sid, GROUP_MAP *map, BOOL with_priv)
return True;
}
-
/****************************************************************************
-return the sid and the type of the unix group
+ Return the sid and the type of the unix group.
****************************************************************************/
+
BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map, BOOL with_priv)
{
TDB_DATA kbuf, dbuf, newkey;
@@ -585,7 +587,8 @@ BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map, BOOL with_priv)
if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue;
dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr) continue;
+ if (!dbuf.dptr)
+ continue;
fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX));
@@ -624,8 +627,9 @@ BOOL get_group_map_from_gid(gid_t gid, GROUP_MAP *map, BOOL with_priv)
}
/****************************************************************************
-return the sid and the type of the unix group
+ Return the sid and the type of the unix group.
****************************************************************************/
+
BOOL get_group_map_from_ntname(char *name, GROUP_MAP *map, BOOL with_priv)
{
TDB_DATA kbuf, dbuf, newkey;
@@ -648,7 +652,8 @@ BOOL get_group_map_from_ntname(char *name, GROUP_MAP *map, BOOL with_priv)
if (strncmp(kbuf.dptr, GROUP_PREFIX, strlen(GROUP_PREFIX)) != 0) continue;
dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr) continue;
+ if (!dbuf.dptr)
+ continue;
fstrcpy(string_sid, kbuf.dptr+strlen(GROUP_PREFIX));
@@ -689,8 +694,9 @@ BOOL get_group_map_from_ntname(char *name, GROUP_MAP *map, BOOL with_priv)
}
/****************************************************************************
- remove a group mapping entry
+ Remove a group mapping entry.
****************************************************************************/
+
BOOL group_map_remove(DOM_SID sid)
{
TDB_DATA kbuf, dbuf;
@@ -711,7 +717,8 @@ BOOL group_map_remove(DOM_SID sid)
kbuf.dsize = strlen(key)+1;
dbuf = tdb_fetch(tdb, kbuf);
- if (!dbuf.dptr) return False;
+ if (!dbuf.dptr)
+ return False;
SAFE_FREE(dbuf.dptr);
@@ -721,10 +728,10 @@ BOOL group_map_remove(DOM_SID sid)
return True;
}
-
/****************************************************************************
-enumerate the group mapping
+ Enumerate the group mapping.
****************************************************************************/
+
BOOL enum_group_mapping(enum SID_NAME_USE sid_name_use, GROUP_MAP **rmap,
int *num_entries, BOOL unix_only, BOOL with_priv)
{