|
|
|
@ -606,17 +606,6 @@ 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
|
|
|
|
|
elif service == "mail":
|
|
|
|
|
if self.getRunDaemons(["postfix"]):
|
|
|
|
|
textLines = self.execProg("/etc/init.d/postfix stop", False,
|
|
|
|
@ -3250,6 +3239,11 @@ for user %s in 'Replicatinon/Mail' branch ...") %userName)
|
|
|
|
|
altMails = options['e'].split(",")
|
|
|
|
|
for altMail in altMails:
|
|
|
|
|
if "@" in altMail:
|
|
|
|
|
if "@" in altMail:
|
|
|
|
|
if altMail.split("@") != 2:
|
|
|
|
|
self.printERROR(_("Incorrect alternate adresses \
|
|
|
|
|
option '-e'"))
|
|
|
|
|
return False
|
|
|
|
|
mail = altMail
|
|
|
|
|
else:
|
|
|
|
|
mail = "%s@%s" %(altMail,self.clVars.Get("sr_mail_host"))
|
|
|
|
@ -3509,6 +3503,10 @@ for user %s in 'Replicatinon/Mail' branch ...") %str(primaryMail))
|
|
|
|
|
altMails = options['e'].split(",")
|
|
|
|
|
for altMail in altMails:
|
|
|
|
|
if "@" in altMail:
|
|
|
|
|
if altMail.split("@") != 2:
|
|
|
|
|
self.printERROR(_("Incorrect alternate adresses option \
|
|
|
|
|
'-e'"))
|
|
|
|
|
return False
|
|
|
|
|
mail = altMail
|
|
|
|
|
else:
|
|
|
|
|
mail = "%s@%s" %(altMail,self.clVars.Get("sr_mail_host"))
|
|
|
|
@ -3516,7 +3514,7 @@ for user %s in 'Replicatinon/Mail' branch ...") %str(primaryMail))
|
|
|
|
|
primaryMail = mail
|
|
|
|
|
if self.searchUserToMail(mail) or\
|
|
|
|
|
self.searchGroupToMail(mail):
|
|
|
|
|
self.printERROR(
|
|
|
|
|
self.printERROR(\
|
|
|
|
|
_("Alternate email address %s is found in Mail service")%\
|
|
|
|
|
str(mail) + " ...")
|
|
|
|
|
return False
|
|
|
|
@ -3723,7 +3721,6 @@ if you want to continue to run the program again"))
|
|
|
|
|
self.clVars.Set("sr_mail_net_allow",
|
|
|
|
|
self.clVars.Get("os_net_allow").replace(",",", "),
|
|
|
|
|
True)
|
|
|
|
|
|
|
|
|
|
if self.clVars.Get("sr_unix_set") != "on":
|
|
|
|
|
self.printERROR(_("Unix service is not setuped"))
|
|
|
|
|
self.printWARNING(_("Setup Unix service"))
|
|
|
|
@ -5323,36 +5320,27 @@ if %%errorlevel%%==0 NET USE T: \\\\%s\\ftp' %(netbios,netbios,netbios)
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
class filterProfiles(cl_profile.profile):
|
|
|
|
|
def __init__(self, objVar, servDir=False, dirFilter=[],
|
|
|
|
|
fileFilter=[]):
|
|
|
|
|
self.dirFilter = dirFilter
|
|
|
|
|
self.fileFilter = fileFilter
|
|
|
|
|
"""Класс для фильтрации налагаемых профилей"""
|
|
|
|
|
def __init__(self, objVar, servDir=False, dirsFilter=[],
|
|
|
|
|
filesFilter=[]):
|
|
|
|
|
self.dirsFilter = dirsFilter
|
|
|
|
|
self.filesFilter = filesFilter
|
|
|
|
|
cl_profile.profile.__init__(self, objVar, servDir)
|
|
|
|
|
|
|
|
|
|
def scanDirs(self, profilesDirs):
|
|
|
|
|
"""Измененный метод сканирования директорий"""
|
|
|
|
|
rez = cl_profile.profile.scanDirs(self, profilesDirs)
|
|
|
|
|
if rez and (dirFilter or fileFilter):
|
|
|
|
|
if rez and (self.dirsFilter or self.filesFilter):
|
|
|
|
|
for obj in rez:
|
|
|
|
|
dirs = []
|
|
|
|
|
dirsRel = []
|
|
|
|
|
for dirName in obj.dirs:
|
|
|
|
|
oldDir = dirName.split(obj.baseDir)[1]
|
|
|
|
|
if not oldDir in self.dirFilter:
|
|
|
|
|
if not oldDir in self.dirsFilter:
|
|
|
|
|
dirs.append(dirName)
|
|
|
|
|
dirsRel.append(oldDir)
|
|
|
|
|
files = []
|
|
|
|
|
for fileName in obj.files:
|
|
|
|
|
oldFile = fileName.split(obj.baseDir)[1]
|
|
|
|
|
dirName,fileName = os.path.split(oldFile)
|
|
|
|
|
if dirName in dirsRel:
|
|
|
|
|
fileName = fileName.split("?")[0]
|
|
|
|
|
oldFile = os.path.join(dirName, fileName)
|
|
|
|
|
if not oldFile in self.fileFilter:
|
|
|
|
|
files.append(fileName)
|
|
|
|
|
obj.dirs = dirs
|
|
|
|
|
obj.files = files
|
|
|
|
|
|
|
|
|
|
return rez
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class servLdap(shareLdap):
|
|
|
|
|
"""Методы севисa Ldap"""
|
|
|
|
@ -5526,11 +5514,12 @@ outdated. If the backup is obsolete, use cl-backup."))
|
|
|
|
|
"""Перегенерирует конфигурационные файлы, и базу данных LDAP"""
|
|
|
|
|
return self.rebuildServer(options)
|
|
|
|
|
|
|
|
|
|
def applyProfilesFromService(self, service, verbose=False):
|
|
|
|
|
def applyProfilesFromService(self, service, verbose=False, dirsFilter = [],
|
|
|
|
|
filesFilter = []):
|
|
|
|
|
"""Применяем профили для данного сервиса"""
|
|
|
|
|
# Cоздаем объект профиль устанавливая директорию
|
|
|
|
|
# service для файлов профилей
|
|
|
|
|
clProf = filterProfiles(self.clVars,service)
|
|
|
|
|
clProf = filterProfiles(self.clVars,service, dirsFilter, filesFilter)
|
|
|
|
|
# Объединяем профили
|
|
|
|
|
data = clProf.applyProfiles()
|
|
|
|
|
if clProf.getError():
|
|
|
|
@ -5683,7 +5672,17 @@ it was added by the calculate-server")
|
|
|
|
|
self.clVars.Get("sr_mail_relay_set") == "on":
|
|
|
|
|
flagMailRelay = True
|
|
|
|
|
if not flagError:
|
|
|
|
|
files = self.applyProfilesFromService(service, verbose)
|
|
|
|
|
if flagMailRelay:
|
|
|
|
|
files = self.applyProfilesFromService(service, verbose,
|
|
|
|
|
["/etc/dovecot",
|
|
|
|
|
"/etc/ssl/dovecot"],
|
|
|
|
|
["/etc/procmailrc",
|
|
|
|
|
"/etc/postfix/ldap-aliases-gr.cf",
|
|
|
|
|
"/etc/postfix/ldap-aliases.cf",
|
|
|
|
|
"/etc/postfix/ldap-recipient-gr.cf",
|
|
|
|
|
"/etc/postfix/ldap-recipient.cf"])
|
|
|
|
|
else:
|
|
|
|
|
files = self.applyProfilesFromService(service, verbose)
|
|
|
|
|
if not files:
|
|
|
|
|
flagError = True
|
|
|
|
|
break
|
|
|
|
@ -5779,6 +5778,10 @@ it was added by the calculate-server")
|
|
|
|
|
for dirObj in dirObjs:
|
|
|
|
|
for fileProfile in dirObj.files:
|
|
|
|
|
archFile = fileProfile.split(servicePaths[i])[1]
|
|
|
|
|
if "?" in archFile:
|
|
|
|
|
dirName, fileName = os.path.split(archFile)
|
|
|
|
|
fileName = fileName.split("?")[0]
|
|
|
|
|
archFile = os.path.join(dirName, fileName)
|
|
|
|
|
allArchFiles.append(archFile)
|
|
|
|
|
i += 1
|
|
|
|
|
return allArchFiles
|
|
|
|
@ -6063,6 +6066,7 @@ it was added by the calculate-server")
|
|
|
|
|
allArchFiles.append(additFile)
|
|
|
|
|
allArchFiles.append(self.archLdifFile)
|
|
|
|
|
allArchFiles = self.unicList(allArchFiles)
|
|
|
|
|
|
|
|
|
|
# В случае репликации сохраняем файлы (список файлов, ldif - файл)
|
|
|
|
|
if replServices:
|
|
|
|
|
if "samba" in replServices:
|
|
|
|
@ -6146,6 +6150,25 @@ it was added by the calculate-server")
|
|
|
|
|
str(self.archLdifFileMail))
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
#Сохраняемые файлы в случае почтового релея
|
|
|
|
|
if self.clVars.Get("sr_mail_set") == "on" and\
|
|
|
|
|
self.clVars.Get("ld_repl_mail_set") == 'on' and\
|
|
|
|
|
self.clVars.Get("sr_mail_relay_set") == "on":
|
|
|
|
|
dirsFilter = ["/etc/dovecot",
|
|
|
|
|
"/etc/ssl/dovecot"]
|
|
|
|
|
filesFilter = ["/etc/procmailrc",
|
|
|
|
|
"/etc/postfix/ldap-aliases-gr.cf",
|
|
|
|
|
"/etc/postfix/ldap-aliases.cf",
|
|
|
|
|
"/etc/postfix/ldap-recipient-gr.cf",
|
|
|
|
|
"/etc/postfix/ldap-recipient.cf"]
|
|
|
|
|
files = []
|
|
|
|
|
for fileName in allArchFiles:
|
|
|
|
|
dirName, fileN = os.path.split(fileName)
|
|
|
|
|
if not dirName in dirsFilter and\
|
|
|
|
|
not fileName in filesFilter:
|
|
|
|
|
files.append(fileName)
|
|
|
|
|
allArchFiles = files
|
|
|
|
|
|
|
|
|
|
# Сохраняем файл список архивируемых файлов
|
|
|
|
|
if not self.savePrivateFile (self.tmpListFile,
|
|
|
|
|
"\n".join(allArchFiles)):
|
|
|
|
|