Skip to content

Commit 17c4a07

Browse files
committed
jailkit: fix php warnings (closes #6036)
1 parent 783d34c commit 17c4a07

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

server/lib/classes/system.inc.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,6 +2412,7 @@ public function create_jailkit_user($username, $home_dir, $user_home_dir, $shell
24122412

24132413
public function create_jailkit_chroot($home_dir, $app_sections = array(), $options = array()) {
24142414
global $app;
2415+
$app->log("create_jailkit_chroot: called for home_dir $home_dir with options: " . print_r($options, true), LOGLEVEL_DEBUG);
24152416

24162417
// Disallow operating on root directory
24172418
if(realpath($home_dir) == '/') {
@@ -2428,6 +2429,9 @@ public function create_jailkit_chroot($home_dir, $app_sections = array(), $optio
24282429
} elseif(is_string($app_sections)) {
24292430
$app_sections = preg_split('/[\s,]+/', $app_sections);
24302431
}
2432+
if(! is_array($options)) {
2433+
$options = (is_string($options) ? preg_split('/[\s,]+/', $options) : array());
2434+
}
24312435

24322436
// Change ownership of the chroot directory to root
24332437
$this->chown($home_dir, 'root');
@@ -2485,6 +2489,7 @@ public function create_jailkit_chroot($home_dir, $app_sections = array(), $optio
24852489

24862490
public function create_jailkit_programs($home_dir, $programs = array(), $options = array()) {
24872491
global $app;
2492+
$app->log("create_jailkit_programs: called for home_dir $home_dir with options: " . print_r($options, true), LOGLEVEL_DEBUG);
24882493

24892494
// Disallow operating on root directory
24902495
if(realpath($home_dir) == '/') {
@@ -2501,6 +2506,9 @@ public function create_jailkit_programs($home_dir, $programs = array(), $options
25012506
} elseif(is_string($programs)) {
25022507
$programs = preg_split('/[\s,]+/', $programs);
25032508
}
2509+
if(! is_array($options)) {
2510+
$options = (is_string($options) ? preg_split('/[\s,]+/', $options) : array());
2511+
}
25042512

25052513
# prohibit ill-advised copying paths known to be sensitive/problematic
25062514
# (easy to bypass if needed, eg. use /./etc)

0 commit comments

Comments
 (0)