Skip to content

Commit 7ff0e93

Browse files
committed
Merge branch 'develop' of git.ispconfig.org:ispconfig/ispconfig3 into develop
2 parents 228dcfc + 810ed16 commit 7ff0e93

File tree

73 files changed

+170
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+170
-89
lines changed

.gitlab-ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
stages:
33
- syntax
44
- syntax_diff
5+
- test
56

67
#
78
### Stage syntax
@@ -49,3 +50,16 @@ syntax_diff:lint:
4950
# - echo "For more information http://www.icosaedro.it/phplint/"
5051
# - vendor/bin/phplint
5152

53+
54+
test:install:
55+
stage: test
56+
image: jerob/docker-ispconfig
57+
only:
58+
- schedules
59+
- web
60+
script:
61+
- $CI_PROJECT_DIR/helper_scripts/test_install_docker.sh
62+
- apt-get update
63+
- apt-get --yes install curl
64+
- curl --insecure https://127.0.0.1:8080/login/
65+
- ps xaf
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
# This script is used from .gitlab-ci.yml to do an automated installation inside a docker container for testing.
4+
5+
if [ -f /usr/local/ispconfig/interface/lib/config.inc.php ]; then
6+
echo "Found an existing configfile, bailing out!"
7+
exit 1
8+
fi
9+
10+
mysql_install_db
11+
service mysql start \
12+
&& echo "UPDATE mysql.user SET Password = PASSWORD('pass') WHERE User = 'root';" | mysql -u root \
13+
&& echo "UPDATE mysql.user SET plugin='mysql_native_password' where user='root';" | mysql -u root \
14+
&& echo "DELETE FROM mysql.user WHERE User='';" | mysql -u root \
15+
&& echo "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" | mysql -u root \
16+
&& echo "DROP DATABASE IF EXISTS test;" | mysql -u root \
17+
&& echo "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';" | mysql -u root \
18+
&& echo "FLUSH PRIVILEGES;" | mysql -u root
19+
sed -i "s/^hostname=server1.example.com$/hostname=$HOSTNAME/g" /root/ispconfig3_install/install/autoinstall.ini
20+
21+
service mysql start && php -q $CI_PROJECT_DIR/install/install.php --autoinstall=/root/ispconfig3_install/install/autoinstall.ini

interface/lib/classes/plugin_backuplist.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function makeBackup(&$message, &$error, $wb)
5858
if ($tmp['number'] == 0) {
5959
if($action_type === 'backup_database') {
6060
// get all server ids of databases for this domain
61-
$sql = 'SELECT `server_id` FROM `web_database` WHERE `parent_domain_id` = ?';
61+
$sql = 'SELECT DISTINCT `server_id` FROM `web_database` WHERE `parent_domain_id` = ?';
6262
$result = $app->db->query($sql, $domain_id);
6363
while(($cur = $result->get())) {
6464
$server_id = $cur['server_id'];

interface/lib/classes/validate_dns.inc.php

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,33 +283,57 @@ function increase_serial($serial){
283283
}
284284
return $new_serial;
285285
}
286-
287-
function validate_xfer($field_name, $field_value, $validator) {
286+
287+
function validate_ip($field_name, $field_value, $validator) {
288288
global $app;
289-
289+
290290
$errorMessage = '';
291-
291+
292292
if($validator['allowempty'] != 'y') $validator['allowempty'] = 'n';
293293
if($validator['allowempty'] == 'y' && $field_value == '') {
294294
//* Do nothing
295295
} elseif ($field_value == 'any') {
296296
//* Do nothing
297297
} else {
298-
//* Check if its a IPv4 or IPv6 address
298+
//* Check if its a IPv4 or IPv6 address/range
299299
if(isset($validator['separator']) && $validator['separator'] != '') {
300300
//* When the field may contain several IP addresses, split them by the char defined as separator
301301
$field_value_array = explode($validator['separator'], $field_value);
302302
} else {
303303
$field_value_array[] = $field_value;
304304
}
305+
// Check if it's a valid input
305306
foreach($field_value_array as $field_value) {
306-
$field_value = trim($field_value);
307+
// Check if the IP is valid without range
308+
$subnet = '';
309+
$ip = trim($field_value);
310+
if(strpos($ip, '/') !== false) {
311+
list($ip, $subnet) = explode('/', $ip, 2);
312+
$ip = trim($ip);
313+
}
307314
if(function_exists('filter_var')) {
308-
if(!filter_var($field_value, FILTER_VALIDATE_IP)) {
315+
if(!filter_var($ip, FILTER_VALIDATE_IP)) {
309316
$errmsg = $validator['errmsg'];
310317
$errorMessage .= $app->tform->lng($errmsg)."<br />\r\n";
311318
}
312319
} else $this->errorMessage .= "function filter_var missing <br />\r\n";
320+
// Check if the range is valid
321+
if ($subnet !== '') {
322+
if (!is_numeric($subnet)) {
323+
$errmsg = $validator['errmsg'];
324+
$errorMessage .= $app->tform->lng($errmsg)."<br />\r\n";
325+
}
326+
elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
327+
if ($subnet < 1 || $subnet > 128) {
328+
$errmsg = $validator['errmsg'];
329+
$errorMessage .= $app->tform->lng($errmsg)."<br />\r\n";
330+
}
331+
}
332+
elseif ($subnet < 1 || $subnet > 32) {
333+
$errmsg = $validator['errmsg'];
334+
$errorMessage .= $app->tform->lng($errmsg)."<br />\r\n";
335+
}
336+
}
313337
}
314338
}
315339
return $errorMessage;

interface/web/dns/form/dns_soa.tform.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,11 @@
244244
'formtype' => 'TEXT',
245245
'validators' => array ( 0 => array ( 'type' => 'CUSTOM',
246246
'class' => 'validate_dns',
247-
'function' => 'validate_xfer',
247+
'function' => 'validate_ip',
248248
'allowempty' => 'y',
249249
'separator' => ',',
250250
'errmsg'=> 'xfer_error_regex'),
251251
),
252-
/*
253-
'validators' => array ( 0 => array ( 'type' => 'ISIP',
254-
'allowempty' => 'y',
255-
'separator' => ',',
256-
'errmsg'=> 'xfer_error_regex'),
257-
),
258-
*/
259252
'default' => '',
260253
'value' => '',
261254
'width' => '30',
@@ -264,7 +257,9 @@
264257
'also_notify' => array (
265258
'datatype' => 'VARCHAR',
266259
'formtype' => 'TEXT',
267-
'validators' => array ( 0 => array ( 'type' => 'ISIP',
260+
'validators' => array ( 0 => array ( 'type' => 'CUSTOM',
261+
'class' => 'validate_dns',
262+
'function' => 'validate_ip',
268263
'allowempty' => 'y',
269264
'separator' => ',',
270265
'errmsg'=> 'also_notify_error_regex'

interface/web/dns/lib/lang/ar_dns_soa.lng

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $wb['ns_error_regex'] = 'NS has a invalid format.';
2222
$wb['mbox_error_empty'] = 'Email is empty.';
2323
$wb['mbox_error_regex'] = 'Email format invalid.';
2424
$wb['also_notify_txt'] = 'Also Notify';
25-
$wb['also_notify_error_regex'] = 'Please use an IP address.';
25+
$wb['also_notify_error_regex'] = 'Also notify: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
2626
$wb['update_acl_txt'] = 'Update ACL';
2727
$wb['seconds_txt'] = 'Seconds';
2828
$wb['eg_domain_tld'] = 'e.g. domain.tld';
@@ -34,7 +34,7 @@ $wb['retry_range_error'] = 'Min. Retry time is 60 seconds.';
3434
$wb['expire_range_error'] = 'Min. Expire time is 60 seconds.';
3535
$wb['minimum_range_error'] = 'Min. Minimum time is 60 seconds.';
3636
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
37-
$wb['xfer_error_regex'] = 'Also notify: Please use an IP address.';
37+
$wb['xfer_error_regex'] = 'Zone transfers: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
3838
$wb['dnssec_info_txt'] = 'DNSSEC DS-Data for registry';
3939
$wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
4040
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delivered in signed format afterwards. If you use PowerDNS, keys WILL be deleted!';

interface/web/dns/lib/lang/bg_dns_soa.lng

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $wb['mbox_error_empty'] = 'Полето с емайл е празно.';
2323
$wb['mbox_error_regex'] = 'Полето е емайл е в грешен формат.';
2424
$wb['also_notify_txt'] = 'Also Notify';
2525
$wb['update_acl_txt'] = 'Обнови ACL';
26-
$wb['also_notify_error_regex'] = 'Please use an IP address.';
26+
$wb['also_notify_error_regex'] = 'Also notify: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
2727
$wb['seconds_txt'] = 'Seconds';
2828
$wb['eg_domain_tld'] = 'e.g. domain.tld';
2929
$wb['eg_ns1_domain_tld'] = 'e.g. ns1.domain.tld';
@@ -34,7 +34,7 @@ $wb['retry_range_error'] = 'Min. Retry time is 60 seconds.';
3434
$wb['expire_range_error'] = 'Min. Expire time is 60 seconds.';
3535
$wb['minimum_range_error'] = 'Min. Minimum time is 60 seconds.';
3636
$wb['ttl_range_error'] = 'Минималния TTL е 60 секунди.';
37-
$wb['xfer_error_regex'] = 'Also notify: Please use an IP address.';
37+
$wb['xfer_error_regex'] = 'Zone transfers: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
3838
$wb['dnssec_info_txt'] = 'DNSSEC DS-Data for registry';
3939
$wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
4040
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delivered in signed format afterwards. If you use PowerDNS, keys WILL be deleted!';

interface/web/dns/lib/lang/el_dns_soa.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $wb['retry_range_error'] = 'Min. Retry time is 60 seconds.';
3434
$wb['expire_range_error'] = 'Min. Expire time is 60 seconds.';
3535
$wb['minimum_range_error'] = 'Min. Minimum time is 60 seconds.';
3636
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
37-
$wb['xfer_error_regex'] = 'Also notify: Please use an IP address.';
37+
$wb['xfer_error_regex'] = 'Zone transfers: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
3838
$wb['dnssec_info_txt'] = 'DNSSEC DS-Data for registry';
3939
$wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
4040
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delivered in signed format afterwards. If you use PowerDNS, keys WILL be deleted!';

interface/web/dns/lib/lang/en_dns_soa.lng

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ $wb['ns_error_regex'] = 'NS has a invalid format.';
2525
$wb['mbox_error_empty'] = 'Email is empty.';
2626
$wb['mbox_error_regex'] = 'Email format invalid.';
2727
$wb['also_notify_txt'] = 'Also Notify';
28-
$wb['also_notify_error_regex'] = 'Also notify: Please use an IP address.';
29-
$wb['xfer_error_regex'] = 'Xfer: Please use one or more IP addresses, separated by , or use the keyword: any';
28+
$wb['also_notify_error_regex'] = 'Also notify: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
29+
$wb['xfer_error_regex'] = 'Zone transfers: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
3030
$wb['update_acl_txt'] = 'Update ACL';
3131
$wb['seconds_txt'] = 'Seconds';
3232
$wb['eg_domain_tld'] = 'e.g. domain.tld';

interface/web/dns/lib/lang/fi_dns_soa.lng

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ $wb['ns_error_regex'] = 'Nimipalvelin-kenttä on tyhjä.';
2222
$wb['mbox_error_empty'] = 'Sähköpostiosoite on tyhjä.';
2323
$wb['mbox_error_regex'] = 'Sähköpostiosoite on vääränlainen';
2424
$wb['also_notify_txt'] = 'Läheta ilmoitus';
25-
$wb['also_notify_error_regex'] = 'Please use an IP address.';
25+
$wb['also_notify_error_regex'] = 'Also notify: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
2626
$wb['update_acl_txt'] = 'Päivitä ACL';
2727
$wb['seconds_txt'] = 'Seconds';
2828
$wb['eg_domain_tld'] = 'e.g. domain.tld';
@@ -34,7 +34,7 @@ $wb['retry_range_error'] = 'Min. Retry time is 60 seconds.';
3434
$wb['expire_range_error'] = 'Min. Expire time is 60 seconds.';
3535
$wb['minimum_range_error'] = 'Min. Minimum time is 60 seconds.';
3636
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
37-
$wb['xfer_error_regex'] = 'Also notify: Please use an IP address.';
37+
$wb['xfer_error_regex'] = 'Zone transfers: Please use a valid IP range, one or more IP addresses separated by a comma or use the keyword: any';
3838
$wb['dnssec_info_txt'] = 'DNSSEC DS-Data for registry';
3939
$wb['dnssec_wanted_txt'] = 'Sign zone (DNSSEC)';
4040
$wb['dnssec_wanted_info'] = 'When disabling DNSSEC keys are not going to be deleted if DNSSEC was enabled before and keys already have been generated but the zone will no longer be delivered in signed format afterwards. If you use PowerDNS, keys WILL be deleted!';

0 commit comments

Comments
 (0)