Commit e82e8361 authored by Thomas Gambier's avatar Thomas Gambier

register: no need to be root if configuration file in /tmp

This will be useful for tests.

We don't need to do the chown as root because we created the file with
root account.
parent e5f7985b
......@@ -227,7 +227,8 @@ def slapconfig(conf):
if os.path.dirname(directory) == directory:
break
# Do "chmod g+xro+xr"
os.chmod(directory, os.stat(directory).st_mode | stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH)
if (os.stat(directory).st_mode & (stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH) != stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH):
os.chmod(directory, os.stat(directory).st_mode | stat.S_IXGRP | stat.S_IRGRP | stat.S_IXOTH | stat.S_IROTH)
directory = os.path.dirname(directory)
if not os.path.exists(slap_conf_dir):
......@@ -250,7 +251,6 @@ def slapconfig(conf):
with open(dst, 'w') as destination:
destination.write(''.join(src))
os.chmod(dst, 0o600)
os.chown(dst, 0, 0)
certificate_repository_path = os.path.join(slap_conf_dir, 'ssl', 'partition_pki')
if not os.path.exists(certificate_repository_path):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment