From 6d6643de2b6fc47b15e27c46266f22866c1cd1a8 Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Wed, 24 Sep 2014 09:47:20 -0400
Subject: [PATCH] Fixed service restart problems on CentOS 7.

---
 server/lib/classes/system.inc.php |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 049eb61..d227792 100644
--- a/server/lib/classes/system.inc.php
+++ b/server/lib/classes/system.inc.php
@@ -1722,7 +1722,7 @@
 	function getinitcommand($servicename, $action, $init_script_directory = ''){
 		global $conf;
 		// systemd
-		if(is_executable('/bin/systemd')){
+		if(is_executable('/bin/systemd') || is_executable('/usr/bin/systemctl')){
 			return 'systemctl '.$action.' '.$servicename.'.service';
 		}
 		// upstart
@@ -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