dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0154-RESPONDER_COMMON-update-certmaps-in-responders.patch

bb7cd1
From d363bd0f829fa7af5f96c2b07b975b7b2c5fdcfa Mon Sep 17 00:00:00 2001
bb7cd1
From: Sumit Bose <sbose@redhat.com>
bb7cd1
Date: Tue, 2 May 2017 15:25:10 +0200
bb7cd1
Subject: [PATCH 154/160] RESPONDER_COMMON: update certmaps in responders
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
Make certificate mapping data available to the responders.
bb7cd1
bb7cd1
Related to https://pagure.io/SSSD/sssd/issue/3395
bb7cd1
bb7cd1
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
bb7cd1
(cherry picked from commit 749963195393efa3a4f9b168dd02fbcc68976ba3)
bb7cd1
---
bb7cd1
 src/confdb/confdb.h                          |  3 +++
bb7cd1
 src/responder/common/responder_get_domains.c | 23 +++++++++++++++++++++++
bb7cd1
 2 files changed, 26 insertions(+)
bb7cd1
bb7cd1
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
bb7cd1
index 8719c239362b371fcdb1b78956bcddde871f141b..797353141edcccbf3341d161ca598c99492e54fe 100644
bb7cd1
--- a/src/confdb/confdb.h
bb7cd1
+++ b/src/confdb/confdb.h
bb7cd1
@@ -351,6 +351,9 @@ struct sss_domain_info {
bb7cd1
     char *forest;
bb7cd1
     struct sss_domain_info *forest_root;
bb7cd1
     const char **upn_suffixes;
bb7cd1
+
bb7cd1
+    struct certmap_info **certmaps;
bb7cd1
+    bool user_name_hint;
bb7cd1
 };
bb7cd1
 
bb7cd1
 /**
bb7cd1
diff --git a/src/responder/common/responder_get_domains.c b/src/responder/common/responder_get_domains.c
bb7cd1
index 8c90b7773e248e1dd6d846c5050e1931fc50c786..155631676d9449f69865919e1b74ee9399607c27 100644
bb7cd1
--- a/src/responder/common/responder_get_domains.c
bb7cd1
+++ b/src/responder/common/responder_get_domains.c
bb7cd1
@@ -224,6 +224,26 @@ immediately:
bb7cd1
     return req;
bb7cd1
 }
bb7cd1
 
bb7cd1
+static void sss_resp_update_certmaps(struct resp_ctx *rctx)
bb7cd1
+{
bb7cd1
+    int ret;
bb7cd1
+    struct certmap_info **certmaps;
bb7cd1
+    bool user_name_hint;
bb7cd1
+    struct sss_domain_info *dom;
bb7cd1
+
bb7cd1
+    for (dom = rctx->domains; dom != NULL; dom = dom->next) {
bb7cd1
+        ret = sysdb_get_certmap(dom, dom->sysdb, &certmaps, &user_name_hint);
bb7cd1
+        if (ret == EOK) {
bb7cd1
+            dom->user_name_hint = user_name_hint;
bb7cd1
+            talloc_free(dom->certmaps);
bb7cd1
+            dom->certmaps = certmaps;
bb7cd1
+        } else {
bb7cd1
+            DEBUG(SSSDBG_OP_FAILURE,
bb7cd1
+                  "sysdb_get_certmap failed for domain [%s].\n", dom->name);
bb7cd1
+        }
bb7cd1
+    }
bb7cd1
+}
bb7cd1
+
bb7cd1
 static void
bb7cd1
 sss_dp_get_domains_process(struct tevent_req *subreq)
bb7cd1
 {
bb7cd1
@@ -267,6 +287,9 @@ sss_dp_get_domains_process(struct tevent_req *subreq)
bb7cd1
                   ret, sss_strerror(ret));
bb7cd1
             goto fail;
bb7cd1
         }
bb7cd1
+
bb7cd1
+        sss_resp_update_certmaps(state->rctx);
bb7cd1
+
bb7cd1
         tevent_req_done(req);
bb7cd1
         return;
bb7cd1
     }
bb7cd1
-- 
bb7cd1
2.9.4
bb7cd1