# HG changeset patch # User Pascal Volk # Date 1221619396 0 # Node ID b3debcfea7bc275c120c0d7c83f4d419994d6678 # Parent f9090d1a0730eb8ef71914d2cc43f5481dce7b54 * 'VirtualMailManager/Alias.py' - Implemented Alias._checkExpansion() in order to prevent the exceeding of Postfix' virtual_alias_expansion_limit * 'po/de.po' * 'po/vmm.pot' - updated diff -r f9090d1a0730 -r b3debcfea7bc TODO --- a/TODO Tue Sep 16 20:03:09 2008 +0000 +++ b/TODO Wed Sep 17 02:43:16 2008 +0000 @@ -2,7 +2,6 @@ - Aliases - avoid looping aliases - - avoid number of alias destinations > virtual_alias_expansion_limit - Domain - optional limits for number of: diff -r f9090d1a0730 -r b3debcfea7bc VirtualMailManager/Alias.py --- a/VirtualMailManager/Alias.py Tue Sep 16 20:03:09 2008 +0000 +++ b/VirtualMailManager/Alias.py Wed Sep 17 02:43:16 2008 +0000 @@ -66,11 +66,26 @@ raise VMMAE(_(u"The domain »%s« doesn't exist yet.") %\ self._addr._domainname, ERR.NO_SUCH_DOMAIN) - def save(self): + def _checkExpansion(self, limit): + dbc = self._dbh.cursor() + dbc.execute('SELECT count(gid) FROM alias where gid=%s AND address=%s', + self._gid, self._addr._localpart) + curEx = dbc.fetchone()[0] + dbc.close() + if curEx == limit: + errmsg = _(u"""Can't add new destination to alias »%(address)s«. +Currently this alias expands into %(count)i recipients. +One destination more will render this alias unusable. +Hint: Increase Postfix' virtual_alias_expansion_limit +""") % {'address': self._addr, 'count': curEx} + raise VMMAE(errmsg, ERR.ALIAS_EXCEEDS_EXPANSION_LIMIT) + + def save(self, expansion_limit): if self._dest is None: raise VMMAE(_(u"No destination address for alias denoted."), ERR.ALIAS_MISSING_DEST) if self._isNew: + self._checkExpansion(expansion_limit) dbc = self._dbh.cursor() dbc.execute("INSERT INTO alias (gid, address, destination) VALUES\ (%s, %s, %s)", self._gid, self._addr._localpart, str(self._dest)) diff -r f9090d1a0730 -r b3debcfea7bc VirtualMailManager/VirtualMailManager.py --- a/VirtualMailManager/VirtualMailManager.py Tue Sep 16 20:03:09 2008 +0000 +++ b/VirtualMailManager/VirtualMailManager.py Wed Sep 17 02:43:16 2008 +0000 @@ -63,6 +63,7 @@ self.__Cfg.check() self.__cfgSections = self.__Cfg.getsections() self.__scheme = self.__Cfg.get('misc', 'passwdscheme') + self._postconf = Postconf(self.__Cfg.get('bin', 'postconf')) if not sys.argv[1] in ['cf', 'configure']: self.__chkenv() @@ -601,7 +602,7 @@ def aliasAdd(self, aliasaddress, targetaddress): alias = self.__getAlias(aliasaddress, targetaddress) - alias.save() + alias.save(long(self._postconf.read('virtual_alias_expansion_limit'))) gid = self.__getDomain(alias._dest._domainname).getID() if gid > 0 and not VirtualMailManager.accountExists(self.__dbh, alias._dest) and not VirtualMailManager.aliasExists(self.__dbh, diff -r f9090d1a0730 -r b3debcfea7bc VirtualMailManager/constants/ERROR.py --- a/VirtualMailManager/constants/ERROR.py Tue Sep 16 20:03:09 2008 +0000 +++ b/VirtualMailManager/constants/ERROR.py Wed Sep 17 02:43:16 2008 +0000 @@ -10,41 +10,42 @@ ALIASDOMAIN_ISDOMAIN = 24 ALIASDOMAIN_NO_DOMDEST = 25 ALIAS_ADDR_DEST_IDENTICAL = 26 -ALIAS_EXISTS = 27 -ALIAS_MISSING_DEST = 28 -ALIAS_PRESENT = 29 -CONF_ERROR = 30 -CONF_NOFILE = 31 -CONF_NOPERM = 32 -CONF_WRONGPERM = 33 -DATABASE_ERROR = 34 -DOMAINDIR_GROUP_MISMATCH = 35 -DOMAIN_ALIAS_EXISTS = 36 -DOMAIN_EXISTS = 37 -DOMAIN_INVALID = 38 -DOMAIN_NO_NAME = 39 -DOMAIN_TOO_LONG = 40 -FOUND_DOTS_IN_PATH = 41 -INVALID_ADDRESS = 42 -INVALID_AGUMENT = 43 -INVALID_OPTION = 44 -INVALID_SECTION = 45 -LOCALPART_INVALID = 46 -LOCALPART_TOO_LONG = 47 -MAILDIR_PERM_MISMATCH = 48 -MAILLOCATION_INIT = 49 -NOT_EXECUTABLE = 50 -NO_SUCH_ACCOUNT = 51 -NO_SUCH_ALIAS = 52 -NO_SUCH_ALIASDOMAIN = 53 -NO_SUCH_BINARY = 54 -NO_SUCH_DIRECTORY = 55 -NO_SUCH_DOMAIN = 56 -NO_SUCH_RELOCATED = 57 -RELOCATED_ADDR_DEST_IDENTICAL = 58 -RELOCATED_EXISTS = 59 -RELOCATED_MISSING_DEST = 60 -TRANSPORT_INIT = 61 -UNKNOWN_MAILLOCATION_ID = 62 -UNKNOWN_SERVICE = 63 -UNKNOWN_TRANSPORT_ID = 64 +ALIAS_EXCEEDS_EXPANSION_LIMIT = 27 +ALIAS_EXISTS = 28 +ALIAS_MISSING_DEST = 29 +ALIAS_PRESENT = 30 +CONF_ERROR = 31 +CONF_NOFILE = 32 +CONF_NOPERM = 33 +CONF_WRONGPERM = 34 +DATABASE_ERROR = 35 +DOMAINDIR_GROUP_MISMATCH = 36 +DOMAIN_ALIAS_EXISTS = 37 +DOMAIN_EXISTS = 38 +DOMAIN_INVALID = 39 +DOMAIN_NO_NAME = 40 +DOMAIN_TOO_LONG = 41 +FOUND_DOTS_IN_PATH = 42 +INVALID_ADDRESS = 43 +INVALID_AGUMENT = 44 +INVALID_OPTION = 45 +INVALID_SECTION = 46 +LOCALPART_INVALID = 47 +LOCALPART_TOO_LONG = 48 +MAILDIR_PERM_MISMATCH = 49 +MAILLOCATION_INIT = 50 +NOT_EXECUTABLE = 51 +NO_SUCH_ACCOUNT = 52 +NO_SUCH_ALIAS = 53 +NO_SUCH_ALIASDOMAIN = 54 +NO_SUCH_BINARY = 55 +NO_SUCH_DIRECTORY = 56 +NO_SUCH_DOMAIN = 57 +NO_SUCH_RELOCATED = 58 +RELOCATED_ADDR_DEST_IDENTICAL = 59 +RELOCATED_EXISTS = 60 +RELOCATED_MISSING_DEST = 61 +TRANSPORT_INIT = 62 +UNKNOWN_MAILLOCATION_ID = 63 +UNKNOWN_SERVICE = 64 +UNKNOWN_TRANSPORT_ID = 65 diff -r f9090d1a0730 -r b3debcfea7bc po/de.po --- a/po/de.po Tue Sep 16 20:03:09 2008 +0000 +++ b/po/de.po Wed Sep 17 02:43:16 2008 +0000 @@ -6,8 +6,8 @@ msgstr "" "Project-Id-Version: vmm 0.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-09-12 23:18+0200\n" -"PO-Revision-Date: 2008-09-12 23:20+0200\n" +"POT-Creation-Date: 2008-09-17 04:20+0200\n" +"PO-Revision-Date: 2008-09-17 04:32+0200\n" "Last-Translator: Pascal Volk \n" "Language-Team: German\n" "MIME-Version: 1.0\n" @@ -83,16 +83,29 @@ msgid "There is already an account with address »%s«." msgstr "Es gibt bereits einen Account mit der Adresse »%s«." -#: VirtualMailManager/Alias.py:71 +#: VirtualMailManager/Alias.py:76 +#, python-format +msgid "" +"Can't add new destination to alias »%(address)s«.\n" +"Currently this alias expands into %(count)i recipients.\n" +"One destination more will render this alias unusable.\n" +"Hint: Increase Postfix' virtual_alias_expansion_limit\n" +msgstr "" +"Dem Alias »%(address)s« kann keine weitere Ziel-Adresse hinzugefügt werden.\n" +"Derzeit verweist der Alias auf %(count)i Empfänger.\n" +"Eine weitere Ziel-Adresse würde diesen Alias unbrauchbar machen.\n" +"Tipp: Erhöhen Sie Postfix' virtual_alias_expansion_limit\n" + +#: VirtualMailManager/Alias.py:85 msgid "No destination address for alias denoted." msgstr "Keine Ziel-Adresse für den Alias angegeben." -#: VirtualMailManager/Alias.py:81 +#: VirtualMailManager/Alias.py:96 #, python-format msgid "The alias »%(a)s« with destination »%(d)s« already exists." msgstr "Der Alias »%(a)s« mit der Ziel-Adresse »%(d)s« existiert bereits." -#: VirtualMailManager/Alias.py:96 +#: VirtualMailManager/Alias.py:111 #, python-format msgid "The alias »%s« doesn't exists." msgstr "Der Alias »%s« existiert nicht." @@ -213,7 +226,7 @@ msgid "mid must be an int/long." msgstr "Die MID muss eine Ganzzahl sein." -#: VirtualMailManager/MailLocation.py:52 +#: VirtualMailManager/MailLocation.py:51 #, python-format msgid "" "Invalid folder name »%s«, it may consist only of\n" @@ -222,7 +235,7 @@ "Unzulässiger Verzeichnisname »%s«, dieser darf nur aus\n" "1 - 20 Einzelbytezeichen (A-Z, a-z, 0-9 und _) bestehen." -#: VirtualMailManager/MailLocation.py:65 +#: VirtualMailManager/MailLocation.py:64 msgid "Unknown mid specified." msgstr "Unbekannte MID angegeben." @@ -252,7 +265,7 @@ msgid "Unknown tid specified." msgstr "Unbekannte tid angegeben." -#: VirtualMailManager/VirtualMailManager.py:49 +#: VirtualMailManager/VirtualMailManager.py:50 #, python-format msgid "" "fix permissions for »%(cfgFileName)s«\n" @@ -261,7 +274,7 @@ "Bitte Zugriffsrechte für »%(cfgFileName)s« anpassen\n" "`chmod 0600 %(cfgFileName)s` wäre großartig." -#: VirtualMailManager/VirtualMailManager.py:57 +#: VirtualMailManager/VirtualMailManager.py:58 msgid "" "You are not root.\n" "\tGood bye!\n" @@ -269,12 +282,12 @@ "Sie sind nicht root.\n" "\tAuf Wiedersehen.\n" -#: VirtualMailManager/VirtualMailManager.py:71 +#: VirtualMailManager/VirtualMailManager.py:73 #, python-format msgid "The file »%s« does not exists." msgstr "Die Datei »%s« existiert nicht." -#: VirtualMailManager/VirtualMailManager.py:90 +#: VirtualMailManager/VirtualMailManager.py:92 #, python-format msgid "" "»%s« is not a directory.\n" @@ -283,7 +296,7 @@ "»%s« ist kein Verzeichnis.\n" "(vmm.cfg: Abschnitt \"domdir\", Option \"base\")" -#: VirtualMailManager/VirtualMailManager.py:95 +#: VirtualMailManager/VirtualMailManager.py:97 #, python-format msgid "" "»%(binary)s« doesn't exists.\n" @@ -292,7 +305,7 @@ "»%(binary)s« existiert nicht.\n" "(vmm.cfg: Abschnitt \"bin\", Option \"%(option)s\")" -#: VirtualMailManager/VirtualMailManager.py:99 +#: VirtualMailManager/VirtualMailManager.py:101 #, python-format msgid "" "»%(binary)s« is not executable.\n" @@ -301,7 +314,7 @@ "»%(binary)s« ist nicht ausführbar.\n" "(vmm.cfg: Abschnitt \"bin\", Option \"%(option)s\")" -#: VirtualMailManager/VirtualMailManager.py:157 +#: VirtualMailManager/VirtualMailManager.py:158 msgid "The domain name is too long." msgstr "Der Domain-Name ist zu lang." @@ -327,28 +340,28 @@ msgstr "Entschuldigung, leere Passwörter sind nicht zulässig" #: VirtualMailManager/VirtualMailManager.py:256 -#: VirtualMailManager/VirtualMailManager.py:344 +#: VirtualMailManager/VirtualMailManager.py:343 #, python-format msgid "No such directory: %s" msgstr "Verzeichnis nicht gefunden: %s" -#: VirtualMailManager/VirtualMailManager.py:332 +#: VirtualMailManager/VirtualMailManager.py:331 msgid "Found \"..\" in home directory path." msgstr "\"..\" im Pfad zum Benutzerverzeichnis entdeckt." -#: VirtualMailManager/VirtualMailManager.py:340 +#: VirtualMailManager/VirtualMailManager.py:339 msgid "Owner/group mismatch in home directory detected." msgstr "Benutzerverzeichnis gehört dem/der falschen Benutzer/Gruppe." -#: VirtualMailManager/VirtualMailManager.py:355 +#: VirtualMailManager/VirtualMailManager.py:354 msgid "FATAL: \"..\" in domain directory path detected." msgstr "FATAL: \"..\" im Pfad zum Domain-Verzeichnis entdeckt." -#: VirtualMailManager/VirtualMailManager.py:361 +#: VirtualMailManager/VirtualMailManager.py:360 msgid "FATAL: group mismatch in domain directory detected" msgstr "FATAL: Domain-Verzeichnis gehört der falschen Gruppe" -#: VirtualMailManager/VirtualMailManager.py:448 +#: VirtualMailManager/VirtualMailManager.py:447 #, python-format msgid "" "Configurtion error: \"%s\"\n" @@ -357,24 +370,24 @@ "Konfigurations Fehler: \"%s\"\n" "(im Abschnitt \"connfig\", Option \"done\") Siehe auch: vmm.cfg(5)\n" -#: VirtualMailManager/VirtualMailManager.py:468 +#: VirtualMailManager/VirtualMailManager.py:467 #, python-format msgid "Invalid section: '%s'" msgstr "Ungültiger Abschnitt: '%s'" -#: VirtualMailManager/VirtualMailManager.py:478 +#: VirtualMailManager/VirtualMailManager.py:477 #, python-format msgid "Invalid argument: '%s'" msgstr "Ungültiges Argument: '%s'" -#: VirtualMailManager/VirtualMailManager.py:488 -#: VirtualMailManager/VirtualMailManager.py:507 -#: VirtualMailManager/VirtualMailManager.py:618 +#: VirtualMailManager/VirtualMailManager.py:487 +#: VirtualMailManager/VirtualMailManager.py:506 +#: VirtualMailManager/VirtualMailManager.py:616 #, python-format msgid "Invalid argument: »%s«" msgstr "Ungültiges Argument: »%s«" -#: VirtualMailManager/VirtualMailManager.py:511 +#: VirtualMailManager/VirtualMailManager.py:510 msgid "" "The keyword »detailed« is deprecated and will be removed in a future " "release.\n" @@ -384,17 +397,17 @@ " Version entfernt werden.\n" " Verwenden Sie bitte das Schlüsselwort »full«, um alle Details zu erhalten." -#: VirtualMailManager/VirtualMailManager.py:588 +#: VirtualMailManager/VirtualMailManager.py:586 #, python-format msgid "The pattern »%s« contains invalid characters." msgstr "Das Muster »%s« enthält ungültige Zeichen." -#: VirtualMailManager/VirtualMailManager.py:613 +#: VirtualMailManager/VirtualMailManager.py:611 #, python-format msgid "The destination account/alias »%s« doesn't exists yet." msgstr "Der Ziel-Account/-Alias »%s« existiert noch nicht." -#: VirtualMailManager/VirtualMailManager.py:630 +#: VirtualMailManager/VirtualMailManager.py:628 #, python-format msgid "" "The account has been successfully deleted from the database.\n" @@ -407,7 +420,7 @@ " »%(directory)s«\n" " Grund: %(raeson)s" -#: VirtualMailManager/VirtualMailManager.py:662 +#: VirtualMailManager/VirtualMailManager.py:660 msgid "Account doesn't exists" msgstr "Der Account existiert nicht" diff -r f9090d1a0730 -r b3debcfea7bc po/vmm.pot --- a/po/vmm.pot Tue Sep 16 20:03:09 2008 +0000 +++ b/po/vmm.pot Wed Sep 17 02:43:16 2008 +0000 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: vmm 0.5\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-09-12 23:18+0200\n" +"POT-Creation-Date: 2008-09-17 04:20+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -84,16 +84,25 @@ msgid "There is already an account with address »%s«." msgstr "" -#: VirtualMailManager/Alias.py:71 +#: VirtualMailManager/Alias.py:76 +#, python-format +msgid "" +"Can't add new destination to alias »%(address)s«.\n" +"Currently this alias expands into %(count)i recipients.\n" +"One destination more will render this alias unusable.\n" +"Hint: Increase Postfix' virtual_alias_expansion_limit\n" +msgstr "" + +#: VirtualMailManager/Alias.py:85 msgid "No destination address for alias denoted." msgstr "" -#: VirtualMailManager/Alias.py:81 +#: VirtualMailManager/Alias.py:96 #, python-format msgid "The alias »%(a)s« with destination »%(d)s« already exists." msgstr "" -#: VirtualMailManager/Alias.py:96 +#: VirtualMailManager/Alias.py:111 #, python-format msgid "The alias »%s« doesn't exists." msgstr "" @@ -213,14 +222,14 @@ msgid "mid must be an int/long." msgstr "" -#: VirtualMailManager/MailLocation.py:52 +#: VirtualMailManager/MailLocation.py:51 #, python-format msgid "" "Invalid folder name »%s«, it may consist only of\n" "1 - 20 single byte characters (A-Z, a-z, 0-9 and _)." msgstr "" -#: VirtualMailManager/MailLocation.py:65 +#: VirtualMailManager/MailLocation.py:64 msgid "Unknown mid specified." msgstr "" @@ -250,46 +259,46 @@ msgid "Unknown tid specified." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:49 +#: VirtualMailManager/VirtualMailManager.py:50 #, python-format msgid "" "fix permissions for »%(cfgFileName)s«\n" "`chmod 0600 %(cfgFileName)s` would be great." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:57 +#: VirtualMailManager/VirtualMailManager.py:58 msgid "" "You are not root.\n" "\tGood bye!\n" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:71 +#: VirtualMailManager/VirtualMailManager.py:73 #, python-format msgid "The file »%s« does not exists." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:90 +#: VirtualMailManager/VirtualMailManager.py:92 #, python-format msgid "" "»%s« is not a directory.\n" "(vmm.cfg: section \"domdir\", option \"base\")" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:95 +#: VirtualMailManager/VirtualMailManager.py:97 #, python-format msgid "" "»%(binary)s« doesn't exists.\n" "(vmm.cfg: section \"bin\", option \"%(option)s\")" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:99 +#: VirtualMailManager/VirtualMailManager.py:101 #, python-format msgid "" "»%(binary)s« is not executable.\n" "(vmm.cfg: section \"bin\", option \"%(option)s\")" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:157 +#: VirtualMailManager/VirtualMailManager.py:158 msgid "The domain name is too long." msgstr "" @@ -315,69 +324,69 @@ msgstr "" #: VirtualMailManager/VirtualMailManager.py:256 -#: VirtualMailManager/VirtualMailManager.py:344 +#: VirtualMailManager/VirtualMailManager.py:343 #, python-format msgid "No such directory: %s" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:332 +#: VirtualMailManager/VirtualMailManager.py:331 msgid "Found \"..\" in home directory path." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:340 +#: VirtualMailManager/VirtualMailManager.py:339 msgid "Owner/group mismatch in home directory detected." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:355 +#: VirtualMailManager/VirtualMailManager.py:354 msgid "FATAL: \"..\" in domain directory path detected." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:361 +#: VirtualMailManager/VirtualMailManager.py:360 msgid "FATAL: group mismatch in domain directory detected" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:448 +#: VirtualMailManager/VirtualMailManager.py:447 #, python-format msgid "" "Configurtion error: \"%s\"\n" "(in section \"connfig\", option \"done\") see also: vmm.cfg(5)\n" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:468 +#: VirtualMailManager/VirtualMailManager.py:467 #, python-format msgid "Invalid section: '%s'" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:478 +#: VirtualMailManager/VirtualMailManager.py:477 #, python-format msgid "Invalid argument: '%s'" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:488 -#: VirtualMailManager/VirtualMailManager.py:507 -#: VirtualMailManager/VirtualMailManager.py:618 +#: VirtualMailManager/VirtualMailManager.py:487 +#: VirtualMailManager/VirtualMailManager.py:506 +#: VirtualMailManager/VirtualMailManager.py:616 #, python-format msgid "Invalid argument: »%s«" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:511 +#: VirtualMailManager/VirtualMailManager.py:510 msgid "" "The keyword »detailed« is deprecated and will be removed in a future " "release.\n" " Please use the keyword »full« to get full details." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:588 +#: VirtualMailManager/VirtualMailManager.py:586 #, python-format msgid "The pattern »%s« contains invalid characters." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:613 +#: VirtualMailManager/VirtualMailManager.py:611 #, python-format msgid "The destination account/alias »%s« doesn't exists yet." msgstr "" -#: VirtualMailManager/VirtualMailManager.py:630 +#: VirtualMailManager/VirtualMailManager.py:628 #, python-format msgid "" "The account has been successfully deleted from the database.\n" @@ -386,7 +395,7 @@ " Reason: %(raeson)s" msgstr "" -#: VirtualMailManager/VirtualMailManager.py:662 +#: VirtualMailManager/VirtualMailManager.py:660 msgid "Account doesn't exists" msgstr ""