VirtualMailManager/Handler.py
branchv0.6.x
changeset 285 d30a94f5aef5
parent 283 ea6d052de24a
child 290 e2785e04f92e
equal deleted inserted replaced
284:ec1966828246 285:d30a94f5aef5
    26 from VirtualMailManager.AliasDomain import AliasDomain
    26 from VirtualMailManager.AliasDomain import AliasDomain
    27 from VirtualMailManager.common import exec_ok
    27 from VirtualMailManager.common import exec_ok
    28 from VirtualMailManager.Config import Config as Cfg
    28 from VirtualMailManager.Config import Config as Cfg
    29 from VirtualMailManager.Domain import Domain, ace2idna, get_gid
    29 from VirtualMailManager.Domain import Domain, ace2idna, get_gid
    30 from VirtualMailManager.EmailAddress import EmailAddress
    30 from VirtualMailManager.EmailAddress import EmailAddress
    31 from VirtualMailManager.errors import VMMError, DomainError
    31 from VirtualMailManager.errors import \
       
    32      DomainError, NotRootError, PermissionError, VMMError
    32 from VirtualMailManager.Relocated import Relocated
    33 from VirtualMailManager.Relocated import Relocated
    33 from VirtualMailManager.Transport import Transport
    34 from VirtualMailManager.Transport import Transport
    34 
    35 
    35 
    36 
    36 _ = lambda msg: msg
    37 _ = lambda msg: msg
    92         """Checks the configuration file, returns bool"""
    93         """Checks the configuration file, returns bool"""
    93         self.__findCfgFile()
    94         self.__findCfgFile()
    94         fstat = os.stat(self._cfgFileName)
    95         fstat = os.stat(self._cfgFileName)
    95         fmode = int(oct(fstat.st_mode & 0777))
    96         fmode = int(oct(fstat.st_mode & 0777))
    96         if fmode % 100 and fstat.st_uid != fstat.st_gid or \
    97         if fmode % 100 and fstat.st_uid != fstat.st_gid or \
    97             fmode % 10 and fstat.st_uid == fstat.st_gid:
    98            fmode % 10 and fstat.st_uid == fstat.st_gid:
    98                 raise PermissionError(_(
    99             raise PermissionError(_(u"wrong permissions for '%(file)s': \
    99                     u'fix permissions (%(perms)s) for ā€œ%(file)sā€\n\
   100 %(perms)s\n`chmod 0600 %(file)s` would be great.") %
   100 `chmod 0600 %(file)s` would be great.') % {'file':
   101                                   {'file': self._cfgFileName, 'perms': fmode},
   101                     self._cfgFileName, 'perms': fmode}, ERR.CONF_WRONGPERM)
   102                                   ERR.CONF_WRONGPERM)
   102         else:
   103         else:
   103             return True
   104             return True
   104 
   105 
   105     def _chkenv(self):
   106     def _chkenv(self):
   106         """"""
   107         """"""