[SSSD] [PATCH] IFP: Return group names with the right case

Jakub Hrozek jhrozek at redhat.com
Mon Dec 1 22:07:22 UTC 2014


Hi,

the attached patch fixes an issue found by Jan P. in the IFP code.
-------------- next part --------------
>From fa7fdf4df1c29bd066fa32b98b079a2ae24ab3fc Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Mon, 1 Dec 2014 23:00:06 +0100
Subject: [PATCH] IFP: Return group names with the right case

The IFP code wasn't honoring the case settings of the domain.
---
 src/responder/ifp/ifpsrv_cmd.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/responder/ifp/ifpsrv_cmd.c b/src/responder/ifp/ifpsrv_cmd.c
index 3b7442233a5b4d01f430c9ffdbcdc949637d6db9..5e2be20e8ad81e2b651f1e02ce58974bfaa56984 100644
--- a/src/responder/ifp/ifpsrv_cmd.c
+++ b/src/responder/ifp/ifpsrv_cmd.c
@@ -370,6 +370,7 @@ ifp_user_get_groups_reply(struct sss_domain_info *domain,
     int i, num;
     const char *name;
     const char **groupnames;
+    const char *tmpstr;
 
     /* one less, the first one is the user entry */
     num = res->count - 1;
@@ -388,15 +389,23 @@ ifp_user_get_groups_reply(struct sss_domain_info *domain,
         }
 
         if (ireq->ifp_ctx->rctx->override_space != '\0') {
-            groupnames[i] = sss_replace_space(groupnames, name,
-                                          ireq->ifp_ctx->rctx->override_space);
-            if (groupnames[i] == NULL) {
+            tmpstr = sss_replace_space(groupnames, name,
+                                       ireq->ifp_ctx->rctx->override_space);
+            if (tmpstr == NULL) {
                 DEBUG(SSSDBG_MINOR_FAILURE, "Cannot normalize %s\n", name);
                 continue;
             }
         } else {
-            groupnames[i] = name;
+            tmpstr = name;
         }
+
+        groupnames[i] = sss_get_cased_name(ireq, tmpstr, domain->case_preserve);
+        if (groupnames[i] == NULL) {
+            DEBUG(SSSDBG_CRIT_FAILURE,
+                  "sss_get_cased_name failed, skipping\n");
+            continue;
+        }
+
         DEBUG(SSSDBG_TRACE_FUNC, "Adding group %s\n", groupnames[i]);
     }
 
-- 
1.9.3



More information about the sssd-devel mailing list