diff options
Diffstat (limited to 'source3/passdb')
-rw-r--r-- | source3/passdb/lookup_sid.c | 12 | ||||
-rw-r--r-- | source3/passdb/passdb.c | 20 | ||||
-rw-r--r-- | source3/passdb/pdb_ads.c | 21 | ||||
-rw-r--r-- | source3/passdb/pdb_interface.c | 144 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 47 | ||||
-rw-r--r-- | source3/passdb/pdb_samba4.c | 16 | ||||
-rw-r--r-- | source3/passdb/pdb_wbc_sam.c | 7 | ||||
-rw-r--r-- | source3/passdb/proto.h | 7 | ||||
-rw-r--r-- | source3/passdb/py_passdb.c | 8 |
9 files changed, 196 insertions, 86 deletions
diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index 4c2e73befd..a02c941d8e 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -1233,20 +1233,25 @@ done: static bool legacy_sid_to_gid(const struct dom_sid *psid, gid_t *pgid) { - GROUP_MAP map; + GROUP_MAP *map; union unid_t id; enum lsa_SidType type; + map = talloc_zero(NULL, GROUP_MAP); + if (!map) { + return false; + } + if ((sid_check_is_in_builtin(psid) || sid_check_is_in_wellknown_domain(psid))) { bool ret; become_root(); - ret = pdb_getgrsid(&map, *psid); + ret = pdb_getgrsid(map, *psid); unbecome_root(); if (ret) { - *pgid = map.gid; + *pgid = map->gid; goto done; } DEBUG(10,("LEGACY: mapping failed for sid %s\n", @@ -1286,6 +1291,7 @@ static bool legacy_sid_to_gid(const struct dom_sid *psid, gid_t *pgid) store_gid_sid_cache(psid, *pgid); + TALLOC_FREE(map); return true; } diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index 62dcb5dedd..276e0314c8 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -591,7 +591,7 @@ bool algorithmic_pdb_rid_is_user(uint32_t rid) bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid, enum lsa_SidType *type) { - GROUP_MAP map; + GROUP_MAP *map; bool ret; /* Windows treats "MACHINE\None" as a special name for @@ -645,24 +645,32 @@ bool lookup_global_sam_name(const char *name, int flags, uint32_t *rid, * Maybe it is a group ? */ + map = talloc_zero(NULL, GROUP_MAP); + if (!map) { + return false; + } + become_root(); - ret = pdb_getgrnam(&map, name); + ret = pdb_getgrnam(map, name); unbecome_root(); if (!ret) { + TALLOC_FREE(map); return False; } /* BUILTIN groups are looked up elsewhere */ - if (!sid_check_is_in_our_domain(&map.sid)) { + if (!sid_check_is_in_our_domain(&map->sid)) { DEBUG(10, ("Found group %s (%s) not in our domain -- " - "ignoring.", name, sid_string_dbg(&map.sid))); + "ignoring.", name, sid_string_dbg(&map->sid))); + TALLOC_FREE(map); return False; } /* yes it's a mapped group */ - sid_peek_rid(&map.sid, rid); - *type = map.sid_name_use; + sid_peek_rid(&map->sid, rid); + *type = map->sid_name_use; + TALLOC_FREE(map); return True; } diff --git a/source3/passdb/pdb_ads.c b/source3/passdb/pdb_ads.c index 3746da3a4f..57425349f8 100644 --- a/source3/passdb/pdb_ads.c +++ b/source3/passdb/pdb_ads.c @@ -798,16 +798,14 @@ static NTSTATUS pdb_ads_getgrfilter(struct pdb_methods *m, GROUP_MAP *map, if (str == NULL) { return NT_STATUS_INTERNAL_DB_CORRUPTION; } - fstrcpy(map->nt_name, str); - TALLOC_FREE(str); + map->nt_name = talloc_move(map, &str); str = tldap_talloc_single_attribute(group[0], "description", talloc_tos()); if (str != NULL) { - fstrcpy(map->comment, str); - TALLOC_FREE(str); + map->comment = talloc_move(map, &str); } else { - map->comment[0] = '\0'; + map->comment = talloc_strdup(map, ""); } if (pmsg != NULL) { @@ -1017,7 +1015,7 @@ static NTSTATUS pdb_ads_update_group_mapping_entry(struct pdb_methods *m, char *filter; struct tldap_message *existing; char *dn; - GROUP_MAP existing_map; + GROUP_MAP *existing_map; int rc, num_mods = 0; bool ret; NTSTATUS status; @@ -1033,8 +1031,15 @@ static NTSTATUS pdb_ads_update_group_mapping_entry(struct pdb_methods *m, if (filter == NULL) { return NT_STATUS_NO_MEMORY; } - status = pdb_ads_getgrfilter(m, &existing_map, filter, + + existing_map = talloc_zero(talloc_tos(), GROUP_MAP); + if (!existing_map) { + return NT_STATUS_NO_MEMORY; + } + + status = pdb_ads_getgrfilter(m, existing_map, filter, talloc_tos(), &existing); + TALLOC_FREE(existing_map); TALLOC_FREE(filter); if (!tldap_entry_dn(existing, &dn)) { @@ -1079,7 +1084,7 @@ static NTSTATUS pdb_ads_delete_group_mapping_entry(struct pdb_methods *m, static NTSTATUS pdb_ads_enum_group_mapping(struct pdb_methods *m, const struct dom_sid *sid, enum lsa_SidType sid_name_use, - GROUP_MAP **pp_rmap, + GROUP_MAP ***pp_rmap, size_t *p_num_entries, bool unix_only) { diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 7a0279e1fb..03d9821012 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -777,32 +777,39 @@ static NTSTATUS pdb_default_delete_dom_group(struct pdb_methods *methods, uint32_t rid) { struct dom_sid group_sid; - GROUP_MAP map; + GROUP_MAP *map; NTSTATUS status; struct group *grp; const char *grp_name; + map = talloc_zero(mem_ctx, GROUP_MAP); + if (!map) { + return NT_STATUS_NO_MEMORY; + } + /* coverity */ - map.gid = (gid_t) -1; + map->gid = (gid_t) -1; sid_compose(&group_sid, get_global_sam_sid(), rid); - if (!get_domain_group_from_sid(group_sid, &map)) { + if (!get_domain_group_from_sid(group_sid, map)) { DEBUG(10, ("Could not find group for rid %d\n", rid)); return NT_STATUS_NO_SUCH_GROUP; } /* We need the group name for the smb_delete_group later on */ - if (map.gid == (gid_t)-1) { + if (map->gid == (gid_t)-1) { return NT_STATUS_NO_SUCH_GROUP; } - grp = getgrgid(map.gid); + grp = getgrgid(map->gid); if (grp == NULL) { return NT_STATUS_NO_SUCH_GROUP; } + TALLOC_FREE(map); + /* Copy the name, no idea what pdb_delete_group_mapping_entry does.. */ grp_name = talloc_strdup(mem_ctx, grp->gr_name); @@ -847,8 +854,11 @@ NTSTATUS pdb_delete_group_mapping_entry(struct dom_sid sid) return pdb->delete_group_mapping_entry(pdb, sid); } -bool pdb_enum_group_mapping(const struct dom_sid *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, - size_t *p_num_entries, bool unix_only) +bool pdb_enum_group_mapping(const struct dom_sid *sid, + enum lsa_SidType sid_name_use, + GROUP_MAP ***pp_rmap, + size_t *p_num_entries, + bool unix_only) { struct pdb_methods *pdb = pdb_get_methods(); return NT_STATUS_IS_OK(pdb-> enum_group_mapping(pdb, sid, sid_name_use, @@ -954,24 +964,31 @@ static NTSTATUS pdb_default_add_groupmem(struct pdb_methods *methods, { struct dom_sid group_sid, member_sid; struct samu *account = NULL; - GROUP_MAP map; + GROUP_MAP *map; struct group *grp; struct passwd *pwd; const char *group_name; uid_t uid; + map = talloc_zero(mem_ctx, GROUP_MAP); + if (!map) { + return NT_STATUS_NO_MEMORY; + } + /* coverity */ - map.gid = (gid_t) -1; + map->gid = (gid_t) -1; sid_compose(&group_sid, get_global_sam_sid(), group_rid); sid_compose(&member_sid, get_global_sam_sid(), member_rid); - if (!get_domain_group_from_sid(group_sid, &map) || - (map.gid == (gid_t)-1) || - ((grp = getgrgid(map.gid)) == NULL)) { + if (!get_domain_group_from_sid(group_sid, map) || + (map->gid == (gid_t)-1) || + ((grp = getgrgid(map->gid)) == NULL)) { return NT_STATUS_NO_SUCH_GROUP; } + TALLOC_FREE(map); + group_name = talloc_strdup(mem_ctx, grp->gr_name); if (group_name == NULL) { return NT_STATUS_NO_MEMORY; @@ -1019,21 +1036,28 @@ static NTSTATUS pdb_default_del_groupmem(struct pdb_methods *methods, { struct dom_sid group_sid, member_sid; struct samu *account = NULL; - GROUP_MAP map; + GROUP_MAP *map; struct group *grp; struct passwd *pwd; const char *group_name; uid_t uid; + map = talloc_zero(mem_ctx, GROUP_MAP); + if (!map) { + return NT_STATUS_NO_MEMORY; + } + sid_compose(&group_sid, get_global_sam_sid(), group_rid); sid_compose(&member_sid, get_global_sam_sid(), member_rid); - if (!get_domain_group_from_sid(group_sid, &map) || - (map.gid == (gid_t)-1) || - ((grp = getgrgid(map.gid)) == NULL)) { + if (!get_domain_group_from_sid(group_sid, map) || + (map->gid == (gid_t)-1) || + ((grp = getgrgid(map->gid)) == NULL)) { return NT_STATUS_NO_SUCH_GROUP; } + TALLOC_FREE(map); + group_name = talloc_strdup(mem_ctx, grp->gr_name); if (group_name == NULL) { return NT_STATUS_NO_MEMORY; @@ -1397,14 +1421,21 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid, static bool pdb_default_gid_to_sid(struct pdb_methods *methods, gid_t gid, struct dom_sid *sid) { - GROUP_MAP map; + GROUP_MAP *map; - if (!NT_STATUS_IS_OK(methods->getgrgid(methods, &map, gid))) { - return False; + map = talloc_zero(NULL, GROUP_MAP); + if (!map) { + return false; } - sid_copy(sid, &map.sid); - return True; + if (!NT_STATUS_IS_OK(methods->getgrgid(methods, map, gid))) { + TALLOC_FREE(map); + return false; + } + + sid_copy(sid, &map->sid); + TALLOC_FREE(map); + return true; } static bool pdb_default_sid_to_id(struct pdb_methods *methods, @@ -1452,21 +1483,28 @@ static bool pdb_default_sid_to_id(struct pdb_methods *methods, if (sid_check_is_in_builtin(sid) || sid_check_is_in_wellknown_domain(sid)) { /* Here we only have aliases */ - GROUP_MAP map; - if (!NT_STATUS_IS_OK(methods->getgrsid(methods, &map, *sid))) { + GROUP_MAP *map; + + map = talloc_zero(mem_ctx, GROUP_MAP); + if (!map) { + ret = false; + goto done; + } + + if (!NT_STATUS_IS_OK(methods->getgrsid(methods, map, *sid))) { DEBUG(10, ("Could not find map for sid %s\n", sid_string_dbg(sid))); goto done; } - if ((map.sid_name_use != SID_NAME_ALIAS) && - (map.sid_name_use != SID_NAME_WKN_GRP)) { + if ((map->sid_name_use != SID_NAME_ALIAS) && + (map->sid_name_use != SID_NAME_WKN_GRP)) { DEBUG(10, ("Map for sid %s is a %s, expected an " "alias\n", sid_string_dbg(sid), - sid_type_lookup(map.sid_name_use))); + sid_type_lookup(map->sid_name_use))); goto done; } - id->gid = map.gid; + id->gid = map->gid; *type = SID_NAME_ALIAS; ret = True; goto done; @@ -1634,7 +1672,7 @@ static bool lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32_t rid, union unid_t *unix_id) { struct samu *sam_account = NULL; - GROUP_MAP map; + GROUP_MAP *map = NULL; bool ret; struct dom_sid sid; @@ -1651,12 +1689,28 @@ static bool lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32_t rid, return False; } + map = talloc_zero(mem_ctx, GROUP_MAP); + if (!map) { + return false; + } + /* BEING ROOT BLOCK */ become_root(); - if (pdb_getsampwsid(sam_account, &sid)) { + ret = pdb_getsampwsid(sam_account, &sid); + if (!ret) { + TALLOC_FREE(sam_account); + ret = pdb_getgrsid(map, sid); + } + unbecome_root(); + /* END BECOME_ROOT BLOCK */ + + if (sam_account || !ret) { + TALLOC_FREE(map); + } + + if (sam_account) { struct passwd *pw; - unbecome_root(); /* -----> EXIT BECOME_ROOT() */ *name = talloc_strdup(mem_ctx, pdb_get_username(sam_account)); if (!*name) { TALLOC_FREE(sam_account); @@ -1678,27 +1732,25 @@ static bool lookup_global_sam_rid(TALLOC_CTX *mem_ctx, uint32_t rid, unix_id->uid = pw->pw_uid; TALLOC_FREE(pw); return True; - } - TALLOC_FREE(sam_account); - ret = pdb_getgrsid(&map, sid); - unbecome_root(); - /* END BECOME_ROOT BLOCK */ + } else if (map && (map->gid != (gid_t)-1)) { - /* do not resolve SIDs to a name unless there is a valid - gid associated with it */ + /* do not resolve SIDs to a name unless there is a valid + gid associated with it */ - if ( ret && (map.gid != (gid_t)-1) ) { - *name = talloc_strdup(mem_ctx, map.nt_name); - *psid_name_use = map.sid_name_use; + *name = talloc_steal(mem_ctx, map->nt_name); + *psid_name_use = map->sid_name_use; if ( unix_id ) { - unix_id->gid = map.gid; + unix_id->gid = map->gid; } + TALLOC_FREE(map); return True; } + TALLOC_FREE(map); + /* Windows will always map RID 513 to something. On a non-domain controller, this gets mapped to SERVER\None. */ @@ -1901,7 +1953,7 @@ static void fill_displayentry(TALLOC_CTX *mem_ctx, uint32_t rid, } struct group_search { - GROUP_MAP *groups; + GROUP_MAP **groups; size_t num_groups, current_group; }; @@ -1910,11 +1962,13 @@ static bool next_entry_groups(struct pdb_search *s, { struct group_search *state = (struct group_search *)s->private_data; uint32_t rid; - GROUP_MAP *map = &state->groups[state->current_group]; + GROUP_MAP *map; if (state->current_group == state->num_groups) return False; + map = state->groups[state->current_group]; + sid_peek_rid(&map->sid, &rid); fill_displayentry(s, rid, 0, map->nt_name, NULL, map->comment, entry); @@ -1927,7 +1981,7 @@ static void search_end_groups(struct pdb_search *search) { struct group_search *state = (struct group_search *)search->private_data; - SAFE_FREE(state->groups); + TALLOC_FREE(state->groups); } static bool pdb_search_grouptype(struct pdb_methods *methods, @@ -1936,7 +1990,7 @@ static bool pdb_search_grouptype(struct pdb_methods *methods, { struct group_search *state; - state = talloc(search, struct group_search); + state = talloc_zero(search, struct group_search); if (state == NULL) { DEBUG(0, ("talloc failed\n")); return False; diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 3d3d16c789..dd46f8f87f 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -2471,7 +2471,11 @@ for gidNumber(%lu)\n",(unsigned long)map->gid)); return false; } } - fstrcpy(map->nt_name, temp); + map->nt_name = talloc_strdup(map, temp); + if (!map->nt_name) { + TALLOC_FREE(ctx); + return false; + } TALLOC_FREE(temp); temp = smbldap_talloc_single_attribute( @@ -2487,7 +2491,11 @@ for gidNumber(%lu)\n",(unsigned long)map->gid)); return false; } } - fstrcpy(map->comment, temp); + map->comment = talloc_strdup(map, temp); + if (!map->comment) { + TALLOC_FREE(ctx); + return false; + } if (lp_parm_bool(-1, "ldapsam", "trusted", false)) { store_gid_sid_cache(&map->sid, map->gid); @@ -3470,15 +3478,15 @@ static NTSTATUS ldapsam_getsamgrent(struct pdb_methods *my_methods, static NTSTATUS ldapsam_enum_group_mapping(struct pdb_methods *methods, const struct dom_sid *domsid, enum lsa_SidType sid_name_use, - GROUP_MAP **pp_rmap, + GROUP_MAP ***pp_rmap, size_t *p_num_entries, bool unix_only) { - GROUP_MAP map = { 0, }; + GROUP_MAP *map = NULL; size_t entries = 0; *p_num_entries = 0; - *pp_rmap = NULL; + **pp_rmap = NULL; if (!NT_STATUS_IS_OK(ldapsam_setsamgrent(methods, False))) { DEBUG(0, ("ldapsam_enum_group_mapping: Unable to open " @@ -3486,31 +3494,44 @@ static NTSTATUS ldapsam_enum_group_mapping(struct pdb_methods *methods, return NT_STATUS_ACCESS_DENIED; } - while (NT_STATUS_IS_OK(ldapsam_getsamgrent(methods, &map))) { + while (true) { + + map = talloc_zero(NULL, GROUP_MAP); + if (!map) { + return NT_STATUS_NO_MEMORY; + } + + if (!NT_STATUS_IS_OK(ldapsam_getsamgrent(methods, map))) { + TALLOC_FREE(map); + break; + } + if (sid_name_use != SID_NAME_UNKNOWN && - sid_name_use != map.sid_name_use) { + sid_name_use != map->sid_name_use) { DEBUG(11,("ldapsam_enum_group_mapping: group %s is " - "not of the requested type\n", map.nt_name)); + "not of the requested type\n", + map->nt_name)); continue; } - if (unix_only==ENUM_ONLY_MAPPED && map.gid==-1) { + if (unix_only == ENUM_ONLY_MAPPED && map->gid == -1) { DEBUG(11,("ldapsam_enum_group_mapping: group %s is " - "non mapped\n", map.nt_name)); + "non mapped\n", map->nt_name)); continue; } - (*pp_rmap)=SMB_REALLOC_ARRAY((*pp_rmap), GROUP_MAP, entries+1); + *pp_rmap = talloc_realloc(NULL, *pp_rmap, + GROUP_MAP *, entries + 1); if (!(*pp_rmap)) { DEBUG(0,("ldapsam_enum_group_mapping: Unable to " "enlarge group map!\n")); return NT_STATUS_UNSUCCESSFUL; } - (*pp_rmap)[entries] = map; + (*pp_rmap)[entries] = talloc_move((*pp_rmap), &map); entries += 1; - } + ldapsam_endsamgrent(methods); *p_num_entries = entries; diff --git a/source3/passdb/pdb_samba4.c b/source3/passdb/pdb_samba4.c index 5e680ad2a1..af252143cd 100644 --- a/source3/passdb/pdb_samba4.c +++ b/source3/passdb/pdb_samba4.c @@ -901,14 +901,22 @@ static NTSTATUS pdb_samba4_getgrfilter(struct pdb_methods *m, GROUP_MAP *map, talloc_free(tmp_ctx); return NT_STATUS_INTERNAL_DB_CORRUPTION; } - fstrcpy(map->nt_name, str); + map->nt_name = talloc_strdup(map, str); + if (!map->nt_name) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } str = ldb_msg_find_attr_as_string(msg, "description", NULL); if (str != NULL) { - fstrcpy(map->comment, str); + map->comment = talloc_strdup(map, str); } else { - map->comment[0] = '\0'; + map->comment = talloc_strdup(map, ""); + } + if (!map->comment) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; } talloc_free(tmp_ctx); @@ -1071,7 +1079,7 @@ static NTSTATUS pdb_samba4_delete_group_mapping_entry(struct pdb_methods *m, static NTSTATUS pdb_samba4_enum_group_mapping(struct pdb_methods *m, const struct dom_sid *sid, enum lsa_SidType sid_name_use, - GROUP_MAP **pp_rmap, + GROUP_MAP ***pp_rmap, size_t *p_num_entries, bool unix_only) { diff --git a/source3/passdb/pdb_wbc_sam.c b/source3/passdb/pdb_wbc_sam.c index 399d7580fa..655890f807 100644 --- a/source3/passdb/pdb_wbc_sam.c +++ b/source3/passdb/pdb_wbc_sam.c @@ -228,8 +228,11 @@ static NTSTATUS pdb_wbc_sam_enum_trusteddoms(struct pdb_methods *methods, static bool _make_group_map(struct pdb_methods *methods, const char *domain, const char *name, enum lsa_SidType name_type, gid_t gid, struct dom_sid *sid, GROUP_MAP *map) { - snprintf(map->nt_name, sizeof(map->nt_name), "%s%c%s", + map->nt_name = talloc_asprintf(map, "%s%c%s", domain, *lp_winbind_separator(), name); + if (!map->nt_name) { + return false; + } map->sid_name_use = name_type; map->sid = *sid; map->gid = gid; @@ -354,7 +357,7 @@ done: static NTSTATUS pdb_wbc_sam_enum_group_mapping(struct pdb_methods *methods, const struct dom_sid *sid, enum lsa_SidType sid_name_use, - GROUP_MAP **pp_rmap, size_t *p_num_entries, + GROUP_MAP ***pp_rmap, size_t *p_num_entries, bool unix_only) { return NT_STATUS_NOT_IMPLEMENTED; diff --git a/source3/passdb/proto.h b/source3/passdb/proto.h index 36acc313f6..fc5fd9c0f5 100644 --- a/source3/passdb/proto.h +++ b/source3/passdb/proto.h @@ -229,8 +229,11 @@ NTSTATUS pdb_delete_dom_group(TALLOC_CTX *mem_ctx, uint32_t rid); NTSTATUS pdb_add_group_mapping_entry(GROUP_MAP *map); NTSTATUS pdb_update_group_mapping_entry(GROUP_MAP *map); NTSTATUS pdb_delete_group_mapping_entry(struct dom_sid sid); -bool pdb_enum_group_mapping(const struct dom_sid *sid, enum lsa_SidType sid_name_use, GROUP_MAP **pp_rmap, - size_t *p_num_entries, bool unix_only); +bool pdb_enum_group_mapping(const struct dom_sid *sid, + enum lsa_SidType sid_name_use, + GROUP_MAP ***pp_rmap, + size_t *p_num_entries, + bool unix_only); NTSTATUS pdb_enum_group_members(TALLOC_CTX *mem_ctx, const struct dom_sid *sid, uint32_t **pp_member_rids, diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c index 48b151387a..025e82812c 100644 --- a/source3/passdb/py_passdb.c +++ b/source3/passdb/py_passdb.c @@ -1805,7 +1805,7 @@ static PyObject *py_pdb_enum_group_mapping(pytalloc_Object *self, PyObject *args int unix_only = 0; PyObject *py_domain_sid; struct dom_sid *domain_sid = NULL; - GROUP_MAP *gmap, *group_map; + GROUP_MAP **gmap, *group_map; size_t num_entries; PyObject *py_gmap_list, *py_group_map; int i; @@ -1852,13 +1852,15 @@ static PyObject *py_pdb_enum_group_mapping(pytalloc_Object *self, PyObject *args py_group_map = py_groupmap_new(&PyGroupmap, NULL, NULL); if (py_group_map) { group_map = pytalloc_get_ptr(py_group_map); - *group_map = gmap[i]; + *group_map = *gmap[i]; + talloc_steal(group_map, gmap[i]->nt_name); + talloc_steal(group_map, gmap[i]->comment); PyList_Append(py_gmap_list, py_group_map); } } - free(gmap); + talloc_free(gmap); talloc_free(tframe); return py_gmap_list; |