dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0137-TOOLS-sss_groupshow-fails-to-show-MPG.patch

b2d430
From 8125ddd951a9e66fb3b11e16489e003d32ce4890 Mon Sep 17 00:00:00 2001
b2d430
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
b2d430
Date: Mon, 12 Sep 2016 19:22:56 +0200
b2d430
Subject: [PATCH 137/140] TOOLS: sss_groupshow fails to show MPG
b2d430
MIME-Version: 1.0
b2d430
Content-Type: text/plain; charset=UTF-8
b2d430
Content-Transfer-Encoding: 8bit
b2d430
b2d430
The MPG search uses it's own search function
b2d430
that used sysdb operation with shortname,
b2d430
but it expects internal fqname.
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/3184
b2d430
b2d430
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
b2d430
(cherry picked from commit 812bed08943df8bf3fd1ff9eabcaf5bedc635c92)
b2d430
---
b2d430
 src/tools/sss_groupshow.c | 12 ++++++++++--
b2d430
 1 file changed, 10 insertions(+), 2 deletions(-)
b2d430
b2d430
diff --git a/src/tools/sss_groupshow.c b/src/tools/sss_groupshow.c
b2d430
index 5870cc802c70366c47a0d30cb0d9795cf6035bc5..00f6f12939b6bef2dd10085f8cf99304e87f1211 100644
b2d430
--- a/src/tools/sss_groupshow.c
b2d430
+++ b/src/tools/sss_groupshow.c
b2d430
@@ -553,13 +553,14 @@ int group_show_recurse(TALLOC_CTX *mem_ctx,
b2d430
 
b2d430
 static int group_show_mpg(TALLOC_CTX *mem_ctx,
b2d430
                           struct sss_domain_info *domain,
b2d430
-                          const char *name,
b2d430
+                          const char *shortname,
b2d430
                           struct group_info **res)
b2d430
 {
b2d430
     const char *attrs[] = GROUP_SHOW_MPG_ATTRS;
b2d430
     struct ldb_message *msg;
b2d430
     struct group_info *info;
b2d430
     int ret;
b2d430
+    char *sysdb_fqname;
b2d430
 
b2d430
     info = talloc_zero(mem_ctx, struct group_info);
b2d430
     if (!info) {
b2d430
@@ -567,7 +568,14 @@ static int group_show_mpg(TALLOC_CTX *mem_ctx,
b2d430
         goto fail;
b2d430
     }
b2d430
 
b2d430
-    ret = sysdb_search_user_by_name(info, domain, name, attrs, &msg;;
b2d430
+    sysdb_fqname = sss_create_internal_fqname(mem_ctx,
b2d430
+                                              shortname,
b2d430
+                                              domain->name);
b2d430
+    if (sysdb_fqname == NULL) {
b2d430
+        return ENOMEM;
b2d430
+    }
b2d430
+
b2d430
+    ret = sysdb_search_user_by_name(info, domain, sysdb_fqname, attrs, &msg;;
b2d430
     if (ret) {
b2d430
         DEBUG(SSSDBG_OP_FAILURE,
b2d430
               "Search failed: %s (%d)\n", strerror(ret), ret);
b2d430
-- 
b2d430
2.7.4
b2d430