summaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-09-16 14:05:35 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-09-22 09:55:25 -0400
commite36ec25b898ecba4e28b244683c57a4372731042 (patch)
treed76f0355f5ee14ee0a111ee575960ad545a76fc8 /src/db
parent1286160a84dadf7d74f0541648717b101d68460a (diff)
downloadsssd-e36ec25b898ecba4e28b244683c57a4372731042.tar.gz
sssd-e36ec25b898ecba4e28b244683c57a4372731042.tar.xz
sssd-e36ec25b898ecba4e28b244683c57a4372731042.zip
Fix sysdb_group_dn_name
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 4e1243c08..5f002d844 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -56,6 +56,7 @@ errno_t sysdb_group_dn_name(struct sysdb_ctx *ctx, void *memctx,
const char *_dn, char **_name)
{
struct ldb_dn *dn;
+ const struct ldb_val *val;
*_name = NULL;
dn = ldb_dn_new_fmt(memctx, ctx->ldb, "%s", _dn);
@@ -63,7 +64,13 @@ errno_t sysdb_group_dn_name(struct sysdb_ctx *ctx, void *memctx,
return ENOMEM;
}
- *_name = talloc_strdup(memctx, ldb_dn_get_rdn_name(dn));
+ val = ldb_dn_get_rdn_val(dn);
+ if (val == NULL) {
+ talloc_zfree(dn);
+ return EINVAL;
+ }
+
+ *_name = talloc_strndup(memctx, (char *) val->data, val->length);
if (!*_name) {
talloc_zfree(dn);
return ENOMEM;