develop
asamoukin 16 years ago
parent 188e5136a8
commit aa62c44b5e

@ -167,6 +167,30 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
# DN сервисов относительно базового
self.ServicesDN = "ou=Services"
def setDaemonAutostart(self, daemon):
"""Прописывает демона в автозагрузку"""
execStr = "rc-update add %s default" %daemon
textLine = self.execProg(execStr)
if "added to runlevel" in textLine or\
"already installed in runlevel" in textLine:
return True
else:
self.printError(_("ERROR") + ": " + execStr)
self.printError(_("Not added from default runlevel")+ " ...")
return False
def delDaemonAutostart(self, daemon):
"""Прописывает демона в автозагрузку"""
execStr = "rc-update del %s default" %daemon
textLine = self.execProg(execStr)
if "removed from the following runlevels" in textLine or\
"not found in any of the specified runlevels" in textLine:
return True
else:
self.printError(_("ERROR") + ": " + execStr)
self.printError(_("Not deleted from default runlevel")+ " ...")
return False
def runLdapServer(self):
"""Запускает LDAP сервер"""
textLine = self.execProg("/etc/init.d/slapd start")
@ -297,11 +321,12 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
pwdB = getpass.getpass(pwDialog[1]+":")
if (optStdIn and options.has_key(optStdIn)) or\
(optDialog and options.has_key(optDialog)):
if not (pwdA == pwdB):
if not pwdA or not (pwdA == pwdB):
self.printERROR (_("ERROR") + ": " +\
_("password incorrect")+ ": " + _("try again"))
return False
userPwd = pwdA
userPwd = re.sub("(\W)", r"\\\1",userPwd)
return userPwd
def getRunDaemons(self, daemons, printError=False):
@ -2605,7 +2630,13 @@ class servMail(shareLdap):
_("press Y") +", "+ _("if not n")
if not self.dialogYesNo(messDialog):
return True
# останавливаем сервис Mail
# Удаляем из автозапуска демона
if not self.delDaemonAutostart("postfix"):
return False
# Удаляем из автозапуска демона
if not self.delDaemonAutostart("dovecot"):
return False
# останавливаем сервис Mail
if not self.stopServices(["mail"]):
return False
# Подключаемся к LDAP cерверу
@ -2666,6 +2697,12 @@ class servMail(shareLdap):
else:
self.printNotOK(_("Starting") + " " + "Dovecot" + " ...")
return False
# Устанавливаем автозапуск демона
if not self.setDaemonAutostart("postfix"):
return False
# Устанавливаем автозапуск демона
if not self.setDaemonAutostart("dovecot"):
return False
self.clVars.Write("soft_mail_setup","yes")
self.printOK(_("Mail service configured") + " ...")
return True
@ -2874,7 +2911,10 @@ class servSamba(shareLdap):
_("press Y") +", "+ _("if not n")
if not self.dialogYesNo(messDialog):
return True
# останавливаем сервис Samba
# Удаляем из автозапуска демона
if not self.delDaemonAutostart("samba"):
return False
# останавливаем сервис Samba
if not self.stopServices(["samba"]):
return False
# Установим права 777 на директории
@ -2947,6 +2987,11 @@ class servSamba(shareLdap):
print _("Enter the ROOT password")
if not self.addUserSambaServer('root',{'p':""}):
return False
if not self.setDaemonAutostart("slapd"):
return False
# Устанавливаем автозапуск демона
if not self.setDaemonAutostart("samba"):
return False
self.clVars.Write("soft_samba_setup","yes")
self.printOK(_("Samba service configured") + " ...")
return True
@ -3043,9 +3088,6 @@ class servSamba(shareLdap):
" ...")
return False
self.printSUCCESS(_("Modified Samba user password") + " ...")
else:
if not self.modUserUnixServer(userName, options):
return False
return True
class servLdap(shareLdap):
@ -3418,7 +3460,10 @@ class servLdap(shareLdap):
_("press Y") +", "+ _("if not n")
if not self.dialogYesNo(messDialog):
return True
# останавливаем сервисы
# останавливаем сервисы
# Удаляем из автозапуска демона
if not self.delDaemonAutostart("slapd"):
return False
if not self.stopServices(self.getALLServices()):
return False
# Получим путь к ini файлу
@ -3468,6 +3513,9 @@ class servLdap(shareLdap):
ldapParser.setVar("admin",
{"DN":self.clVars.Get("soft_ldap_admin"),
"PASS":self.clVars.Get("soft_ldap_adminpw")})
# Устанавливаем автозапуск демона
if not self.setDaemonAutostart("slapd"):
return False
self.clVars.Write("soft_ldap_setup","yes")
self.printOK(_("LDAP service configured") +" ...")
return True
@ -4150,7 +4198,7 @@ class cl_ldap(shareLdap):
{
'progAccess':(5,),
'helpChapter':_("Examples"),
'help':pcs(" cl-usermod -a test guest samba",
'help':pcs(" cl-usermod -a test guest unix",
self.column_width,
"# " + _("append user guest to the supplemental group test") +\
".",

Loading…
Cancel
Save