|
|
f9c044 |
From c4b1b8208cd26916dc99b29e09df071c5659b9d4 Mon Sep 17 00:00:00 2001
|
|
|
f9c044 |
From: =?UTF-8?q?Pawe=C5=82=20Po=C5=82awski?= <ppolawsk@redhat.com>
|
|
|
f9c044 |
Date: Wed, 7 Jul 2021 00:29:59 +0200
|
|
|
f9c044 |
Subject: [PATCH 69/71] SYSDB: Add search index "originalADgidNumber"
|
|
|
f9c044 |
MIME-Version: 1.0
|
|
|
f9c044 |
Content-Type: text/plain; charset=UTF-8
|
|
|
f9c044 |
Content-Transfer-Encoding: 8bit
|
|
|
f9c044 |
|
|
|
f9c044 |
Commit 03bc962 introduced a change which can result in
|
|
|
f9c044 |
unindexed search in some scenarios. The result is performance
|
|
|
f9c044 |
drop comparing to older SSSD version.
|
|
|
f9c044 |
|
|
|
f9c044 |
This PR adds missing search index: originalADgidNumber
|
|
|
f9c044 |
|
|
|
f9c044 |
:relnote: Add search index "originalADgidNumber" to SYSDB
|
|
|
f9c044 |
|
|
|
f9c044 |
Resolves: https://github.com/SSSD/sssd/issues/5430
|
|
|
f9c044 |
|
|
|
f9c044 |
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
|
|
|
f9c044 |
Reviewed-by: Tomáš Halman <thalman@redhat.com>
|
|
|
f9c044 |
|
|
|
f9c044 |
(cherry picked with changes from commit 17e339d58c57861c093fc53b241873dce00ae958)
|
|
|
f9c044 |
|
|
|
f9c044 |
Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
|
|
|
f9c044 |
---
|
|
|
f9c044 |
src/db/sysdb.h | 2 ++
|
|
|
f9c044 |
src/db/sysdb_init.c | 7 ++++++
|
|
|
f9c044 |
src/db/sysdb_private.h | 5 +++-
|
|
|
f9c044 |
src/db/sysdb_upgrade.c | 52 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
f9c044 |
4 files changed, 65 insertions(+), 1 deletion(-)
|
|
|
f9c044 |
|
|
|
f9c044 |
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
|
|
|
f9c044 |
index d47099eff..c771ce633 100644
|
|
|
f9c044 |
--- a/src/db/sysdb.h
|
|
|
f9c044 |
+++ b/src/db/sysdb.h
|
|
|
f9c044 |
@@ -176,6 +176,8 @@
|
|
|
f9c044 |
#define OVERRIDE_PREFIX "override"
|
|
|
f9c044 |
#define SYSDB_DEFAULT_OVERRIDE_NAME "defaultOverrideName"
|
|
|
f9c044 |
|
|
|
f9c044 |
+#define SYSDB_ORIG_AD_GID_NUMBER "originalADgidNumber"
|
|
|
f9c044 |
+
|
|
|
f9c044 |
#define SYSDB_AD_ACCOUNT_EXPIRES "adAccountExpires"
|
|
|
f9c044 |
#define SYSDB_AD_USER_ACCOUNT_CONTROL "adUserAccountControl"
|
|
|
f9c044 |
|
|
|
f9c044 |
diff --git a/src/db/sysdb_init.c b/src/db/sysdb_init.c
|
|
|
f9c044 |
index 48e21baab..3632d5a19 100644
|
|
|
f9c044 |
--- a/src/db/sysdb_init.c
|
|
|
f9c044 |
+++ b/src/db/sysdb_init.c
|
|
|
f9c044 |
@@ -566,6 +566,13 @@ static errno_t sysdb_domain_cache_upgrade(TALLOC_CTX *mem_ctx,
|
|
|
f9c044 |
}
|
|
|
f9c044 |
|
|
|
f9c044 |
|
|
|
f9c044 |
+ if (strcmp(version, SYSDB_VERSION_0_21) == 0) {
|
|
|
f9c044 |
+ ret = sysdb_upgrade_21(sysdb, &version);
|
|
|
f9c044 |
+ if (ret != EOK) {
|
|
|
f9c044 |
+ goto done;
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+
|
|
|
f9c044 |
ret = EOK;
|
|
|
f9c044 |
done:
|
|
|
f9c044 |
sysdb->ldb = save_ldb;
|
|
|
f9c044 |
diff --git a/src/db/sysdb_private.h b/src/db/sysdb_private.h
|
|
|
f9c044 |
index 0ccfa43ac..895cc4ea0 100644
|
|
|
f9c044 |
--- a/src/db/sysdb_private.h
|
|
|
f9c044 |
+++ b/src/db/sysdb_private.h
|
|
|
f9c044 |
@@ -23,6 +23,7 @@
|
|
|
f9c044 |
#ifndef __INT_SYS_DB_H__
|
|
|
f9c044 |
#define __INT_SYS_DB_H__
|
|
|
f9c044 |
|
|
|
f9c044 |
+#define SYSDB_VERSION_0_22 "0.22"
|
|
|
f9c044 |
#define SYSDB_VERSION_0_21 "0.21"
|
|
|
f9c044 |
#define SYSDB_VERSION_0_20 "0.20"
|
|
|
f9c044 |
#define SYSDB_VERSION_0_19 "0.19"
|
|
|
f9c044 |
@@ -45,7 +46,7 @@
|
|
|
f9c044 |
#define SYSDB_VERSION_0_2 "0.2"
|
|
|
f9c044 |
#define SYSDB_VERSION_0_1 "0.1"
|
|
|
f9c044 |
|
|
|
f9c044 |
-#define SYSDB_VERSION SYSDB_VERSION_0_21
|
|
|
f9c044 |
+#define SYSDB_VERSION SYSDB_VERSION_0_22
|
|
|
f9c044 |
|
|
|
f9c044 |
#define SYSDB_BASE_LDIF \
|
|
|
f9c044 |
"dn: @ATTRIBUTES\n" \
|
|
|
f9c044 |
@@ -81,6 +82,7 @@
|
|
|
f9c044 |
"@IDXATTR: mail\n" \
|
|
|
f9c044 |
"@IDXATTR: userMappedCertificate\n" \
|
|
|
f9c044 |
"@IDXATTR: ccacheFile\n" \
|
|
|
f9c044 |
+ "@IDXATTR: originalADgidNumber\n" \
|
|
|
f9c044 |
"\n" \
|
|
|
f9c044 |
"dn: @MODULES\n" \
|
|
|
f9c044 |
"@LIST: asq,memberof\n" \
|
|
|
f9c044 |
@@ -174,6 +176,7 @@ int sysdb_upgrade_17(struct sysdb_ctx *sysdb,
|
|
|
f9c044 |
int sysdb_upgrade_18(struct sysdb_ctx *sysdb, const char **ver);
|
|
|
f9c044 |
int sysdb_upgrade_19(struct sysdb_ctx *sysdb, const char **ver);
|
|
|
f9c044 |
int sysdb_upgrade_20(struct sysdb_ctx *sysdb, const char **ver);
|
|
|
f9c044 |
+int sysdb_upgrade_21(struct sysdb_ctx *sysdb, const char **ver);
|
|
|
f9c044 |
|
|
|
f9c044 |
int sysdb_ts_upgrade_01(struct sysdb_ctx *sysdb, const char **ver);
|
|
|
f9c044 |
|
|
|
f9c044 |
diff --git a/src/db/sysdb_upgrade.c b/src/db/sysdb_upgrade.c
|
|
|
f9c044 |
index 392d04b07..6f160f520 100644
|
|
|
f9c044 |
--- a/src/db/sysdb_upgrade.c
|
|
|
f9c044 |
+++ b/src/db/sysdb_upgrade.c
|
|
|
f9c044 |
@@ -2553,6 +2553,58 @@ done:
|
|
|
f9c044 |
return ret;
|
|
|
f9c044 |
}
|
|
|
f9c044 |
|
|
|
f9c044 |
+int sysdb_upgrade_21(struct sysdb_ctx *sysdb, const char **ver)
|
|
|
f9c044 |
+{
|
|
|
f9c044 |
+ struct upgrade_ctx *ctx;
|
|
|
f9c044 |
+ errno_t ret;
|
|
|
f9c044 |
+ struct ldb_message *msg = NULL;
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ ret = commence_upgrade(sysdb, sysdb->ldb, SYSDB_VERSION_0_22, &ctx;;
|
|
|
f9c044 |
+ if (ret) {
|
|
|
f9c044 |
+ return ret;
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ /* Add missing indices */
|
|
|
f9c044 |
+ msg = ldb_msg_new(ctx);
|
|
|
f9c044 |
+ if (msg == NULL) {
|
|
|
f9c044 |
+ ret = ENOMEM;
|
|
|
f9c044 |
+ goto done;
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ msg->dn = ldb_dn_new(msg, sysdb->ldb, "@INDEXLIST");
|
|
|
f9c044 |
+ if (msg->dn == NULL) {
|
|
|
f9c044 |
+ ret = ENOMEM;
|
|
|
f9c044 |
+ goto done;
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ ret = ldb_msg_add_empty(msg, "@IDXATTR", LDB_FLAG_MOD_ADD, NULL);
|
|
|
f9c044 |
+ if (ret != LDB_SUCCESS) {
|
|
|
f9c044 |
+ ret = ENOMEM;
|
|
|
f9c044 |
+ goto done;
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ ret = ldb_msg_add_string(msg, "@IDXATTR", SYSDB_ORIG_AD_GID_NUMBER);
|
|
|
f9c044 |
+ if (ret != LDB_SUCCESS) {
|
|
|
f9c044 |
+ ret = ENOMEM;
|
|
|
f9c044 |
+ goto done;
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ ret = ldb_modify(sysdb->ldb, msg);
|
|
|
f9c044 |
+ if (ret != LDB_SUCCESS) {
|
|
|
f9c044 |
+ ret = sysdb_error_to_errno(ret);
|
|
|
f9c044 |
+ goto done;
|
|
|
f9c044 |
+ }
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ talloc_free(msg);
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+ /* conversion done, update version number */
|
|
|
f9c044 |
+ ret = update_version(ctx);
|
|
|
f9c044 |
+
|
|
|
f9c044 |
+done:
|
|
|
f9c044 |
+ ret = finish_upgrade(ret, &ctx, ver);
|
|
|
f9c044 |
+ return ret;
|
|
|
f9c044 |
+}
|
|
|
f9c044 |
+
|
|
|
f9c044 |
int sysdb_ts_upgrade_01(struct sysdb_ctx *sysdb, const char **ver)
|
|
|
f9c044 |
{
|
|
|
f9c044 |
struct upgrade_ctx *ctx;
|
|
|
f9c044 |
--
|
|
|
f9c044 |
2.26.3
|
|
|
f9c044 |
|