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 |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/lib/classes/system.inc.php b/server/lib/classes/system.inc.php
index 3001c64..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
@@ -1824,7 +1824,7 @@
 		$name_blacklist = array('root','ispconfig','vmail','getmail');
 		if(in_array($username,$name_blacklist)) return false;
 		
-		if(preg_match('/^[\w\.\-]{0,32}$/', $username) == false) 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;
 		
@@ -1833,15 +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;
 		
 		$name_blacklist = array('root','ispconfig','vmail','getmail');
 		if(in_array($groupname,$name_blacklist)) return false;
 		
-		if(preg_match('/^[\w\.\-]{0,32}$/', $groupname) == false) return false;
+		if(preg_match('/^[a-zA-Z0-9\.\-_]{1,32}$/', $groupname) == false) return false;
 		
-		if(intval($this->getgid($groupname)) < $this->min_gid) 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