dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 57a83eb8657a125d203a335b052d965c7a3b15de Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Mon, 8 Jan 2018 18:22:17 +0100
Subject: [PATCH 92/96] sysdb: add userMappedCertificate to the index
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
(cherry picked from commit 5b78fff78bb44d1af5420db23b02210f755f5f17)
---
 src/db/sysdb_private.h |  1 +
 src/db/sysdb_upgrade.c | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
index cac06ba46da23080d1ab661502d0792bd37b9291..c0a8e29ab9578acb27cf8d1db049c4260904fdda 100644
--- a/src/db/sysdb_private.h
+++ b/src/db/sysdb_private.h
@@ -78,6 +78,7 @@
      "@IDXATTR: canonicalUserPrincipalName\n" \
      "@IDXATTR: uniqueID\n" \
      "@IDXATTR: mail\n" \
+     "@IDXATTR: userMappedCertificate\n" \
      "\n" \
      "dn: @MODULES\n" \
      "@LIST: asq,memberof\n" \
diff --git a/src/db/sysdb_upgrade.c b/src/db/sysdb_upgrade.c
index bc157a24664239bc1255e49a1825243a07acc90f..46df971e98f73dc28bc6764a478f13d871515124 100644
--- a/src/db/sysdb_upgrade.c
+++ b/src/db/sysdb_upgrade.c
@@ -2475,6 +2475,18 @@ int sysdb_upgrade_19(struct sysdb_ctx *sysdb, const char **ver)
         goto done;
     }
 
+    ret = ldb_msg_add_empty(msg, "@IDXATTR", LDB_FLAG_MOD_ADD, NULL);
+    if (ret != LDB_SUCCESS) {
+        ret = ENOMEM;
+        goto done;
+    }
+
+    ret = ldb_msg_add_string(msg, "@IDXATTR", SYSDB_USER_MAPPED_CERT);
+    if (ret != LDB_SUCCESS) {
+        ret = ENOMEM;
+        goto done;
+    }
+
     ret = ldb_modify(sysdb->ldb, msg);
     if (ret != LDB_SUCCESS) {
         ret = sysdb_error_to_errno(ret);
-- 
2.14.3