summaryrefslogtreecommitdiff
path: root/server/util
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-02-28 02:22:11 -0500
committerSimo Sorce <ssorce@redhat.com>2009-02-28 02:31:34 -0500
commitfcecd2ae67c315a900c374dec2cad3401b3f8bb5 (patch)
tree6568f0c7031c197e7312c884c738f12f593873cb /server/util
parent24480f7fa3bf3f40bd9fb7c865f9e3b329bf3ed8 (diff)
downloadsssd-fcecd2ae67c315a900c374dec2cad3401b3f8bb5.tar.gz
sssd-fcecd2ae67c315a900c374dec2cad3401b3f8bb5.tar.bz2
sssd-fcecd2ae67c315a900c374dec2cad3401b3f8bb5.zip
Fix confdb issues.
Avoid uninitialized memory messages in valgrind (in _btreemap_get_keys). Do not free memory we just stored in the btree (in confdb_get_domains_list). Streamline confdb_get_domains() and remove extra calls when we already have all the information handy. Do not store basedn in domain info, the base dn is always calculated out of the domain name. Remove the "provider" attribute, it was really used only to distinguish between LOCAL and other domains, directly check for LOCAL as a special case instead.
Diffstat (limited to 'server/util')
-rw-r--r--server/util/btreemap.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/server/util/btreemap.c b/server/util/btreemap.c
index 7bda0570..2d9b1761 100644
--- a/server/util/btreemap.c
+++ b/server/util/btreemap.c
@@ -166,19 +166,13 @@ int btreemap_set_value(TALLOC_CTX *mem_ctx,
return EOK;
}
-static int _btreemap_get_keys(TALLOC_CTX *mem_ctx, struct btreemap *map, const void ***array, int *count, int depth)
+static int _btreemap_get_keys(TALLOC_CTX *mem_ctx, struct btreemap *map,
+ const void ***array, int *count, int depth)
{
int ret;
const void **tmp_array;
- if (map == NULL) {
- if (depth == 0) {
- /* This is the top-level */
- count = 0;
- *array = NULL;
- }
- return EOK;
- }
+ if (map == NULL) return EOK;
/* Left Node */
ret = _btreemap_get_keys(mem_ctx, map->left, array, count, depth+1);
@@ -212,5 +206,6 @@ static int _btreemap_get_keys(TALLOC_CTX *mem_ctx, struct btreemap *map, const v
int btreemap_get_keys(TALLOC_CTX *mem_ctx, struct btreemap *map, const void ***array, int *count)
{
*array = NULL;
+ *count = 0;
return _btreemap_get_keys(mem_ctx, map, array, count, 0);
}