Skip to content

Commit ee45b99

Browse files
author
Marius Burkard
committed
Merge branch 'develop' into 'develop'
allow custom rspamd url (Implements #6010) use idn_decode for mailuser and login fails for mail-users with IDN domains (Fixes #6021) wrong server-id in admin/server_config_edit.php (Fixes #6022) Closes #6022, #6021, and #6010 See merge request ispconfig/ispconfig3!1386
2 parents 3118c93 + bd66023 commit ee45b99

File tree

12 files changed

+35
-19
lines changed

12 files changed

+35
-19
lines changed

install/install.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@
146146
//** Installer Interface
147147
//****************************************************************************************************
148148
$inst = new installer();
149-
if (!$inst->get_php_version()) die('ISPConfig requires PHP '.$inst->min_php."\n");
150149
$retval=shell_exec("which which");
151150
if (empty($retval)) die ("ISPConfig requires which \n");
152151

install/lib/installer_base.lib.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class installer_base {
3535
var $db;
3636
public $install_ispconfig_interface = true;
3737
public $is_update = false; // true if it is an update, false if it is a new install
38-
public $min_php = '5.4'; // minimal php-version for update / install
3938
protected $mailman_group = 'list';
4039

4140

@@ -160,12 +159,6 @@ public function set_immutable($path, $enable = true) {
160159
}
161160
}
162161

163-
//** Detect PHP-Version
164-
public function get_php_version() {
165-
if(version_compare(PHP_VERSION, $this->min_php, '<')) return false;
166-
else return true;
167-
}
168-
169162
public function crypt_password($cleartext_password, $charset = 'UTF-8') {
170163
if($charset != 'UTF-8') {
171164
$cleartext_password = mb_convert_encoding($cleartext_password, $charset, 'UTF-8');

install/tpl/server.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ overquota_notify_client=y
5959
overquota_notify_freq=7
6060
overquota_notify_onok=n
6161
sendmail_path=/usr/sbin/sendmail
62+
rspamd_url=
6263

6364
[getmail]
6465
getmail_config_dir=/etc/getmail

install/update.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@
185185
$conf['ispconfig_log_priority'] = $conf_old["log_priority"];
186186

187187
$inst = new installer();
188-
if (!$inst->get_php_version()) die('ISPConfig requieres PHP '.$inst->min_php."\n");
189188
$inst->is_update = true;
190189

191190
$inst->check_prerequisites();

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,18 @@
717717
'default' => 'n',
718718
'value' => array(0 => 'n', 1 => 'y')
719719
),
720+
'rspamd_url' => array(
721+
'datatype' => 'VARCHAR',
722+
'formtype' => 'TEXT',
723+
'default' => '',
724+
'filters' => array(
725+
0 => array( 'event' => 'SAVE', 'type' => 'IDNTOASCII'),
726+
1 => array( 'event' => 'SHOW', 'type' => 'IDNTOUTF8')
727+
),
728+
'value' => '',
729+
'width' => '40',
730+
'maxlength' => '255'
731+
),
720732
//#################################
721733
// END Datatable fields
722734
//#################################

interface/web/admin/server_config_edit.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function onShow() {
5757

5858
// get the config
5959
$app->uses('getconf');
60-
$web_config = $app->getconf->get_server_config($conf['server_id'], 'web');
60+
$web_config = $app->getconf->get_server_config($this->id, 'web');
6161

6262
if($web_config['server_type'] == 'nginx'){
6363
unset($app->tform->formDef["tabs"]["fastcgi"]);
@@ -90,8 +90,12 @@ function onShowEdit() {
9090
$this->dataRecord = $app->getconf->get_server_config($server_id, $section);
9191

9292
if($section == 'mail'){
93-
$server_config = $app->getconf->get_server_config($server_id, 'server');
94-
$rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/';
93+
if(trim($this->dataRecord['rspamd_url'] == '')) {
94+
$server_config = $app->getconf->get_server_config($server_id, 'server');
95+
$rspamd_url = 'https://'.$server_config['hostname'].':8081/rspamd/';
96+
} else {
97+
$rspamd_url = $this->dataRecord['rspamd_url'];
98+
}
9599
}
96100
}
97101

interface/web/admin/templates/server_config_mail_edit.htm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@
4949
</div>
5050
<div class="form-group rspamd">
5151
<label for="rspamd_url" class="col-sm-3 control-label col-text">{tmpl_var name='rspamd_url_txt'}</label>
52-
<div class="col-sm-6"><a href="{tmpl_var name='rspamd_url'}" target="_blank">{tmpl_var name='rspamd_url'}</a><a href="{tmpl_var name='rspamd_url'}" target="_blank" class="btn btn-default formbutton-default formbutton-narrow" style="margin-left:20px"><span class="icon icon-link"></span></a></div>
52+
<div class="col-sm-8"><div class="input-group">
53+
<input type="text" name="rspamd_url" id="rspamd_url" value="{tmpl_var name='rspamd_url'}" class="form-control" />
54+
<span class="input-group-btn">
55+
<a href="{tmpl_var name='rspamd_url'}" target="_blank" class="btn btn-default formbutton-default formbutton-narrow" style="margin-left:20px"><span class="icon icon-link"></span></a>
56+
</span>
57+
</div></div>
58+
</div>
5359
</div>
5460
<div class="form-group rspamd">
5561
<label for="rspamd_password" class="col-sm-3 control-label">{tmpl_var name='rspamd_password_txt'}</label>

interface/web/login/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
if(count($_POST) > 0) {
5959

6060
//** Check variables
61-
if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $_POST['username'])) $error = $app->lng('user_regex_error');
61+
if(!preg_match("/^[\w\.\-\_\@]{1,128}$/", $app->functions->idn_encode($_POST['username']))) $error = $app->lng('user_regex_error');
6262
if(!preg_match("/^.{1,256}$/i", $_POST['password'])) $error = $app->lng('pw_error_length');
6363

6464
//** importing variables
@@ -152,7 +152,7 @@
152152
if(stristr($username, '@')) {
153153
//* mailuser login
154154
$sql = "SELECT * FROM mail_user WHERE login = ? or email = ?";
155-
$mailuser = $app->db->queryOneRecord($sql, $username, $username);
155+
$mailuser = $app->db->queryOneRecord($sql, $username, $app->functions->idn_encode($username));
156156
$user = false;
157157
if($mailuser) {
158158
$saved_password = stripslashes($mailuser['password']);

interface/web/mailuser/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828

2929
if($rec['cc'] == '') $rec['cc'] = $wb['none_txt'];
3030

31-
$app->tpl->setVar($rec);
31+
$rec['email'] = $app->functions->idn_decode($rec['email']);
32+
$rec['login'] = $app->functions->idn_decode($rec['login']);
3233

34+
$app->tpl->setVar($rec);
3335
$sql2 = "SELECT * FROM server WHERE server_id = ?";
3436
$rec2 = $app->db->queryOneRecord($sql2, $rec['server_id']);
3537

interface/web/mailuser/mail_user_cc_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function onShowEnd() {
7575
global $app, $conf;
7676

7777
$rec = $app->tform->getDataRecord($this->id);
78-
$app->tpl->setVar("email", $rec['email'], true);
78+
$app->tpl->setVar("email", $app->functions->idn_decode($rec['email']), true);
7979

8080
parent::onShowEnd();
8181
}

0 commit comments

Comments
 (0)