Skip to content
Snippets Groups Projects
Commit f343e169 authored by Marius Burkard's avatar Marius Burkard
Browse files

Insufficient escaping of whitespace in FTP user paths, fixes #5350

parent eae23686
No related branches found
No related tags found
No related merge requests found
...@@ -276,7 +276,10 @@ if($app->auth->is_admin()) { ...@@ -276,7 +276,10 @@ if($app->auth->is_admin()) {
'formtype' => 'TEXT', 'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'directory_error_empty'), 'errmsg'=> 'directory_error_empty'),
1 => array ( 'type' => 'CUSTOM', 1 => array ( 'type' => 'REGEX',
'regex' => '/^\/[a-zA-Z0-9\ \.\-\_\/]{10,128}$/',
'errmsg'=> 'directory_error_regex'),
2 => array ( 'type' => 'CUSTOM',
'class' => 'validate_ftpuser', 'class' => 'validate_ftpuser',
'function' => 'ftp_dir', 'function' => 'ftp_dir',
'errmsg' => 'directory_error_notinweb'), 'errmsg' => 'directory_error_notinweb'),
......
...@@ -83,8 +83,7 @@ class ftpuser_base_plugin { ...@@ -83,8 +83,7 @@ class ftpuser_base_plugin {
} }
$app->system->web_folder_protection($web['document_root'], false); $app->system->web_folder_protection($web['document_root'], false);
exec('mkdir -p '.escapeshellcmd($data['new']['dir'])); $app->system->mkdirpath($data['new']['dir'], 0755, $web["system_user"], $web["system_group"]);
exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
$app->system->web_folder_protection($web['document_root'], true); $app->system->web_folder_protection($web['document_root'], true);
$app->log("Added ftpuser_dir: ".$data['new']['dir'], LOGLEVEL_DEBUG); $app->log("Added ftpuser_dir: ".$data['new']['dir'], LOGLEVEL_DEBUG);
...@@ -109,8 +108,7 @@ class ftpuser_base_plugin { ...@@ -109,8 +108,7 @@ class ftpuser_base_plugin {
} }
$app->system->web_folder_protection($web['document_root'], false); $app->system->web_folder_protection($web['document_root'], false);
exec('mkdir -p '.escapeshellcmd($data['new']['dir'])); $app->system->mkdirpath($data['new']['dir'], 0755, $web["system_user"], $web["system_group"]);
exec('chown '.escapeshellcmd($web["system_user"]).':'.escapeshellcmd($web['system_group']).' '.$data['new']['dir']);
$app->system->web_folder_protection($web['document_root'], true); $app->system->web_folder_protection($web['document_root'], true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment