summaryrefslogtreecommitdiff
path: root/source3/groupdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-23 02:52:36 +0000
committerJeremy Allison <jra@samba.org>2002-11-23 02:52:36 +0000
commitde474974ea25df7738dd175126e3f1de0df47ea6 (patch)
treeb9d41afb7e5c64a91fb5538c05e9d3358909c386 /source3/groupdb
parent46d5c060c60753b94ae97ccd48aa7a8be791feed (diff)
downloadsamba-de474974ea25df7738dd175126e3f1de0df47ea6.tar.gz
samba-de474974ea25df7738dd175126e3f1de0df47ea6.tar.bz2
samba-de474974ea25df7738dd175126e3f1de0df47ea6.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. (This used to be commit 5d5762d1787db4392d2dff16024097c638b2d494)
Diffstat (limited to 'source3/groupdb')
-rw-r--r--source3/groupdb/mapping.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 0a2c1f3239..943183c061 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/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)
{