summaryrefslogtreecommitdiff
path: root/source4/lib/samba3/group.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-28 14:55:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:52 -0500
commit8b15ef881d21b713817bb3aa3599288ecdde0d28 (patch)
tree275dff742dddefa7040b273de34fd53195c18ee5 /source4/lib/samba3/group.c
parent707a237e76cfb6e32b5b930327f209aff2c60b64 (diff)
downloadsamba-8b15ef881d21b713817bb3aa3599288ecdde0d28.tar.gz
samba-8b15ef881d21b713817bb3aa3599288ecdde0d28.tar.bz2
samba-8b15ef881d21b713817bb3aa3599288ecdde0d28.zip
r9712: Bunch of small fixes
Write out basic sam.ldif (This used to be commit 67593bef7f0f8dc2258b2fe9c06779f0025d240e)
Diffstat (limited to 'source4/lib/samba3/group.c')
-rw-r--r--source4/lib/samba3/group.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source4/lib/samba3/group.c b/source4/lib/samba3/group.c
index 68ac5987d0..220f206e99 100644
--- a/source4/lib/samba3/group.c
+++ b/source4/lib/samba3/group.c
@@ -82,16 +82,21 @@ NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_g
if (!dbuf.dptr)
continue;
- map.sid = dom_sid_parse_talloc(ctx, kbuf.dptr+strlen(GROUP_PREFIX));
+ ZERO_STRUCT(map);
- ret = tdb_unpack(tdb, dbuf.dptr, dbuf.dsize, "ddff",
- &map.gid, &map.sid_name_use, &map.nt_name, &map.comment);
+ map.sid = dom_sid_parse_talloc(ctx, kbuf.dptr+strlen(GROUP_PREFIX));
+ ret = tdb_unpack(tdb, dbuf.dptr, dbuf.dsize, "dd",
+ &map.gid, &map.sid_name_use);
+
if ( ret == -1 ) {
DEBUG(3,("enum_group_mapping: tdb_unpack failure\n"));
continue;
}
+ map.nt_name = talloc_strdup(ctx, dbuf.dptr+ret);
+ map.comment = talloc_strdup(ctx, dbuf.dptr+ret+strlen(map.nt_name));
+
db->groupmappings = talloc_realloc(ctx, db->groupmappings, struct samba3_groupmapping, db->groupmap_count+1);
if (!db->groupmappings)
@@ -100,9 +105,7 @@ NTSTATUS samba3_read_grouptdb(const char *file, TALLOC_CTX *ctx, struct samba3_g
db->groupmappings[db->groupmap_count] = map;
db->groupmap_count++;
- }
-
- if (strncmp(kbuf.dptr, MEMBEROF_PREFIX, strlen(MEMBEROF_PREFIX)) == 0)
+ } else if (strncmp(kbuf.dptr, MEMBEROF_PREFIX, strlen(MEMBEROF_PREFIX)) == 0)
{
struct samba3_alias alias;
pstring alias_string;