Hello list,

in my opinion we might refer to user by their name and not by 'for loop' variable. This patch fixes this issue. I hit the issue during some debugging.

Regards

--
Petr^4 Čech
>From 513a70ca5fb79973077725df84905921af30be8a Mon Sep 17 00:00:00 2001
From: Petr Cech <pc...@redhat.com>
Date: Fri, 15 Jul 2016 14:54:35 +0200
Subject: [PATCH] LDAP: Improving debug message

There were debug messges refering to user by for loop variable.
We might obtain user name and refer to user by this.
---
 src/providers/ldap/sdap_async_users.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/providers/ldap/sdap_async_users.c b/src/providers/ldap/sdap_async_users.c
index e44c045b3f8ff6aed33a42cf2919bc01aa41a243..3a8efa4caacbad74f493de334a387104d0e7cec4 100644
--- a/src/providers/ldap/sdap_async_users.c
+++ b/src/providers/ldap/sdap_async_users.c
@@ -519,6 +519,7 @@ int sdap_save_users(TALLOC_CTX *memctx,
                     char **_usn_value)
 {
     TALLOC_CTX *tmpctx;
+    const char* user_name = NULL;
     char *higher_usn = NULL;
     char *usn_value;
     int ret;
@@ -548,14 +549,22 @@ int sdap_save_users(TALLOC_CTX *memctx,
     for (i = 0; i < num_users; i++) {
         usn_value = NULL;
 
+        ret = sdap_get_user_primary_name(memctx, opts, users[i],
+                                         dom, &user_name);
+        if (ret != EOK) {
+            DEBUG(SSSDBG_OP_FAILURE, "Failed to get user name\n");
+            goto done;
+        }
+
         ret = sdap_save_user(tmpctx, opts, dom, users[i], &usn_value, now);
 
         /* Do not fail completely on errors.
          * Just report the failure to save and go on */
         if (ret) {
-            DEBUG(SSSDBG_OP_FAILURE, "Failed to store user %d. Ignoring.\n", i);
+            DEBUG(SSSDBG_OP_FAILURE, "Failed to store user %s. Ignoring.\n",
+                                     user_name);
         } else {
-            DEBUG(SSSDBG_TRACE_ALL, "User %d processed!\n", i);
+            DEBUG(SSSDBG_TRACE_ALL, "User %s processed!\n", user_name);
         }
 
         if (usn_value) {
-- 
2.7.4

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to