summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-08-10 12:40:30 +0200
committerJakub Hrozek <jhrozek@redhat.com>2015-09-07 18:21:42 +0200
commit0158fc7bd5b1ffeb2ae9929e5af6924c831a132a (patch)
tree017e1aff50b0a98e448df01be51d38f0023091b3
parentfd68d59f701ff90e4baae7b4bd137c374c719e8a (diff)
downloadsssd-0158fc7bd5b1ffeb2ae9929e5af6924c831a132a.tar.gz
sssd-0158fc7bd5b1ffeb2ae9929e5af6924c831a132a.tar.xz
sssd-0158fc7bd5b1ffeb2ae9929e5af6924c831a132a.zip
LDAP: use ldb_binary_encode when printing attribute values
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
-rw-r--r--src/providers/ldap/sdap_utils.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/providers/ldap/sdap_utils.c b/src/providers/ldap/sdap_utils.c
index f5ce8ee54..9da46ea70 100644
--- a/src/providers/ldap/sdap_utils.c
+++ b/src/providers/ldap/sdap_utils.c
@@ -35,6 +35,7 @@ sdap_attrs_add_ldap_attr(struct sysdb_attrs *ldap_attrs,
const char *objname = name ?: "object";
const char *desc = attr_desc ?: attr_name;
unsigned int num_values, i;
+ char *printable;
ret = sysdb_attrs_get_el(ldap_attrs, attr_name, &el);
if (ret) {
@@ -50,8 +51,16 @@ sdap_attrs_add_ldap_attr(struct sysdb_attrs *ldap_attrs,
} else {
num_values = multivalued ? el->num_values : 1;
for (i = 0; i < num_values; i++) {
+ printable = ldb_binary_encode(ldap_attrs, el->values[i]);
+ if (printable == NULL) {
+ DEBUG(SSSDBG_MINOR_FAILURE, "ldb_binary_encode failed..\n");
+ continue;
+ }
+
DEBUG(SSSDBG_TRACE_INTERNAL, "Adding %s [%s] to attributes "
- "of [%s].\n", desc, el->values[i].data, objname);
+ "of [%s].\n", desc, printable, objname);
+
+ talloc_zfree(printable);
ret = sysdb_attrs_add_mem(attrs, attr_name, el->values[i].data,
el->values[i].length);