Blame SOURCES/0001-SYSDB-Fixing-DB-update.patch

b2d430
From dc8e4131f73d62f23a4be7148e24315adbc550e4 Mon Sep 17 00:00:00 2001
b2d430
From: Petr Cech <pcech@redhat.com>
b2d430
Date: Mon, 20 Jun 2016 09:19:03 -0300
b2d430
Subject: [PATCH 01/18] SYSDB: Fixing DB update
b2d430
MIME-Version: 1.0
b2d430
Content-Type: text/plain; charset=UTF-8
b2d430
Content-Transfer-Encoding: 8bit
b2d430
b2d430
Functions sysdb_user_base_dn() and sysdb_group_base_dn() expect
b2d430
that struct sss_domain_info contains pointer to struct sysdb_ctx.
b2d430
This is not true in case of sysdb_upgrade functions.
b2d430
This patch fixes the situation and revert code to the state before
b2d430
12a000c8c7c07259e438fb1e992134bdd07d9a30 commit.
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/3023
b2d430
b2d430
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
b2d430
Reviewed-by: Sumit Bose <sbose@redhat.com>
b2d430
(cherry picked from commit 311836214245600566f881ff6253594e0999008e)
b2d430
---
b2d430
 src/db/sysdb_upgrade.c | 22 +++++++++++++++++++---
b2d430
 1 file changed, 19 insertions(+), 3 deletions(-)
b2d430
b2d430
diff --git a/src/db/sysdb_upgrade.c b/src/db/sysdb_upgrade.c
b2d430
index 1d2978caee4512856fb64c4798a4b031bf6a3af1..4ca8433f9d5430b038f90563c34cede02393b0b0 100644
b2d430
--- a/src/db/sysdb_upgrade.c
b2d430
+++ b/src/db/sysdb_upgrade.c
b2d430
@@ -443,12 +443,23 @@ int sysdb_check_upgrade_02(struct sss_domain_info *domains,
b2d430
             goto done;
b2d430
         }
b2d430
 
b2d430
-        users_dn = sysdb_user_base_dn(tmp_ctx, dom);
b2d430
+        /*
b2d430
+         * dom->sysdb->ldb is not initialized,
b2d430
+         * so ldb_dn_new_fmt() shouldn't be changed to sysdb_*_base_dn()
b2d430
+         */
b2d430
+        users_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
b2d430
+                                  SYSDB_TMPL_USER_BASE, dom->name);
b2d430
         if (!users_dn) {
b2d430
             ret = ENOMEM;
b2d430
             goto done;
b2d430
         }
b2d430
-        groups_dn = sysdb_group_base_dn(tmp_ctx, dom);
b2d430
+
b2d430
+        /*
b2d430
+         * dom->sysdb->ldb is not initialized,
b2d430
+         * so ldb_dn_new_fmt() shouldn't be changed to sysdb_*_base_dn()
b2d430
+         */
b2d430
+        groups_dn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
b2d430
+                                   SYSDB_TMPL_GROUP_BASE, dom->name);
b2d430
         if (!groups_dn) {
b2d430
             ret = ENOMEM;
b2d430
             goto done;
b2d430
@@ -1045,7 +1056,12 @@ int sysdb_upgrade_10(struct sysdb_ctx *sysdb, struct sss_domain_info *domain,
b2d430
         return ret;
b2d430
     }
b2d430
 
b2d430
-    basedn = sysdb_user_base_dn(tmp_ctx, domain);
b2d430
+    /*
b2d430
+     * dom->sysdb->ldb is not initialized,
b2d430
+     * so ldb_dn_new_fmt() shouldn't be changed to sysdb_*_base_dn()
b2d430
+     */
b2d430
+    basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb,
b2d430
+                            SYSDB_TMPL_USER_BASE, domain->name);
b2d430
     if (basedn == NULL) {
b2d430
         ret = EIO;
b2d430
         goto done;
b2d430
-- 
b2d430
2.4.11
b2d430