summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJohannes Graumann <johannes_graumann@web.de>2012-10-15 23:02:06 +0300
committerJohannes Graumann <johannes_graumann@web.de>2012-10-15 23:02:06 +0300
commit8624fe67b992c9a1f5d6e9b4c2f88eeaaafc67f0 (patch)
tree7b99399b21307c246245fbf53f8636fa5a0e95c5 /pykolab
parent87a93c748fb5b1591a9e26e6cd377e22f54706d0 (diff)
downloadpykolab-8624fe67b992c9a1f5d6e9b4c2f88eeaaafc67f0.tar.gz
Debianize: Check for existence of Debian-specific 'dirsrv' user and use for user/group default if present;
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_ldap.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py
index b28ac49..442ca6b 100644
--- a/pykolab/setup/setup_ldap.py
+++ b/pykolab/setup/setup_ldap.py
@@ -21,6 +21,7 @@ import gzip
import ldap
import ldap.modlist
import os
+import pwd
import shutil
import subprocess
import tempfile
@@ -110,14 +111,26 @@ def execute(*args, **kw):
""")
)
- _input['userid'] = utils.ask_question(_("User"), default="nobody")
- _input['group'] = utils.ask_question(_("Group"), default="nobody")
+ try:
+ pw = pwd.getpwnam("dirsrv")
+ except:
+ _input['userid'] = utils.ask_question(_("User"), default="nobody")
+ _input['group'] = utils.ask_question(_("Group"), default="nobody")
+ else:
+ _input['userid'] = utils.ask_question(_("User"), default="dirsrv")
+ _input['group'] = utils.ask_question(_("Group"), default="dirsrv")
else:
_input['admin_pass'] = conf.get('ldap', 'bind_pw')
_input['dirmgr_pass'] = conf.get('ldap', 'bind_pw')
- _input['userid'] = "nobody"
- _input['group'] = "nobody"
+ try:
+ pw = pwd.getpwnam("dirsrv")
+ except:
+ _input['userid'] = "nobody"
+ _input['group'] = "nobody"
+ else:
+ _input['userid'] = "dirsrv"
+ _input['group'] = "dirsrv"
# TODO: Verify the user and group exist.