diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php index 1a8b30392e23f8d68b36bb5866b3ab0f4b042cc3..1492f3ed8ba1eff7da09b38ccb293e65dd77a257 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -335,7 +335,7 @@ $form["tabs"]['address'] = array ( 'errmsg'=> 'email_error_empty'), ), 'validators' => array ( 0 => array ( 'type' => 'REGEX', - 'regex' => '/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}$/i', + 'regex' => '/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i', 'errmsg'=> 'email_error_isemail'), ), 'default' => '', diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php index 77c4509b44e7e2c56c5ca72d80e16d3d30b2198e..2b606c2550bf869d746d7b1ebf9a7b8aadf71386 100644 --- a/interface/web/sites/shell_user_edit.php +++ b/interface/web/sites/shell_user_edit.php @@ -95,6 +95,12 @@ class page_action extends tform_actions { } else { $app->tpl->setVar("edit_disabled", 0); } + + if($this->dataRecord['chroot'] == 'jailkit'){ + $app->tpl->setVar("is_jailkit", true); + } else { + $app->tpl->setVar("is_jailkit", false); + } parent::onShowEnd(); } @@ -164,7 +170,11 @@ class page_action extends tform_actions { $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ?", $this->dataRecord["parent_domain_id"]); $server_id = $app->functions->intval($web["server_id"]); - $dir = $web["document_root"]; + if($this->dataRecord['chroot'] == 'jailkit'){ + $dir = $app->db->quote($web["document_root"]); + } else { + $dir = $app->db->quote($web["document_root"].'/home/'.$this->dataRecord['username']); + } $uid = $web["system_user"]; $gid = $web["system_group"]; @@ -218,7 +228,18 @@ class page_action extends tform_actions { function onAfterUpdate() { global $app, $conf; + if(isset($this->dataRecord['chroot'])){ + $shell_user = $app->db->queryOneRecord("SELECT * FROM shell_user WHERE shell_user_id = ".$this->id); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); + $dir = $shell_user['dir']; + if($this->dataRecord['chroot'] == 'jailkit'){ + $dir = $app->db->quote($web["document_root"]); + } else { + if($this->oldDataRecord['chroot'] == 'jailkit') $dir = $app->db->quote($web["document_root"].'/home/'.$this->dataRecord['username']); + } + if($dir != $shell_user['dir']) $app->db->query("UPDATE shell_user SET dir = '$dir' WHERE shell_user_id = ".$this->id); + } } } diff --git a/interface/web/sites/templates/shell_user_advanced.htm b/interface/web/sites/templates/shell_user_advanced.htm index 3e335f9dcdf5d378ad7177fc165135067a8d576f..bcbbdfa16d471731536daf9f3c267048bc7394e7 100644 --- a/interface/web/sites/templates/shell_user_advanced.htm +++ b/interface/web/sites/templates/shell_user_advanced.htm @@ -3,21 +3,27 @@

- - -
- -
-
- -
-
- -
-
- -
- +
+ +
+
+
+ +
+
+
+ +
+
+ + + +
+ +
+
+
+ diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 3437b55781f992f98eb2a065922d22161a17dabc..52bf73dac7024bff0e29a3aa2ccfac1f3c9d1b86 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -2985,13 +2985,15 @@ class nginx_plugin { } else { if($islocation){ - if(strpos($l, '{') !== false){ + $openingbracketpos = strrpos($l, '{'); + if($openingbracketpos !== false){ $level += 1; } - if(strpos($l, '}') !== false && $level > 0){ + $closingbracketpos = strrpos($l, '}'); + if($closingbracketpos !== false && $level > 0 && $closingbracketpos >= intval($openingbracketpos)){ $level -= 1; $locations[$location]['location'] .= $lines[$i]."\n"; - } elseif(strpos($l, '}') !== false && $level == 0){ + } elseif($closingbracketpos !== false && $level == 0 && $closingbracketpos >= intval($openingbracketpos)){ $islocation = false; } else { $locations[$location]['location'] .= $lines[$i]."\n"; diff --git a/server/plugins-available/shelluser_base_plugin.inc.php b/server/plugins-available/shelluser_base_plugin.inc.php index 8a51b1071a0a4133184bc9f9b86259d3c7f7c428..24b3469c8e1275292076a2866d468f65eef62c1e 100755 --- a/server/plugins-available/shelluser_base_plugin.inc.php +++ b/server/plugins-available/shelluser_base_plugin.inc.php @@ -136,6 +136,10 @@ class shelluser_base_plugin { exec($command); $app->log("Executed command: ".$command, LOGLEVEL_DEBUG); $app->log("Added shelluser: ".$data['new']['username'], LOGLEVEL_DEBUG); + + $app->system->chown(escapeshellcmd($data['new']['dir']),escapeshellcmd($data['new']['username'])); + $app->system->chgrp(escapeshellcmd($data['new']['dir']),escapeshellcmd($data['new']['pgroup'])); + // call the ssh-rsa update function $app->uses("getconf"); diff --git a/server/plugins-available/shelluser_jailkit_plugin.inc.php b/server/plugins-available/shelluser_jailkit_plugin.inc.php index 4c400c72af7d95a8f3206a96da6d4201b91cd540..5645953bdf9c69454cf4c7d86e79e12dbab28e13 100755 --- a/server/plugins-available/shelluser_jailkit_plugin.inc.php +++ b/server/plugins-available/shelluser_jailkit_plugin.inc.php @@ -386,7 +386,10 @@ class shelluser_jailkit_plugin { } }*/ - $app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh'); + $shell = '/usr/sbin/jk_chrootsh'; + if($this->data['new']['active'] != 'y') $shell = '/bin/false'; + + $app->system->usermod($this->data['new']['username'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, $shell); $app->system->usermod($this->data['new']['puser'], 0, 0, $this->data['new']['dir'].'/.'.$jailkit_chroot_userhome, '/usr/sbin/jk_chrootsh'); $this->app->log("Added jailkit user to chroot with command: ".$command, LOGLEVEL_DEBUG);