File 0022-cifs-idmap-plugin-use-new-sss_nss_idmap-calls.patch of Package sssd.22979

From ad5a5dc7ca1074e1727ab0e92d9a0cf8ef558975 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Fri, 25 May 2018 18:44:08 +0200
Subject: [PATCH 4/8] cifs 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 2571accdefe0999129910b3532be129812598857)
---
 src/lib/cifs_idmap_sss/cifs_idmap_sss.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/lib/cifs_idmap_sss/cifs_idmap_sss.c b/src/lib/cifs_idmap_sss/cifs_idmap_sss.c
index fd8b194c5..e7a0b8370 100644
--- a/src/lib/cifs_idmap_sss/cifs_idmap_sss.c
+++ b/src/lib/cifs_idmap_sss/cifs_idmap_sss.c
@@ -304,7 +304,18 @@ int cifs_idmap_ids_to_sids(void *handle, const struct cifs_uxid *cuxid,
     }
 
     for (i = 0; i < num; ++i) {
-        err = sss_nss_getsidbyid((uint32_t)cuxid[i].id.uid, &sid, &id_type);
+        switch (cuxid[i].type) {
+        case CIFS_UXID_TYPE_UID:
+            err = sss_nss_getsidbyuid((uint32_t)cuxid[i].id.uid,
+                                      &sid, &id_type);
+            break;
+        case CIFS_UXID_TYPE_GID:
+            err = sss_nss_getsidbygid((uint32_t)cuxid[i].id.gid,
+                                      &sid, &id_type);
+            break;
+        default:
+            err = sss_nss_getsidbyid((uint32_t)cuxid[i].id.uid, &sid, &id_type);
+        }
         if (err != 0)  {
             ctx_set_error(ctx, strerror(err));
             csid[i].revision = 0;
-- 
2.23.0

openSUSE Build Service is sponsored by