Till Brehm
2014-09-30 49b3f5ec2a3c105652d451469eeb09a5ed75eba0
server/lib/classes/system.inc.php
@@ -34,7 +34,9 @@
   var $server_id;
   var $server_conf;
   var $data;
   var $min_uid = 500;
   var $min_gid = 500;
   /**
    * Construct for this class
    *
@@ -1720,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
@@ -1816,6 +1818,36 @@
      return true;
   }
   
   public function is_allowed_user($username, $check_id = true, $restrict_names = false) {
      global $app;
      $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;
      return true;
   }
   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('/^[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;
      return true;
   }
}
?>