Skip to content

Commit 3e199e6

Browse files
committed
test/bugfixing this MR
1 parent 05e629f commit 3e199e6

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

interface/web/sites/form/web_vhost_domain.tform.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@
10471047
'formtype' => 'TEXT',
10481048
'default' => '',
10491049
'validators' => array( 0 => array ('type' => 'REGEX',
1050-
'regex' => '/^[a-zA-Z0-9\-\_\ ]{1,512}$/',
1050+
'regex' => '/^[a-zA-Z0-9\-\_\ ]*$/',
10511051
'errmsg'=> 'jailkit_chroot_app_sections_error_regex'),
10521052
),
10531053
'value' => '',
@@ -1059,7 +1059,7 @@
10591059
'formtype' => 'TEXT',
10601060
'default' => '',
10611061
'validators' => array( 0 => array('type' => 'REGEX',
1062-
'regex' => '/^[a-zA-Z0-9\.\-\_\/\ ]{1,}$/',
1062+
'regex' => '/^[a-zA-Z0-9\.\-\_\/\ ]*$/',
10631063
'errmsg'=> 'jailkit_chroot_app_programs_error_regex'),
10641064
),
10651065
'value' => '',

interface/web/sites/templates/web_vhost_domain_advanced.htm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@
130130
<b>{tmpl_var name="available_proxy_directive_snippets_txt"}</b><br><br>&nbsp;{tmpl_var name="proxy_directive_snippets_txt"}
131131
</div>
132132
</div>
133-
<input type="hidden" name="id" value="{tmpl_var name='id'}">
134-
<div class="clear">
135-
<div class="right">
136-
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="sites/web_vhost_domain_edit.php">{tmpl_var name='btn_save_txt'}</button>
137-
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="sites/web_vhost_domain_list.php">{tmpl_var name='btn_cancel_txt'}</button>
138-
</div>
139-
</div>
140133
<div class="jailkit">
141134
<div class="form-group">
142135
<label class="col-sm-3 control-label">{tmpl_var name='jailkit_chroot_app_sections_txt'}</label>
@@ -157,6 +150,13 @@
157150
</div>
158151
</div>
159152
</div>
153+
<input type="hidden" name="id" value="{tmpl_var name='id'}">
154+
<div class="clear">
155+
<div class="right">
156+
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="sites/web_vhost_domain_edit.php">{tmpl_var name='btn_save_txt'}</button>
157+
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="sites/web_vhost_domain_list.php">{tmpl_var name='btn_cancel_txt'}</button>
158+
</div>
159+
</div>
160160

161161
<script language="JavaScript" type="text/javascript">
162162
var webId = jQuery('input[name="id"]').val();

server/lib/classes/system.inc.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,15 +2351,15 @@ public function create_jailkit_programs($home_dir, $programs = array(), $options
23512351
# prohibit ill-advised copying paths known to be sensitive/problematic
23522352
# (easy to bypass if needed, eg. use /./etc)
23532353
$blacklisted_paths_regex = array(
2354-
'|^/$|',
2355-
'|^/proc(/.*)?$|',
2356-
'|^/sys(/.*)?$|',
2357-
'|^/etc/?$|',
2358-
'|^/dev/?$|',
2359-
'|^/tmp/?$|',
2360-
'|^/run/?$|',
2361-
'|^/boot/?$|',
2362-
'|^/var(/?|/backups?/?)?$|',
2354+
'@^/$@',
2355+
'@^/proc(/.*)?$@',
2356+
'@^/sys(/.*)?$@',
2357+
'@^/etc/?$@',
2358+
'@^/dev/?$@',
2359+
'@^/tmp/?$@',
2360+
'@^/run/?$@',
2361+
'@^/boot/?$@',
2362+
'@^/var(/?|/backups?/?)?$@',
23632363
);
23642364

23652365
$program_args = '';
@@ -2460,8 +2460,10 @@ public function update_jailkit_chroot($home_dir, $sections = array(), $programs
24602460
continue;
24612461
}
24622462

2463+
$this->remove_broken_symlinks($dir, true);
2464+
24632465
// save list of hardlinked files
2464-
if (!in_array($opts, 'hardlink') && !in_array($options, 'allow_hardlink')) {
2466+
if (!in_array('hardlink', $opts) && !in_array('allow_hardlink', $options)) {
24652467
$find_multiple_links = function ( $path ) use ( &$find_multiple_links ) {
24662468
$found = array();
24672469
if (is_dir($path)) {
@@ -2487,6 +2489,7 @@ public function update_jailkit_chroot($home_dir, $sections = array(), $programs
24872489
}
24882490
}
24892491

2492+
// remove broken symlinks a second time after hardlink cleanup
24902493
$this->remove_broken_symlinks($dir, true);
24912494
}
24922495

@@ -2497,7 +2500,7 @@ public function update_jailkit_chroot($home_dir, $sections = array(), $programs
24972500
if (substr( $line, 0, 4 ) === "skip") {
24982501
continue;
24992502
}
2500-
if (preg_match('|^(? [^ ]+){6}(.+)$'.preg_quote($home_dir, '|').'|', $line, $matches)) {
2503+
if (preg_match('@^(? [^ ]+){6}(.+)'.preg_quote($home_dir, '@').'$@', $line, $matches)) {
25012504
# remove deprecated files that jk_update failed to remove
25022505
if (is_file($matches[1])) {
25032506
$app->log("removing deprecated file which jk_update failed to remove: ".$matches[1], LOGLEVEL_DEBUG);
@@ -2525,7 +2528,7 @@ public function update_jailkit_chroot($home_dir, $sections = array(), $programs
25252528
}
25262529

25272530
// search for any hardlinked files which are now missing
2528-
if (!in_array($opts, 'hardlink') && !in_array($options, 'allow_hardlink')) {
2531+
if (!in_array('hardlink', $opts) && !in_array('allow_hardlink', $options)) {
25292532
foreach ($multiple_links as $file) {
25302533
if (!is_file($file)) {
25312534
// strip $home_dir from $file
@@ -2552,7 +2555,7 @@ public function update_jailkit_chroot($home_dir, $sections = array(), $programs
25522555
$rewrite = false;
25532556
$jk_socketd_ini = $app->ini_parser->parse_ini_file('/etc/jailkit/jk_socketd.ini');
25542557
foreach ($jk_socketd_ini as $log => $settings) {
2555-
$jail = preg_replace('|/dev/log$|', '', $log);
2558+
$jail = preg_replace('@/dev/log$@', '', $log);
25562559
if ($jail != $log && !is_dir($jail)) {
25572560
unset($jk_socketd_ini[$log]);
25582561
$rewrite=true;

0 commit comments

Comments
 (0)