Skip to content

Commit 4341867

Browse files
author
Marius Cramer
committed
Merge branch 'master_fixes' into 'master'
Use LMTP only if necessary Defaultvalues for virtual_transport switched back to maildrop like in 3.0.5.x. If dovecot is used, configure_dovcot switches to dovecot also like in 3.0.5.x. lmtp is only used in future if Uid-Mapping is enabled -> therefor it is necessary. Switching is implemented in server-postfix-plugin. Validate Mail/Webuser-UID-Mapping: only enable, when Single-Server-Setup. Switching only possible unless a user was created. Reason for this change: Few months ago a feature for mapping web-user-linux-uid to mail-user was added to sum up disk quota over webspace and mailusage. This feature required switching mail-delivery virtual_transport from maildrop or dovecot to lmtp. LMTP has one big disadvantage: X-Original-header will get lost when deliver a BCC-mail to a mailbox. Additional this feature only works if mail and web-files lay on the same server. and if changing this value, directory-permissions would be necessary to change, so it will only be possible if there is NO mail user created yet. See merge request !128
2 parents b98be2e + d7480c8 commit 4341867

34 files changed

+208
-33
lines changed

install/dist/lib/debian60.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function configure_dovecot()
5757
// Adding the amavisd commands to the postfix configuration
5858
$postconf_commands = array (
5959
'dovecot_destination_recipient_limit = 1',
60-
'virtual_transport = lmtp:unix:private/dovecot-lmtp',
60+
'virtual_transport = dovecot',
6161
'smtpd_sasl_type = dovecot',
6262
'smtpd_sasl_path = private/auth'
6363
);

install/dist/lib/fedora.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public function configure_dovecot()
402402
// Adding the amavisd commands to the postfix configuration
403403
$postconf_commands = array (
404404
'dovecot_destination_recipient_limit = 1',
405-
'virtual_transport = lmtp:unix:private/dovecot-lmtp',
405+
'virtual_transport = dovecot',
406406
'smtpd_sasl_type = dovecot',
407407
'smtpd_sasl_path = private/auth',
408408
);

install/dist/lib/gentoo.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public function configure_dovecot()
245245
//* Reconfigure postfix to use dovecot authentication
246246
$postconf_commands = array (
247247
'dovecot_destination_recipient_limit = 1',
248-
'virtual_transport = lmtp:unix:private/dovecot-lmtp',
248+
'virtual_transport = dovecot',
249249
'smtpd_sasl_type = dovecot',
250250
'smtpd_sasl_path = private/auth'
251251
);

install/dist/lib/opensuse.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ public function configure_dovecot()
453453
// Adding the amavisd commands to the postfix configuration
454454
$postconf_commands = array (
455455
'dovecot_destination_recipient_limit = 1',
456-
'virtual_transport = lmtp:unix:private/dovecot-lmtp',
456+
'virtual_transport = dovecot',
457457
'smtpd_sasl_type = dovecot',
458458
'smtpd_sasl_path = private/auth',
459459
);

install/tpl/debian_postfix.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
2626
smtpd_client_message_rate_limit = 100
2727
maildrop_destination_concurrency_limit = 1
2828
maildrop_destination_recipient_limit = 1
29-
virtual_transport = lmtp:unix:private/dovecot-lmtp
29+
virtual_transport = maildrop
3030
header_checks = regexp:{config_dir}/header_checks
3131
mime_header_checks = regexp:{config_dir}/mime_header_checks
3232
nested_header_checks = regexp:{config_dir}/nested_header_checks

install/tpl/fedora_postfix.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
2323
smtpd_client_message_rate_limit = 100
2424
maildrop_destination_concurrency_limit = 1
2525
maildrop_destination_recipient_limit = 1
26-
virtual_transport = lmtp:unix:private/dovecot-lmtp
26+
virtual_transport = maildrop
2727
header_checks = regexp:{config_dir}/header_checks
2828
mime_header_checks = regexp:{config_dir}/mime_header_checks
2929
nested_header_checks = regexp:{config_dir}/nested_header_checks

install/tpl/gentoo_postfix.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
2222
smtpd_client_message_rate_limit = 100
2323
maildrop_destination_concurrency_limit = 1
2424
maildrop_destination_recipient_limit = 1
25-
virtual_transport = lmtp:unix:private/dovecot-lmtp
25+
virtual_transport = maildrop
2626
header_checks = regexp:{config_dir}/header_checks
2727
mime_header_checks = regexp:{config_dir}/mime_header_checks
2828
nested_header_checks = regexp:{config_dir}/nested_header_checks

install/tpl/opensuse_postfix.conf.master

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
2323
smtpd_client_message_rate_limit = 100
2424
maildrop_destination_concurrency_limit = 1
2525
maildrop_destination_recipient_limit = 1
26-
virtual_transport = lmtp:unix:private/dovecot-lmtp
26+
virtual_transport = maildrop
2727
header_checks = regexp:{config_dir}/header_checks
2828
mime_header_checks = regexp:{config_dir}/mime_header_checks
2929
nested_header_checks = regexp:{config_dir}/nested_header_checks
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
/*
4+
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
5+
Copyright (c) 2012, Marius Cramer, pixcept KG
6+
All rights reserved.
7+
8+
Redistribution and use in source and binary forms, with or without modification,
9+
are permitted provided that the following conditions are met:
10+
11+
* Redistributions of source code must retain the above copyright notice,
12+
this list of conditions and the following disclaimer.
13+
* Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
* Neither the name of ISPConfig nor the names of its contributors
17+
may be used to endorse or promote products derived from this software without
18+
specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23+
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
27+
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
class validate_server_mail_config {
33+
34+
function get_error($errmsg) {
35+
global $app;
36+
37+
if(isset($app->tform->wordbook[$errmsg])) {
38+
return $app->tform->wordbook[$errmsg]."<br>\r\n";
39+
} else {
40+
return $errmsg."<br>\r\n";
41+
}
42+
}
43+
44+
/* Validator function to check for changing virtual_uidgid_maps */
45+
function mailbox_virtual_uidgid_maps($field_name, $field_value, $validator) {
46+
global $app, $conf;
47+
48+
if (empty($field_value)) $field_value = 'n';
49+
$app->uses('getconf,system,db');
50+
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
51+
52+
// try to activat the function -> only if only one mailserver out there and if dovecot is installed
53+
if ($field_value == 'y') {
54+
// if this count is more then 1, there is more than 1 webserver, more than 1 mailserver or different web+mailserver -> so this feature isn't possible
55+
$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM server WHERE mail_server=1 OR web_server=1");
56+
if($num_rec['number'] > 1) {
57+
return $this->get_error('mailbox_virtual_uidgid_maps_error_nosingleserver');
58+
}
59+
}
60+
61+
// Value can only be changed if there is no mailuser set
62+
if ($mail_config["mailbox_virtual_uidgid_maps"] != $field_value) {
63+
$num_rec = $app->db->queryOneRecord("SELECT count(*) as number FROM mail_user");
64+
if($num_rec['number'] > 0) {
65+
return $this->get_error('mailbox_virtual_uidgid_maps_error_alreadyusers');
66+
}
67+
}
68+
}
69+
70+
}

interface/web/admin/form/server_config.tform.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,10 @@
387387
'mailbox_virtual_uidgid_maps' => array(
388388
'datatype' => 'VARCHAR',
389389
'formtype' => 'CHECKBOX',
390+
'validators' => array (0 => array ( 'type' => 'CUSTOM',
391+
'class' => 'validate_server_mail_config',
392+
'function' => 'mailbox_virtual_uidgid_maps'),
393+
),
390394
'default' => 'n',
391395
'value' => array(0 => 'n', 1 => 'y')
392396
),

0 commit comments

Comments
 (0)