|
|
|
@ -393,8 +393,9 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
|
|
|
|
|
|
|
|
|
|
def runLdapServer(self):
|
|
|
|
|
"""Запускает LDAP сервер"""
|
|
|
|
|
textLines = self.execProg("/etc/init.d/slapd start",False,False)
|
|
|
|
|
if textLines and "ok" in textLines[-1]:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/slapd start", False, False)
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
self.printNotOK(_("Starting LDAP")+ " ...")
|
|
|
|
@ -403,7 +404,8 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
|
|
|
|
|
def restartLdapServer(self):
|
|
|
|
|
"""Запускает LDAP сервер"""
|
|
|
|
|
textLines = self.execProg("/etc/init.d/slapd restart", False, False)
|
|
|
|
|
if textLines and "ok" in textLines[-1]:
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
self.printNotOK(_("Restarting LDAP")+ " ...")
|
|
|
|
@ -411,8 +413,9 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
|
|
|
|
|
|
|
|
|
|
def stopLdapServer(self):
|
|
|
|
|
"""Останавливает LDAP сервер"""
|
|
|
|
|
textLines = self.execProg("/etc/init.d/slapd stop")
|
|
|
|
|
if textLines and "ok" in textLines[-1]:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/slapd stop", False, False)
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
#self.printOK(_("LDAP stop")+ " ...")
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
@ -500,7 +503,8 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
|
|
|
|
|
if not self.getRunDaemons([daemon]):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/%s start" %(daemon),
|
|
|
|
|
False, False)
|
|
|
|
|
if (not textLines) or textLines and ("ok" in textLines[-1]):
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines):
|
|
|
|
|
self.printERROR( _("Daemon %s was not started") %daemon)
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
@ -607,17 +611,34 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
|
|
|
|
|
_("service is not stopped"))
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
elif service == "mail":
|
|
|
|
|
if self.getRunDaemons(["postfix"]):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/postfix stop", False,
|
|
|
|
|
False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType\
|
|
|
|
|
and "ok" in textLines[-1] or textLines and\
|
|
|
|
|
"ok" in textLines):
|
|
|
|
|
self.printERROR( "Postfix" + " " +
|
|
|
|
|
_("service is not stopped"))
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
if self.getRunDaemons(["dovecot"]):
|
|
|
|
|
textLine = self.execProg("/etc/init.d/dovecot stop")
|
|
|
|
|
if not ("ok" in textLine):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/dovecot stop", False,
|
|
|
|
|
False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and\
|
|
|
|
|
"ok" in textLines):
|
|
|
|
|
self.printERROR(str("Dovecot") + " " +
|
|
|
|
|
_("service is not stopped"))
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
elif service == "jabber":
|
|
|
|
|
if self.getRunService("jabber"):
|
|
|
|
|
textLine = self.execProg("/etc/init.d/ejabberd stop")
|
|
|
|
|
if not ("ok" in textLine):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/ejabberd stop",False,
|
|
|
|
|
False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and\
|
|
|
|
|
"ok" in textLines):
|
|
|
|
|
self.printERROR( "Ejabberd" + " " +
|
|
|
|
|
_("service is not stopped"))
|
|
|
|
|
flagError = True
|
|
|
|
@ -636,24 +657,30 @@ class shareLdap(imp_cl_err, imp_cl_xml, imp_cl_help, imp_cl_smcon):
|
|
|
|
|
break
|
|
|
|
|
elif service == "ftp":
|
|
|
|
|
if self.getRunDaemons(["proftpd"]):
|
|
|
|
|
textLine = self.execProg("/etc/init.d/proftpd stop")
|
|
|
|
|
if not ("ok" in textLine):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/proftpd stop",False,
|
|
|
|
|
False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and\
|
|
|
|
|
"ok" in textLines):
|
|
|
|
|
self.printERROR( "Proftpd" + " " +
|
|
|
|
|
_("service is not stopped"))
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
elif self.getRunService(service):
|
|
|
|
|
stopService = service
|
|
|
|
|
textLine = self.execProg("/etc/init.d/%s stop" %(stopService))
|
|
|
|
|
if not ("ok" in textLine):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/%s stop" %(stopService),
|
|
|
|
|
False, False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines):
|
|
|
|
|
self.printERROR( str(service) + " " +
|
|
|
|
|
_("service is not stopped"))
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
|
if flagLdap:
|
|
|
|
|
if self.getRunService('ldap'):
|
|
|
|
|
textLine = self.execProg("/etc/init.d/slapd stop")
|
|
|
|
|
if not ("ok" in textLine):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/slapd stop",False,False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines):
|
|
|
|
|
self.printERROR( "LDAP" + " " +
|
|
|
|
|
_("service is not stopped"))
|
|
|
|
|
flagError = True
|
|
|
|
@ -3818,14 +3845,16 @@ if you want to continue to run the program again"))
|
|
|
|
|
if not (textLine == None):
|
|
|
|
|
self.printERROR(_("Can not create Postfix aliases") + " ...")
|
|
|
|
|
return False
|
|
|
|
|
textLine = self.execProg("/etc/init.d/postfix start")
|
|
|
|
|
if "ok" in textLine:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/postfix start",False,False)
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
self.printOK(_("Starting") + " " + "Postfix" + " ...")
|
|
|
|
|
else:
|
|
|
|
|
self.printNotOK(_("Starting") + " " + "Postfix" + " ...")
|
|
|
|
|
return False
|
|
|
|
|
textLine = self.execProg("/etc/init.d/dovecot start")
|
|
|
|
|
if "ok" in textLine:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/dovecot start", False, False)
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
self.printOK(_("Starting") + " " + "Dovecot" + " ...")
|
|
|
|
|
else:
|
|
|
|
|
self.printNotOK(_("Starting") + " " + "Dovecot" + " ...")
|
|
|
|
@ -4490,8 +4519,9 @@ class servJabber(shareLdap):
|
|
|
|
|
if not os.path.exists("/etc/jabber/ssl.pem"):
|
|
|
|
|
self.printERROR(_("Can not create Jabber certificate") + " ...")
|
|
|
|
|
return False
|
|
|
|
|
textLine = self.execProg("/etc/init.d/ejabberd start")
|
|
|
|
|
if "ok" in textLine:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/ejabberd start", False, False)
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
self.printOK(_("Starting") + " " + "Ejabberd" + " ...")
|
|
|
|
|
else:
|
|
|
|
|
self.printNotOK(_("Starting") + " " + "Ejabberd" + " ...")
|
|
|
|
@ -5047,8 +5077,9 @@ if %%errorlevel%%==0 NET USE T: \\\\%s\\ftp' %(netbios,netbios,netbios)
|
|
|
|
|
self.printERROR(_("ERROR") + ": " +\
|
|
|
|
|
_("Can not add Samba admin password"))
|
|
|
|
|
return False
|
|
|
|
|
textLine = self.execProg("/etc/init.d/slapd restart")
|
|
|
|
|
if not "ok" in textLine:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/slapd restart", False, False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines):
|
|
|
|
|
self.printNotOK(_("LDAP restart") + " ...")
|
|
|
|
|
return False
|
|
|
|
|
#Cоединение с Ldap (администратор)
|
|
|
|
@ -5074,8 +5105,9 @@ if %%errorlevel%%==0 NET USE T: \\\\%s\\ftp' %(netbios,netbios,netbios)
|
|
|
|
|
print _("LDAP Error") + ": " + self.ldapObj.getError().strip()
|
|
|
|
|
return False
|
|
|
|
|
self.printOK(_("Added ldif file") +" ...")
|
|
|
|
|
textLine = self.execProg("/etc/init.d/samba start")
|
|
|
|
|
if "ok" in textLine:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/samba start", False, False)
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
self.printOK(_("Starting") + " Samba ...")
|
|
|
|
|
else:
|
|
|
|
|
self.printNotOK(_("Starting") + " Samba ...")
|
|
|
|
@ -8001,13 +8033,15 @@ class servFtp(shareLdap):
|
|
|
|
|
if self.clVars.Get("sr_samba_set") == "on":
|
|
|
|
|
if self.getRunService('samba'):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/samba restart",
|
|
|
|
|
False,False)
|
|
|
|
|
if not "ok" in textLines[-1]:
|
|
|
|
|
False, False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines):
|
|
|
|
|
self.printNotOK(_("Restarting") + " Samba ...")
|
|
|
|
|
return False
|
|
|
|
|
else:
|
|
|
|
|
textLine = self.execProg("/etc/init.d/samba start")
|
|
|
|
|
if not "ok" in textLine:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/samba start",False,False)
|
|
|
|
|
if not (textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines):
|
|
|
|
|
self.printNotOK(_("Starting") + " Samba ...")
|
|
|
|
|
return False
|
|
|
|
|
# Подключаемся к LDAP cерверу
|
|
|
|
@ -8040,11 +8074,13 @@ class servFtp(shareLdap):
|
|
|
|
|
{"DN":self.clVars.Get("ld_ftp_dn"),
|
|
|
|
|
"PASS":self.clVars.Get("ld_ftp_pw")})
|
|
|
|
|
self.printOK(_("Added ldif file") +" ...")
|
|
|
|
|
textLines = []
|
|
|
|
|
if self.getRunService('ftp'):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/proftpd restart",False,False)
|
|
|
|
|
else:
|
|
|
|
|
textLines = self.execProg("/etc/init.d/proftpd start",False,False)
|
|
|
|
|
if textLines and "ok" in textLines[-1]:
|
|
|
|
|
if textLines and type(textLines) == types.ListType and\
|
|
|
|
|
"ok" in textLines[-1] or textLines and "ok" in textLines:
|
|
|
|
|
self.printOK(_("Starting") + " " + "Proftpd" + " ...")
|
|
|
|
|
else:
|
|
|
|
|
self.printNotOK(_("Starting") + " " + "Proftpd" + " ...")
|
|
|
|
|