pgsql: Added support for different mailbox formats.
- users.passwd can store sha512-crypt.hex hashes now
- Added new update scripts.
# -*- coding: UTF-8 -*-# Copyright (c) 2010, Pascal Volk# See COPYING for distribution information.""" VirtualMailManager.cli.Handler A derived Handler class with a few changes/additions for cli use."""importosfromVirtualMailManager.errorsimportVMMErrorfromVirtualMailManager.HandlerimportHandlerfromVirtualMailManager.cliimportread_passfromVirtualMailManager.cli.ConfigimportCliConfigasCfgfromVirtualMailManager.constants.ERRORimportINVALID_SECTION_=lambdamsg:msgclassCliHandler(Handler):"""This class uses a `CliConfig` for configuration stuff, instead of the non-interactive `Config` class. It provides the additional methods cfgSet() and configure(). Additionally it uses `VirtualMailManager.cli.read_pass()` for for the interactive password dialog. """__slots__=()# nothing additional, also no __dict__/__weakref__def__init__(self):"""Creates a new CliHandler instance. Throws a NotRootError if your uid is greater 0. """# Overwrite the parent CTor partly, we use the CliConfig class# and add some command line checks.skip_some_checks=os.sys.argv[1]in('cf','configure','h','help','v','version')super(CliHandler,self).__init__(skip_some_checks)self._Cfg=Cfg(self._cfgFileName)self._Cfg.load()ifnotskip_some_checks:self._Cfg.check()self._chkenv()defcfgSet(self,option,value):returnself._Cfg.set(option,value)defconfigure(self,section=None):"""Starts the interactive configuration. Configures in interactive mode options in the given ``section``. If no section is given (default) all options from all sections will be prompted. """ifsectionisNone:self._Cfg.configure(self._Cfg.sections())elifself._Cfg.has_section(section):self._Cfg.configure([section])else:raiseVMMError(_(u'Invalid section: “%s”')%section,INVALID_SECTION)defuser_add(self,emailaddress,password=None):"""Prefix the parent user_add() with the interactive password dialog."""ifpasswordisNone:password=read_pass()super(CliHandler,self).user_add(emailaddress,password)defuser_password(self,emailaddress,password=None):"""Prefix the parent user_password() with the interactive password dialog."""ifpasswordisNone:password=read_pass()super(CliHandler,self).user_password(emailaddress,password)del_