4b8dd5
From 3c4f9e7347965ff9a887147df34e720224ffa7cc Mon Sep 17 00:00:00 2001
4b8dd5
From: Florence Blanc-Renaud <flo@redhat.com>
4b8dd5
Date: Tue, 7 Sep 2021 17:06:53 +0200
4b8dd5
Subject: [PATCH] migrate-ds: workaround to detect compat tree
4b8dd5
4b8dd5
Migrate-ds needs to check if compat tree is enabled before
4b8dd5
migrating users and groups. The check is doing a base
4b8dd5
search on cn=compat,$SUFFIX and considers the compat tree
4b8dd5
enabled when the entry exists.
4b8dd5
4b8dd5
Due to a bug in slapi-nis, the base search may return NotFound
4b8dd5
even though the compat tree is enabled. The workaround is to
4b8dd5
perform a base search on cn=users,cn=compat,$SUFFIX instead.
4b8dd5
4b8dd5
Fixes: https://pagure.io/freeipa/issue/8984
4b8dd5
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
4b8dd5
---
4b8dd5
 ipaserver/plugins/migration.py | 3 ++-
4b8dd5
 1 file changed, 2 insertions(+), 1 deletion(-)
4b8dd5
4b8dd5
diff --git a/ipaserver/plugins/migration.py b/ipaserver/plugins/migration.py
4b8dd5
index db5241915..6ee205fc8 100644
4b8dd5
--- a/ipaserver/plugins/migration.py
4b8dd5
+++ b/ipaserver/plugins/migration.py
4b8dd5
@@ -922,7 +922,8 @@ migration process might be incomplete\n''')
4b8dd5
         # check whether the compat plugin is enabled
4b8dd5
         if not options.get('compat'):
4b8dd5
             try:
4b8dd5
-                ldap.get_entry(DN(('cn', 'compat'), (api.env.basedn)))
4b8dd5
+                ldap.get_entry(DN(('cn', 'users'), ('cn', 'compat'),
4b8dd5
+                                  (api.env.basedn)))
4b8dd5
                 return dict(result={}, failed={}, enabled=True, compat=False)
4b8dd5
             except errors.NotFound:
4b8dd5
                 pass
4b8dd5
-- 
4b8dd5
2.31.1
4b8dd5