Blame SOURCES/0054-LDAP-use-ldb_binary_encode-when-printing-attribute-v.patch

6cf099
From 1d42e3c3a4f9536ee3539683a810c95314fd1c5d Mon Sep 17 00:00:00 2001
6cf099
From: Jakub Hrozek <jhrozek@redhat.com>
6cf099
Date: Mon, 10 Aug 2015 12:40:30 +0200
6cf099
Subject: [PATCH 54/57] LDAP: use ldb_binary_encode when printing attribute
6cf099
 values
6cf099
MIME-Version: 1.0
6cf099
Content-Type: text/plain; charset=UTF-8
6cf099
Content-Transfer-Encoding: 8bit
6cf099
6cf099
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
6cf099
---
6cf099
 src/providers/ldap/sdap_utils.c | 11 ++++++++++-
6cf099
 1 file changed, 10 insertions(+), 1 deletion(-)
6cf099
6cf099
diff --git a/src/providers/ldap/sdap_utils.c b/src/providers/ldap/sdap_utils.c
6cf099
index f5ce8ee54f60a6c4c4cdbd5e50b20d973c175e83..9da46ea70bf80e7f4d12fdfc7d1c97e99de8d000 100644
6cf099
--- a/src/providers/ldap/sdap_utils.c
6cf099
+++ b/src/providers/ldap/sdap_utils.c
6cf099
@@ -35,6 +35,7 @@ sdap_attrs_add_ldap_attr(struct sysdb_attrs *ldap_attrs,
6cf099
     const char *objname = name ?: "object";
6cf099
     const char *desc = attr_desc ?: attr_name;
6cf099
     unsigned int num_values, i;
6cf099
+    char *printable;
6cf099
 
6cf099
     ret = sysdb_attrs_get_el(ldap_attrs, attr_name, &el);
6cf099
     if (ret) {
6cf099
@@ -50,8 +51,16 @@ sdap_attrs_add_ldap_attr(struct sysdb_attrs *ldap_attrs,
6cf099
     } else {
6cf099
         num_values = multivalued ? el->num_values : 1;
6cf099
         for (i = 0; i < num_values; i++) {
6cf099
+            printable = ldb_binary_encode(ldap_attrs, el->values[i]);
6cf099
+            if (printable == NULL) {
6cf099
+                DEBUG(SSSDBG_MINOR_FAILURE, "ldb_binary_encode failed..\n");
6cf099
+                continue;
6cf099
+            }
6cf099
+
6cf099
             DEBUG(SSSDBG_TRACE_INTERNAL, "Adding %s [%s] to attributes "
6cf099
-                  "of [%s].\n", desc, el->values[i].data, objname);
6cf099
+                  "of [%s].\n", desc, printable, objname);
6cf099
+
6cf099
+            talloc_zfree(printable);
6cf099
 
6cf099
             ret = sysdb_attrs_add_mem(attrs, attr_name, el->values[i].data,
6cf099
                                       el->values[i].length);
6cf099
-- 
6cf099
2.4.3
6cf099