dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 1d42e3c3a4f9536ee3539683a810c95314fd1c5d Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Mon, 10 Aug 2015 12:40:30 +0200
Subject: [PATCH 54/57] LDAP: use ldb_binary_encode when printing attribute
 values
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Reviewed-by: Pavel Březina <pbrezina@redhat.com>
---
 src/providers/ldap/sdap_utils.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/providers/ldap/sdap_utils.c b/src/providers/ldap/sdap_utils.c
index f5ce8ee54f60a6c4c4cdbd5e50b20d973c175e83..9da46ea70bf80e7f4d12fdfc7d1c97e99de8d000 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);
-- 
2.4.3