File 0023-winbind-idmap-plugin-use-new-sss_nss_idmap-calls.patch of Package sssd.27548

From b05fafa824a337c74e2e337116732779e1c2d8de Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Fri, 25 May 2018 18:37:42 +0200
Subject: [PATCH 5/8] winbind idmap plugin: use new sss_nss_idmap calls

Related to https://pagure.io/SSSD/sssd/issue/3629

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
(cherry picked from commit 8ae68aa27d3e4d3a42ebfa3cb165dc4d9f289c61)
---
 src/lib/winbind_idmap_sss/winbind_idmap_sss.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/lib/winbind_idmap_sss/winbind_idmap_sss.c b/src/lib/winbind_idmap_sss/winbind_idmap_sss.c
index ea5e727c3..0d9109455 100644
--- a/src/lib/winbind_idmap_sss/winbind_idmap_sss.c
+++ b/src/lib/winbind_idmap_sss/winbind_idmap_sss.c
@@ -85,7 +85,16 @@ static NTSTATUS idmap_sss_unixids_to_sids(struct idmap_domain *dom,
     }
 
     for (c = 0; map[c]; c++) {
-        ret = sss_nss_getsidbyid(map[c]->xid.id, &sid_str, &id_type);
+        switch (map[c]->xid.type) {
+        case ID_TYPE_UID:
+            ret = sss_nss_getsidbyuid(map[c]->xid.id, &sid_str, &id_type);
+            break;
+        case ID_TYPE_GID:
+            ret = sss_nss_getsidbygid(map[c]->xid.id, &sid_str, &id_type);
+            break;
+        default:
+            ret = sss_nss_getsidbyid(map[c]->xid.id, &sid_str, &id_type);
+        }
         if (ret != 0) {
             if (ret == ENOENT) {
                 map[c]->status = ID_UNMAPPED;
-- 
2.23.0

openSUSE Build Service is sponsored by