From ab138b2f6794e4e437b29e8e7d7070c1afad390e Mon Sep 17 00:00:00 2001 From: tbrehm Date: Mon, 7 Mar 2011 17:08:27 +0000 Subject: [PATCH] Fixed: FS#1547 - Uncompletely changed site's ownership. --- interface/web/sites/web_domain_edit.php | 6 +++--- server/plugins-available/apache2_plugin.inc.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 2f25ddbf0..1c0bcff1d 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -491,7 +491,7 @@ class page_action extends tform_actions { // Update the FTP user(s) too $records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = ".$this->id); foreach($records as $rec) { - $app->db->datalogUpdate('ftp_user', "uid = '$system_user', gid = '$system_group', dir = '$document_root'", 'ftp_user_id', $rec['ftp_user_id']); + $app->db->datalogUpdate('ftp_user', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."', uid = '$system_user', gid = '$system_group', dir = '$document_root'", 'ftp_user_id', $rec['ftp_user_id']); } unset($records); unset($rec); @@ -499,7 +499,7 @@ class page_action extends tform_actions { // Update the Shell user(s) too $records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = ".$this->id); foreach($records as $rec) { - $app->db->datalogUpdate('shell_user', "puser = '$system_user', pgroup = '$system_group', dir = '$document_root'", 'shell_user_id', $rec['shell_user_id']); + $app->db->datalogUpdate('shell_user', "sys_userid = '".$web_rec['sys_userid']."', sys_groupid = '".$web_rec['sys_groupid']."', puser = '$system_user', pgroup = '$system_group', dir = '$document_root'", 'shell_user_id', $rec['shell_user_id']); } unset($records); unset($rec); @@ -523,7 +523,7 @@ class page_action extends tform_actions { $sql = "UPDATE web_domain SET allow_override = '".$app->db->quote($web_config["htaccess_allow_override"])."' WHERE domain_id = ".$this->id; $app->db->query($sql); } - if($web_rec['php_open_basedir'] == '') { + if($web_rec['php_open_basedir'] == '' || (isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"])) { $document_root = $app->db->quote(str_replace("[client_id]",$client_id,$document_root)); $php_open_basedir = str_replace("[website_path]",$document_root,$web_config["php_open_basedir"]); $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir)); diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 7f356bff0..39fdaa7de 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -469,7 +469,7 @@ class apache2_plugin { exec("setquota -T -u $username 604800 604800 -a &> /dev/null"); } - if($this->action == 'insert') { + if($this->action == 'insert' || $data["new"]["system_user"] != $data["old"]["system_user"]) { // Chown and chmod the directories below the document root $this->_exec("chown -R $username:$groupname ".escapeshellcmd($data["new"]["document_root"])); // The document root itself has to be owned by root in normal level and by the web owner in security level 20 -- GitLab