Commit c6678990 authored by Côme Chilliet's avatar Côme Chilliet

Merge branch '5761-add-catchall-table-to-postfix-plugin' into '1.3-dev'

Resolve "Add catchall table to postfix plugin"

See merge request fusiondirectory/fd-plugins!234
parents 7173b8fb c36ea848
......@@ -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
......@@ -19,6 +19,33 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class CatchallDomainAttribute extends StringAttribute
{
/*! \brief Return the ldap value in the correct intern format value
*
* \param $ldapValue The value as found in the LDAP
*/
function inputValue ($ldapValue)
{
/* remove initial '@' from value */
return preg_replace('/^@/', '', $ldapValue);
}
/*! \brief Computes LDAP value
*/
function computeLdapValue ()
{
return '@'.$this->getValue();
}
function setValue ($value)
{
/* remove initial '@' if needed */
return parent::setValue(preg_replace('/^@/', '', $value));
}
}
class servicePostfix extends simpleService
{
var $objectclasses = array('fdPostfixServer');
......@@ -95,6 +122,20 @@ class servicePostfix extends simpleService
'%s:%s', '', ''
)
)
),
new SubNodesAttribute (
_('Catchall table'), _('Catchall table'),
'fdPostfixCatchallTable', 'fdPostfixCatchallTable',
array(
new CatchallDomainAttribute (
_('Domain'), _('Domain concerned by this catchall rule'),
'fdCatchallTableDomain', TRUE
),
new MailAttribute (
_('Recipient'), _('Recipient mail address for this catchall rule'),
'fdCatchallTableRecipient', TRUE
)
)
)
)
),
......@@ -145,6 +186,7 @@ class servicePostfix extends simpleService
global $config;
$errors = parent::ldap_save();
$this->attributesAccess['fdPostfixTransportTable']->postLdapSave($config->get_ldap_link());
$this->attributesAccess['fdPostfixCatchallTable']->postLdapSave($config->get_ldap_link());
return $errors;
}
}
......
......@@ -72,6 +72,18 @@ 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.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.13.2 NAME 'fdCatchallTableRecipient'
DESC 'FusionDirectory - postfix catchall table recipient'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
# Postfix Server description
objectclass (1.3.6.1.4.1.38414.10.2.3 NAME 'fdPostfixServer' SUP top AUXILIARY
DESC 'FusionDirectory - Postfix server definition'
......@@ -86,3 +98,8 @@ objectclass (1.3.6.1.4.1.38414.10.2.4 NAME 'fdPostfixTransportTable'
DESC 'FusionDirectory - Postfix transport table line'
MUST ( fdTransportTableMatch $ fdTransportTableRule )
MAY ( ) )
objectclass (1.3.6.1.4.1.38414.10.2.5 NAME 'fdPostfixCatchallTable'
DESC 'FusionDirectory - Postfix catchall table line'
MUST ( fdCatchallTableDomain $ fdCatchallTableRecipient )
MAY ( ) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment