Skip to content

Commit f6e42fc

Browse files
author
Marius Cramer
committed
Merge branch 'master' into 'master'
Prevent empty hostname during install See merge request !184
2 parents be531cf + 5a56e6a commit f6e42fc

Some content is hidden

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

56 files changed

+96
-13
lines changed

install/install.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,16 @@
171171
//** Get the hostname
172172
$tmp_out = array();
173173
exec('hostname -f', $tmp_out);
174-
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', @$tmp_out[0],'hostname');
174+
$conf['hostname'] = @$tmp_out[0];
175175
unset($tmp_out);
176+
//** Prevent empty hostname
177+
$check = false;
178+
do {
179+
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg server1.domain.tld ', $conf['hostname'], 'hostname');
180+
$conf['hostname']=trim($conf['hostname']);
181+
$check = @($conf['hostname'] !== '')?true:false;
182+
if(!$check) swriteln('Hostname may not be empty.');
183+
} while (!$check);
176184

177185
// Check if the mysql functions are loaded in PHP
178186
if(!function_exists('mysql_connect')) die('No PHP MySQL functions available. Please ensure that the PHP MySQL module is loaded.');

install/sql/incremental/upd_dev_collection.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,5 @@ ALTER TABLE `client` CHANGE `web_php_options` `web_php_options` VARCHAR(255) NOT
145145

146146
ALTER TABLE openvz_template ADD COLUMN `features` varchar(255) DEFAULT NULL AFTER `capability`;
147147
ALTER TABLE openvz_vm ADD COLUMN `features` TEXT DEFAULT NULL AFTER `capability`;
148+
ALTER TABLE openvz_template ADD COLUMN `iptables` varchar(255) DEFAULT NULL AFTER `features`;
149+
ALTER TABLE openvz_vm ADD COLUMN `iptables` TEXT DEFAULT NULL AFTER `features`;

install/sql/ispconfig3.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,14 +1089,15 @@ CREATE TABLE IF NOT EXISTS `openvz_template` (
10891089
`create_dns` varchar(1) NOT NULL DEFAULT 'n',
10901090
`capability` varchar(255) DEFAULT NULL,
10911091
`features` varchar(255) DEFAULT NULL,
1092+
`iptables` varchar(255) DEFAULT NULL,
10921093
PRIMARY KEY (`template_id`)
10931094
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
10941095

10951096
--
10961097
-- Dumping data for table `openvz_template`
10971098
--
10981099

1099-
INSERT INTO `openvz_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `diskspace`, `traffic`, `bandwidth`, `ram`, `ram_burst`, `cpu_units`, `cpu_num`, `cpu_limit`, `io_priority`, `active`, `description`, `numproc`, `numtcpsock`, `numothersock`, `vmguarpages`, `kmemsize`, `tcpsndbuf`, `tcprcvbuf`, `othersockbuf`, `dgramrcvbuf`, `oomguarpages`, `privvmpages`, `lockedpages`, `shmpages`, `physpages`, `numfile`, `avnumproc`, `numflock`, `numpty`, `numsiginfo`, `dcachesize`, `numiptent`, `swappages`, `hostname`, `nameserver`, `create_dns`, `capability`, `features`) VALUES(1, 1, 1, 'riud', 'riud', '', 'small', 10, -1, -1, 256, 512, 1000, 4, 400, 4, 'y', '', '999999:999999', '7999992:7999992', '7999992:7999992', '65536:65536', '2147483646:2147483646', '214748160:396774400', '214748160:396774400', '214748160:396774400', '214748160:396774400', '65536:65536', '131072:131072', '999999:999999', '65536:65536', '0:2147483647', '23999976:23999976', '180:180', '999999:999999', '500000:500000', '999999:999999', '2147483646:2147483646', '999999:999999', '256000:256000', 'v{VEID}.test.tld', '8.8.8.8 8.8.4.4', 'n', '', '');
1100+
INSERT INTO `openvz_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `template_name`, `diskspace`, `traffic`, `bandwidth`, `ram`, `ram_burst`, `cpu_units`, `cpu_num`, `cpu_limit`, `io_priority`, `active`, `description`, `numproc`, `numtcpsock`, `numothersock`, `vmguarpages`, `kmemsize`, `tcpsndbuf`, `tcprcvbuf`, `othersockbuf`, `dgramrcvbuf`, `oomguarpages`, `privvmpages`, `lockedpages`, `shmpages`, `physpages`, `numfile`, `avnumproc`, `numflock`, `numpty`, `numsiginfo`, `dcachesize`, `numiptent`, `swappages`, `hostname`, `nameserver`, `create_dns`, `capability`, `features`, `iptables`) VALUES(1, 1, 1, 'riud', 'riud', '', 'small', 10, -1, -1, 256, 512, 1000, 4, 400, 4, 'y', '', '999999:999999', '7999992:7999992', '7999992:7999992', '65536:65536', '2147483646:2147483646', '214748160:396774400', '214748160:396774400', '214748160:396774400', '214748160:396774400', '65536:65536', '131072:131072', '999999:999999', '65536:65536', '0:2147483647', '23999976:23999976', '180:180', '999999:999999', '500000:500000', '999999:999999', '2147483646:2147483646', '999999:999999', '256000:256000', 'v{VEID}.test.tld', '8.8.8.8 8.8.4.4', 'n', '', '', '');
11001101

11011102
-- --------------------------------------------------------
11021103

@@ -1153,6 +1154,7 @@ CREATE TABLE IF NOT EXISTS `openvz_vm` (
11531154
`create_dns` varchar(1) NOT NULL DEFAULT 'n',
11541155
`capability` text,
11551156
`features` text,
1157+
`iptabless` text,
11561158
`config` mediumtext,
11571159
PRIMARY KEY (`vm_id`)
11581160
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

interface/lib/plugins/vm_openvz_plugin.inc.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ private function applyTemplate() {
133133
$sql .= "nameserver = ?, ";
134134
$sql .= "create_dns = ?, ";
135135
$sql .= "capability = ?, ";
136-
$sql .= "features = ? ";
136+
$sql .= "features = ?, ";
137+
$sql .= "iptables = ? ";
137138
$sql .= "WHERE vm_id = ?";
138-
$app->db->query($sql, $tpl['diskspace'], $tpl['ram'], $tpl['ram_burst'], $tpl['cpu_units'], $tpl['cpu_num'], $tpl['cpu_limit'], $tpl['io_priority'], $tpl['nameserver'], $tpl['create_dns'], $tpl['capability'], $tpl['features'], $this->id);
139+
$app->db->query($sql, $tpl['diskspace'], $tpl['ram'], $tpl['ram_burst'], $tpl['cpu_units'], $tpl['cpu_num'], $tpl['cpu_limit'], $tpl['io_priority'], $tpl['nameserver'], $tpl['create_dns'], $tpl['capability'], $tpl['features'], $tpl['iptables'], $this->id);
139140

140141
}
141142

@@ -195,6 +196,7 @@ private function makeOpenVZConfig() {
195196
$tpl->setVar('nameserver', $vm['nameserver']);
196197
$tpl->setVar('capability', $vm['capability']);
197198
$tpl->setVar('features', $vm['features']);
199+
$tpl->setVar('iptables', $vm['iptables']);
198200

199201
$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ?", $app->functions->intval($vm['ostemplate_id']));
200202
$tpl->setVar('ostemplate', $tmp['template_file']);

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -616,14 +616,12 @@
616616
'width' => '40',
617617
'maxlength' => '255'
618618
),
619-
/*
620-
'vhost_rewrite_v6' => array (
621-
'datatype' => 'VARCHAR',
622-
'formtype' => 'CHECKBOX',
623-
'default' => 'n',
624-
'value' => array(0 => 'n',1 => 'y')
625-
),
626-
*/
619+
'vhost_rewrite_v6' => array (
620+
'datatype' => 'VARCHAR',
621+
'formtype' => 'CHECKBOX',
622+
'default' => 'n',
623+
'value' => array(0 => 'n',1 => 'y')
624+
),
627625
'vhost_conf_dir' => array(
628626
'datatype' => 'VARCHAR',
629627
'formtype' => 'TEXT',

interface/web/vm/form/openvz_template.tform.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,14 @@
467467
'width' => '30',
468468
'maxlength' => '255'
469469
),
470+
'iptables' => array (
471+
'datatype' => 'VARCHAR',
472+
'formtype' => 'TEXT',
473+
'default' => '',
474+
'value' => '',
475+
'width' => '30',
476+
'maxlength' => '255'
477+
),
470478
//#################################
471479
// ENDE Datatable fields
472480
//#################################

interface/web/vm/form/openvz_vm.tform.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@
314314
'width' => '30',
315315
'maxlength' => '255'
316316
),
317+
'iptables' => array (
318+
'datatype' => 'VARCHAR',
319+
'formtype' => 'TEXT',
320+
'default' => '',
321+
'value' => '',
322+
'width' => '30',
323+
'maxlength' => '255'
324+
),
317325
//#################################
318326
// ENDE Datatable fields
319327
//#################################

interface/web/vm/lib/lang/ar_openvz_template.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,5 @@ $wb['swappages_error_empty'] = 'Swappages is empty.';
9191
$wb['Template'] = 'Template';
9292
$wb['Advanced'] = 'Advanced';
9393
$wb['features_txt'] = 'Features';
94+
$wb[iptables_txt] = iptables;
9495
?>

interface/web/vm/lib/lang/ar_openvz_vm.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ $wb['template_nameserver_error_empty'] = 'Nameserver(s) is empty.';
3838
$wb['Virtual server'] = 'Virtual server';
3939
$wb['Advanced'] = 'Advanced';
4040
$wb['features_txt'] = 'Features';
41+
$wb[iptables_txt] = iptables;
4142
?>

interface/web/vm/lib/lang/bg_openvz_template.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,5 @@ $wb['swappages_error_empty'] = 'Swappages is empty.';
9191
$wb['Template'] = 'Template';
9292
$wb['Advanced'] = 'Advanced';
9393
$wb['features_txt'] = 'Features';
94+
$wb[iptables_txt] = iptables;
9495
?>

0 commit comments

Comments
 (0)