From c36ea8480c6abc91ed1345312d09a6e6832719b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Wed, 16 May 2018 11:44:58 +0200 Subject: [PATCH] :ambulance: fix(postfix) Small fixes on contributed code and schema issue #5761 --- .../services/postfix/class_servicePostfix.inc | 39 ++++++++++++------- postfix/contrib/openldap/postfix-fd.schema | 6 +-- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/postfix/admin/systems/services/postfix/class_servicePostfix.inc b/postfix/admin/systems/services/postfix/class_servicePostfix.inc index e85261e36..657653273 100644 --- a/postfix/admin/systems/services/postfix/class_servicePostfix.inc +++ b/postfix/admin/systems/services/postfix/class_servicePostfix.inc @@ -2,7 +2,7 @@ /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) Copyright (C) 2003-2010 Cajus Pollmeier - Copyright (C) 2011-2016 FusionDirectory + Copyright (C) 2011-2018 FusionDirectory This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,20 +21,27 @@ class CatchallDomainAttribute extends StringAttribute { - function fixPostValue ($value) + /*! \brief Return the ldap value in the correct intern format value + * + * \param $ldapValue The value as found in the LDAP + */ + function inputValue ($ldapValue) { - /* prepend '@' for postfix catchall mapping */ - if ($value) { - return '@'.parent::fixPostValue($value); - } else { - return $value; - } + /* remove initial '@' from value */ + return preg_replace('/^@/', '', $ldapValue); } - function displayValue ($value) + /*! \brief Computes LDAP value + */ + function computeLdapValue () { - /* remove initial '@' from display */ - return '@' == substr($value, 0, 1) ? substr($value, 1) : $value; + return '@'.$this->getValue(); + } + + function setValue ($value) + { + /* remove initial '@' if needed */ + return parent::setValue(preg_replace('/^@/', '', $value)); } } @@ -120,8 +127,14 @@ class servicePostfix extends simpleService _('Catchall table'), _('Catchall table'), 'fdPostfixCatchallTable', 'fdPostfixCatchallTable', array( - new CatchallDomainAttribute ('Domain', '', 'fdCatchallTableDomain'), - new MailAttribute ('Recipient', '', 'fdCatchallTableRecipient') + new CatchallDomainAttribute ( + _('Domain'), _('Domain concerned by this catchall rule'), + 'fdCatchallTableDomain', TRUE + ), + new MailAttribute ( + _('Recipient'), _('Recipient mail address for this catchall rule'), + 'fdCatchallTableRecipient', TRUE + ) ) ) ) diff --git a/postfix/contrib/openldap/postfix-fd.schema b/postfix/contrib/openldap/postfix-fd.schema index f833eb0a6..2d2ce357e 100644 --- a/postfix/contrib/openldap/postfix-fd.schema +++ b/postfix/contrib/openldap/postfix-fd.schema @@ -72,13 +72,13 @@ attributetype ( 1.3.6.1.4.1.38414.10.12.2 NAME 'fdTransportTableRule' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE) -attributetype ( 1.3.6.1.4.1.38414.10.11.12 NAME 'fdCatchallTableDomain' +attributetype ( 1.3.6.1.4.1.38414.10.13.1 NAME 'fdCatchallTableDomain' DESC 'FusionDirectory - postfix catchall table domain' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE) -attributetype ( 1.3.6.1.4.1.38414.10.11.13 NAME 'fdCatchallTableRecipient' +attributetype ( 1.3.6.1.4.1.38414.10.13.2 NAME 'fdCatchallTableRecipient' DESC 'FusionDirectory - postfix catchall table recipient' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 @@ -99,7 +99,7 @@ objectclass (1.3.6.1.4.1.38414.10.2.4 NAME 'fdPostfixTransportTable' MUST ( fdTransportTableMatch $ fdTransportTableRule ) MAY ( ) ) -objectclass (1.3.6.1.4.1.38414.10.2.6 NAME 'fdPostfixCatchallTable' +objectclass (1.3.6.1.4.1.38414.10.2.5 NAME 'fdPostfixCatchallTable' DESC 'FusionDirectory - Postfix catchall table line' MUST ( fdCatchallTableDomain $ fdCatchallTableRecipient ) MAY ( ) ) -- GitLab