summaryrefslogtreecommitdiffstats
path: root/server/nss/nsssrv.c
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-02-16 15:49:54 -0500
committerSimo Sorce <idra@samba.org>2009-02-16 20:33:33 -0500
commit4166dd54ebb56083bf61f8d2d4b151c0e476e22c (patch)
tree919560c1649f9c35f1e8de59ed1278c332deeaa2 /server/nss/nsssrv.c
parent8ce804c66b2a6f24662d1568976c430777be2cd0 (diff)
downloadsssd-4166dd54ebb56083bf61f8d2d4b151c0e476e22c.tar.gz
sssd-4166dd54ebb56083bf61f8d2d4b151c0e476e22c.tar.xz
sssd-4166dd54ebb56083bf61f8d2d4b151c0e476e22c.zip
Enhancements and bugfixes to util/btreemap.c 1) Remove useless and unused btreemap_new() 2) Fix potentially serious memory allocation error. btreemap now requires a TALLOC_CTX to be passed in for assignment to the top node of the tree. Previously it was creating a new root TALLOC_CTX 3) Add new function btreemap_get_keys that will return a sorted array (newly allocated using talloc_realloc()) of keys (const void *) 4) Change the btreemap to use (const void *) keys instead of (void *)
Diffstat (limited to 'server/nss/nsssrv.c')
-rw-r--r--server/nss/nsssrv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/nss/nsssrv.c b/server/nss/nsssrv.c
index fa43f60f3..5a574b416 100644
--- a/server/nss/nsssrv.c
+++ b/server/nss/nsssrv.c
@@ -48,7 +48,7 @@ static int service_identity(DBusMessage *message, void *data, DBusMessage **r);
static int service_pong(DBusMessage *message, void *data, DBusMessage **r);
static int service_reload(DBusMessage *message, void *data, DBusMessage **r);
static int nss_init_domains(struct nss_ctx *nctx);
-static int _domain_comparator(void *key1, void *key2);
+static int _domain_comparator(const void *key1, const void *key2);
struct sbus_method nss_sbus_methods[] = {
{SERVICE_METHOD_IDENTITY, service_identity},
@@ -381,9 +381,9 @@ failed:
/* domain names are case insensitive for now
* NOTE: this function is not utf-8 safe,
* only ASCII names for now */
-static int _domain_comparator(void *key1, void *key2)
+static int _domain_comparator(const void *key1, const void *key2)
{
- return strcasecmp((char *)key1, (char *)key2);
+ return strcasecmp((const char *)key1, (const char *)key2);
}
static int nss_init_domains(struct nss_ctx *nctx)
@@ -407,7 +407,7 @@ static int nss_init_domains(struct nss_ctx *nctx)
/* Look up the appropriate basedn for this domain */
ret = confdb_get_domain_basedn(nctx->cdb, tmp_ctx, domains[i], &basedn);
DEBUG(3, ("BaseDN: %s\n", basedn));
- btreemap_set_value(&nctx->domain_map, domains[i], basedn, _domain_comparator);
+ btreemap_set_value(nctx, &nctx->domain_map, domains[i], basedn, _domain_comparator);
i++;
}
if (i == 0) {