Skip to content

Commit 5026674

Browse files
committed
Load tpl in _setup_jailkit_chroot
Check prior creating symlinks in SFTP home directory if the symlinks already exists
1 parent 242f3c9 commit 5026674

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

server/plugins-available/cron_jailkit_plugin.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ function _setup_jailkit_chroot()
242242
{
243243
global $app, $conf;
244244

245+
$app->load('tpl');
246+
245247
if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
246248
if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
247249
$options = array('hardlink');

server/plugins-available/shelluser_base_plugin.inc.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ function insert($event_name, $data) {
174174
}
175175

176176
// Create symlinks for conveniance, SFTP user should not land in an empty dir.
177-
symlink('../../web', $homedir.'/web');
178-
symlink('../../log', $homedir.'/log');
179-
symlink('../../private', $homedir.'/private');
177+
if(!is_link($homedir.'/web')) symlink('../../web', $homedir.'/web');
178+
if(!is_link($homedir.'/log')) symlink('../../log', $homedir.'/log');
179+
if(!is_link($homedir.'/private')) symlink('../../private', $homedir.'/private');
180180

181181
//* Disable shell user temporarily if we use jailkit
182182
if($data['new']['chroot'] == 'jailkit') {

server/plugins-available/shelluser_jailkit_plugin.inc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ function _setup_jailkit_chroot()
330330
{
331331
global $app, $conf;
332332

333+
$app->load('tpl');
334+
333335
if (isset($this->jailkit_config) && isset($this->jailkit_config['jailkit_hardlinks'])) {
334336
if ($this->jailkit_config['jailkit_hardlinks'] == 'yes') {
335337
$options = array('hardlink');
@@ -724,7 +726,7 @@ function _add_bashrc_jailkit() {
724726
}
725727

726728
if($app->system->is_redhat_os() == true) {
727-
$bashrc = $this->web['document_root'] . '/home/' . $this->web['system_user'] . '/.bashrc';
729+
$bashrc = $this->web['document_root'] . '/etc/bashrc';
728730
} else {
729731
$bashrc = $this->web['document_root'] . '/etc/bash.bashrc';
730732
}

0 commit comments

Comments
 (0)