# HG changeset patch # User Pascal Volk # Date 1358979398 0 # Node ID 932cd76bf879a8d6d790e9323e4e37910d9913f4 # Parent 06c0acf6c45d6e97560b37abcf6e2bb1109a696c VMM: Dropped support for Dovecot versions before v1.2.0. diff -r 06c0acf6c45d -r 932cd76bf879 VirtualMailManager/account.py --- a/VirtualMailManager/account.py Sun Jan 20 15:50:36 2013 +0000 +++ b/VirtualMailManager/account.py Wed Jan 23 22:16:38 2013 +0000 @@ -292,9 +292,6 @@ `quotalimit` : VirtualMailManager.quotalimit.QuotaLimit the new quota limit of the domain. """ - if cfg_dget('misc.dovecot_version') < 0x10102f00: - raise VMMError(_('PostgreSQL-based dictionary quota requires ' - 'Dovecot >= v1.1.2.'), VMM_ERROR) self._chk_state() if quotalimit == self._qlimit: return diff -r 06c0acf6c45d -r 932cd76bf879 VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Sun Jan 20 15:50:36 2013 +0000 +++ b/VirtualMailManager/cli/subcommands.py Wed Jan 23 22:16:38 2013 +0000 @@ -598,10 +598,10 @@ epilog=fill(_("This subcommand lists all password schemes which " "could be used in the vmm.cfg as value of the " "misc.password_scheme option. The output varies, depending " - "on the used Dovecot version and the system's libc.\nWhen " - "your Dovecot installation isn't too old, you will see " - "additionally a few usable encoding suffixes. One of them can " - "be appended to the password scheme.")), + "on the used Dovecot version and the system's libc.\n" + "Additionally a few usable encoding suffixes will be " + "displayed. One of them can be appended to the password " + "scheme.")), formatter_class=RawDescriptionHelpFormatter) lp.set_defaults(func=list_pwschemes, scmd='listpwschemes') diff -r 06c0acf6c45d -r 932cd76bf879 VirtualMailManager/domain.py --- a/VirtualMailManager/domain.py Sun Jan 20 15:50:36 2013 +0000 +++ b/VirtualMailManager/domain.py Wed Jan 23 22:16:38 2013 +0000 @@ -324,9 +324,6 @@ `force` : bool enforce new quota limit for all accounts, default `False` """ - if cfg_dget('misc.dovecot_version') < 0x10102f00: - raise VMMError(_('PostgreSQL-based dictionary quota requires ' - 'Dovecot >= v1.1.2.'), VMM_ERROR) self._chk_state() assert isinstance(quotalimit, QuotaLimit) if not force and quotalimit == self._qlimit: diff -r 06c0acf6c45d -r 932cd76bf879 VirtualMailManager/password.py --- a/VirtualMailManager/password.py Sun Jan 20 15:50:36 2013 +0000 +++ b/VirtualMailManager/password.py Wed Jan 23 22:16:38 2013 +0000 @@ -182,18 +182,8 @@ """Generates DIGEST-MD5 aka PLAIN-MD5 and LDAP-MD5 hashes.""" md5 = hashlib.md5() if scheme == 'DIGEST-MD5': - # Prior to Dovecot v1.1.12/v1.2.beta2 there was a problem with a - # empty auth_realms setting in dovecot.conf and user@domain.tld - # usernames. So we have to generate different hashes for different - # versions. See also: - # http://dovecot.org/list/dovecot-news/2009-March/000103.html - # http://hg.dovecot.org/dovecot-1.1/rev/2b0043ba89ae - if cfg_dget('misc.dovecot_version') >= 0x1010cf00: - md5.update(user.localpart.encode() + b':' + - user.domainname.encode() + b':') - else: - raise VMMError('You will need Dovecot >= v1.2.0 for proper ' - 'functioning digest-md5 authentication.', VMM_ERROR) + md5.update(user.localpart.encode() + b':' + + user.domainname.encode() + b':') md5.update(password) if (scheme in ('PLAIN-MD5', 'DIGEST-MD5') and encoding in DEFAULT_HEX) or \ (scheme == 'LDAP-MD5' and encoding == 'HEX'): @@ -329,12 +319,11 @@ `schemes` is an iterator for all supported password schemes (depends on the used Dovecot version and features of the libc). - `encodings` is a tuple with all usable encoding suffixes. The tuple may - be empty. + `encodings` is a tuple with all usable encoding suffixes. """ dcv = cfg_dget('misc.dovecot_version') schemes = (k for (k, v) in _scheme_info.items() if v[1] <= dcv) - encodings = ('.B64', '.BASE64', '.HEX') if dcv >= 0x10100a01 else () + encodings = ('.B64', '.BASE64', '.HEX') return schemes, encodings @@ -365,9 +354,6 @@ 'version': version_str(_scheme_info[scheme][1])}, VMM_ERROR) if len(scheme_encoding) > 1: - if cfg_dget('misc.dovecot_version') < 0x10100a01: - raise VMMError(_('Encoding suffixes for password schemes require ' - 'Dovecot >= v1.1.alpha1.'), VMM_ERROR) if scheme_encoding[1] not in ('B64', 'BASE64', 'HEX'): raise VMMError(_("Unsupported password encoding: '%s'") % scheme_encoding[1], VMM_ERROR) diff -r 06c0acf6c45d -r 932cd76bf879 VirtualMailManager/serviceset.py --- a/VirtualMailManager/serviceset.py Sun Jan 20 15:50:36 2013 +0000 +++ b/VirtualMailManager/serviceset.py Wed Jan 23 22:16:38 2013 +0000 @@ -32,7 +32,7 @@ `services` : dict The four services above with boolean values """ - __slots__ = ('_ssid', '_services', '_sieve_col', '_dbh') + __slots__ = ('_ssid', '_services', '_dbh') _kwargs = (('ssid',) + SERVICES) def __init__(self, dbh, **kwargs): @@ -60,10 +60,6 @@ self._dbh = dbh self._ssid = 0 self._services = dict.fromkeys(SERVICES, True) - if cfg_dget('misc.dovecot_version') < 0x10200b02: - self._sieve_col = 'managesieve' - else: - self._sieve_col = 'sieve' for key in kwargs.keys(): if key not in self.__class__._kwargs: @@ -108,8 +104,6 @@ sql = ('SELECT ssid FROM service_set WHERE %s' % ' AND '.join('%s = %s' % (k, str(v).upper()) for k, v in self._services.items())) - if self._sieve_col == 'managesieve': - sql = sql.replace('sieve', self._sieve_col) dbc = self._dbh.cursor() dbc.execute(sql) result = dbc.fetchone() @@ -122,8 +116,8 @@ def _load_by_ssid(self, ssid): """Try to load the service_set by it's primary key.""" dbc = self._dbh.cursor() - dbc.execute('SELECT ssid, smtp, pop3, imap, %s' % (self._sieve_col,) + - ' FROM service_set WHERE ssid = %s', (ssid,)) + dbc.execute('SELECT ssid, smtp, pop3, imap, sieve ' + 'FROM service_set WHERE ssid = %s', (ssid,)) result = dbc.fetchone() dbc.close() if not result: @@ -135,8 +129,7 @@ def _save(self): """Store a new service_set in the database.""" - sql = ('INSERT INTO service_set (ssid, smtp, pop3, imap, %s) ' % - (self._sieve_col,) + + sql = ('INSERT INTO service_set (ssid, smtp, pop3, imap, sieve) ' 'VALUES (%(ssid)s, %(smtp)s, %(pop3)s, %(imap)s, %(sieve)s)') self._set_ssid() values = {'ssid': self._ssid} diff -r 06c0acf6c45d -r 932cd76bf879 doc/web/source/howto/general_subcommands.rst --- a/doc/web/source/howto/general_subcommands.rst Sun Jan 20 15:50:36 2013 +0000 +++ b/doc/web/source/howto/general_subcommands.rst Wed Jan 23 22:16:38 2013 +0000 @@ -207,8 +207,7 @@ The output varies, depending on the used Dovecot version and the system's libc. -When your Dovecot installation isn't too old, you will see additionally -a few usable encoding suffixes. +Additionally a few usable encoding suffixes will be displayed. One of them can be appended to the password scheme. Example: diff -r 06c0acf6c45d -r 932cd76bf879 man/man1/vmm.1 --- a/man/man1/vmm.1 Sun Jan 20 15:50:36 2013 +0000 +++ b/man/man1/vmm.1 Wed Jan 23 22:16:38 2013 +0000 @@ -1,4 +1,4 @@ -.TH "VMM" "1" "2013-01-20" "vmm 0.7" "vmm" +.TH "VMM" "1" "2013-01-23" "vmm 0.7" "vmm" .SH NAME vmm \- command line tool to manage email domains/accounts/aliases .\" ----------------------------------------------------------------------- @@ -362,8 +362,7 @@ The output varies, depending on the used Dovecot version and the system's libc. .br -When your Dovecot installation isn't too old, you will see additionally a -few usable encoding suffixes. +Additionally a few usable encoding suffixes will be displayed. One of them can be appended to the password scheme. .PP Example: