summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-01-08 11:42:33 -0500
committerSimo Sorce <idra@samba.org>2009-01-09 14:23:26 -0500
commit37f6b1a70e5ca702e2081283755c4b9dd9a4b799 (patch)
tree35d548e86bb00273915bd71bb2cd153c15dbf27e /server
parentda71c2abd95930daf696ccecf81925997ff2689b (diff)
downloadsssd-37f6b1a70e5ca702e2081283755c4b9dd9a4b799.tar.gz
sssd-37f6b1a70e5ca702e2081283755c4b9dd9a4b799.tar.bz2
sssd-37f6b1a70e5ca702e2081283755c4b9dd9a4b799.zip
Fix a bug in confdb_get_string where attempting to return a default string of NULL would erroneously report ENOMEM.
Diffstat (limited to 'server')
-rw-r--r--server/confdb/confdb.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c
index 7d11fae7..9a0e365e 100644
--- a/server/confdb/confdb.c
+++ b/server/confdb/confdb.c
@@ -306,10 +306,20 @@ int confdb_get_string(struct confdb_ctx *cdb, TALLOC_CTX *ctx,
}
restr = talloc_steal(ctx, values[0]);
} else {
+ /* Did not return a value, so use the default */
+
+ if (defstr == NULL) { /* No default given */
+ *result = NULL;
+ talloc_free(values);
+ return EOK;
+ }
+
+ /* Copy the default string */
restr = talloc_strdup(ctx, defstr);
}
if (!restr) {
talloc_free(values);
+ DEBUG(0, ("Out of memory\n"));
return ENOMEM;
}
@@ -540,7 +550,7 @@ int confdb_get_domain_basedn(struct confdb_ctx *cdb,
section = talloc_asprintf(mem_ctx, "config/domains/%s", domain);
ret = confdb_get_string(cdb, mem_ctx, section, "basedn", "cn=local", basedn);
-
+
talloc_free(section);
return ret;
}