From ebd0e986ed11f2a34fb58cdd33efbfab192083ad Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Fri, 22 Apr 2016 05:26:17 -0400
Subject: [PATCH] Added PHP 7 check in installer and updater.
---
server/lib/classes/system.inc.php | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 049eb61..b92cae5 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -1721,14 +1721,14 @@
function getinitcommand($servicename, $action, $init_script_directory = ''){
global $conf;
- // systemd
- if(is_executable('/bin/systemd')){
- return 'systemctl '.$action.' '.$servicename.'.service';
- }
// upstart
if(is_executable('/sbin/initctl')){
exec('/sbin/initctl version 2>/dev/null | /bin/grep -q upstart', $retval['output'], $retval['retval']);
if(intval($retval['retval']) == 0) return 'service '.$servicename.' '.$action;
+ }
+ // systemd
+ if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){
+ return 'systemctl '.$action.' '.$servicename.'.service';
}
// sysvinit
if($init_script_directory == '') $init_script_directory = $conf['init_scripts'];
@@ -1765,8 +1765,8 @@
global $app;
$cmd = '';
- if(is_installed('apache2ctl')) $cmd = 'apache2ctl -t -D DUMP_MODULES';
- elseif(is_installed('apachectl')) $cmd = 'apachectl -t -D DUMP_MODULES';
+ if($this->is_installed('apache2ctl')) $cmd = 'apache2ctl -t -D DUMP_MODULES';
+ elseif($this->is_installed('apachectl')) $cmd = 'apachectl -t -D DUMP_MODULES';
else {
$app->log("Could not check apache modules, apachectl not found.", LOGLEVEL_WARN);
return array();
@@ -1821,7 +1821,11 @@
public function is_allowed_user($username, $check_id = true, $restrict_names = false) {
global $app;
- if($username == 'root') return false;
+ $name_blacklist = array('root','ispconfig','vmail','getmail');
+ if(in_array($username,$name_blacklist)) return false;
+
+ if(preg_match('/^[a-zA-Z0-9\.\-_]{1,32}$/', $username) == false) return false;
+
if($check_id && intval($this->getuid($username)) < $this->min_uid) return false;
if($restrict_names == true && preg_match('/^web\d+$/', $username) == false) return false;
@@ -1829,11 +1833,15 @@
return true;
}
- public function is_allowed_group($groupname, $restrict_names = false) {
+ public function is_allowed_group($groupname, $check_id = true, $restrict_names = false) {
global $app;
- if($groupname == 'root') return false;
- if(intval($this->getgid($groupname)) < $this->min_gid) return false;
+ $name_blacklist = array('root','ispconfig','vmail','getmail');
+ if(in_array($groupname,$name_blacklist)) return false;
+
+ if(preg_match('/^[a-zA-Z0-9\.\-_]{1,32}$/', $groupname) == false) return false;
+
+ if($check_id && intval($this->getgid($groupname)) < $this->min_gid) return false;
if($restrict_names == true && preg_match('/^client\d+$/', $groupname) == false) return false;
--
Gitblit v1.9.1