937546
From 24f33237eda1fddd82010b88fe1e8033a4c27976 Mon Sep 17 00:00:00 2001
937546
From: Rob Crittenden <rcritten@redhat.com>
937546
Date: Fri, 20 Sep 2019 15:36:36 -0400
937546
Subject: [PATCH] ipa-restore: Restore ownership and perms on 389-ds log
937546
 directory
937546
937546
Previously it would end up being owned by root:root mode 0755
937546
instead of dirsrv:dirsrv mode 0770.
937546
937546
https://pagure.io/freeipa/issue/7725
937546
937546
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
937546
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
937546
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
937546
---
937546
 ipaserver/install/ipa_restore.py | 6 +++++-
937546
 1 file changed, 5 insertions(+), 1 deletion(-)
937546
937546
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
937546
index 4941831585f473c4937b23b3f59d8ff99a654b0e..917f516c8fa414b23dcb451c9105c59e0afeec51 100644
937546
--- a/ipaserver/install/ipa_restore.py
937546
+++ b/ipaserver/install/ipa_restore.py
937546
@@ -592,11 +592,15 @@ class Restore(admintool.AdminTool):
937546
             logger.info("Waiting for LDIF to finish")
937546
             wait_for_task(conn, dn)
937546
         else:
937546
+            template_dir = paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance
937546
             try:
937546
-                os.makedirs(paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance)
937546
+                os.makedirs(template_dir)
937546
             except OSError as e:
937546
                 pass
937546
 
937546
+            os.chown(template_dir, pent.pw_uid, pent.pw_gid)
937546
+            os.chmod(template_dir, 0o770)
937546
+
937546
             args = [paths.LDIF2DB,
937546
                     '-Z', instance,
937546
                     '-i', ldiffile,
937546
-- 
937546
2.20.1
937546