diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index b2a87a75480..05fc13c0dbc 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -22,19 +22,22 @@ if (!defined("NOLOGIN")) { define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) } - require '../../main.inc.php'; +// Security if ($dolibarr_main_prod) { accessforbidden(); } -$usedolheader = 1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header + + +/* + * View + */ $form = new Form($db); - - +$usedolheader = 1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header // HEADER //-------- diff --git a/htdocs/public/test/test_csrf.php b/htdocs/public/test/test_csrf.php index c66ac19c423..94d76469f81 100644 --- a/htdocs/public/test/test_csrf.php +++ b/htdocs/public/test/test_csrf.php @@ -1,5 +1,38 @@ diff --git a/htdocs/public/test/test_exec.php b/htdocs/public/test/test_exec.php new file mode 100644 index 00000000000..8464ba2eb4f --- /dev/null +++ b/htdocs/public/test/test_exec.php @@ -0,0 +1,72 @@ +\n"; +print 'PHP_SESSION_DISABLED='.PHP_SESSION_DISABLED."
\n"; +print 'PHP_SESSION_NONE='.PHP_SESSION_NONE."
\n"; +print 'PHP_SESSION_ACTIVE='.PHP_SESSION_ACTIVE."
\n"; +print '
'; + +print 'session_status='.session_status().' (before main.inc.php)'; +print '
'; + +require '../../main.inc.php'; + +// Security +if ($dolibarr_main_prod) { + accessforbidden(); +} + + +/* + * View + */ + +print 'session_status='.session_status().' (after main.inc.php)'; +print '
'; + +//print 'a'.$_SESSION['disablemodules'].'b'; + +print "\n
This page is visible. It means you are not locked by another page called in same session."; + +//session_write_close(); diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php index d89e04e12a6..c025151bdb9 100644 --- a/htdocs/public/test/test_forms.php +++ b/htdocs/public/test/test_forms.php @@ -8,10 +8,16 @@ if (!defined('NOSESSION')) { require '../../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +// Security if ($dolibarr_main_prod) { accessforbidden(); } + +/* + * View + */ + llxHeader(); ?> diff --git a/htdocs/public/test/test_sessionlock.php b/htdocs/public/test/test_sessionlock.php index 18a1ef73d08..83d21f38aae 100644 --- a/htdocs/public/test/test_sessionlock.php +++ b/htdocs/public/test/test_sessionlock.php @@ -52,17 +52,34 @@ print '
'; require '../../main.inc.php'; -/* No need for this. +// Security if ($dolibarr_main_prod) { accessforbidden(); } -*/ -print 'session_status='.session_status().' (after main.inc.php)'; -print '
'; -//print 'a'.$_SESSION['disablemodules'].'b'; +/* + * View + */ -print "\n
This page is visible. It means you are not locked by another page called in same session."; +echo "Test\n"; +$out=''; +$ret=0; -//session_write_close(); +$file = '/tmp/aaa'; +$f=fopen($file, 'r'); +if ($f) { + $s=fread($f, 4096); + print $s; + fclose($f); +} else { + print "Failed to open file ".$file."\n"; +} + +exec('ls /dev/std*; sleep 1;', $out, $ret); +var_dump($ret); +var_dump($out); + +exec('/usr/bin/clamdscan --fdpass filethatdoesnotexists.php', $out, $ret); +var_dump($ret); +var_dump($out); From 0c27182c6a8fa9bff72c2d55711728d98adefea1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Nov 2021 20:58:34 +0100 Subject: [PATCH 0921/1231] Fix test --- htdocs/public/test/test_exec.php | 25 ++++++++++++++++++++----- htdocs/public/test/test_sessionlock.php | 23 +++++------------------ 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/htdocs/public/test/test_exec.php b/htdocs/public/test/test_exec.php index 8464ba2eb4f..603671e893d 100644 --- a/htdocs/public/test/test_exec.php +++ b/htdocs/public/test/test_exec.php @@ -62,11 +62,26 @@ if ($dolibarr_main_prod) { * View */ -print 'session_status='.session_status().' (after main.inc.php)'; -print '
'; +echo "Test
\n"; +$out=''; +$ret=0; -//print 'a'.$_SESSION['disablemodules'].'b'; +$file = '/tmp/aaa'; +$f=fopen($file, 'r'); +if ($f) { + $s=fread($f, 4096); + print $s; + fclose($f); +} else { + print "Failed to open file ".$file."
\n"; +} -print "\n
This page is visible. It means you are not locked by another page called in same session."; +exec('ls /dev/std*; sleep 1;', $out, $ret); +print $ret."
\n"; +print_r($out); -//session_write_close(); +$ret = 0; +$out = null; +exec('/usr/bin/clamdscan --fdpass filethatdoesnotexists.php', $out, $ret); +print $ret."
\n"; +print_r($out); diff --git a/htdocs/public/test/test_sessionlock.php b/htdocs/public/test/test_sessionlock.php index 83d21f38aae..8464ba2eb4f 100644 --- a/htdocs/public/test/test_sessionlock.php +++ b/htdocs/public/test/test_sessionlock.php @@ -62,24 +62,11 @@ if ($dolibarr_main_prod) { * View */ -echo "Test\n"; -$out=''; -$ret=0; +print 'session_status='.session_status().' (after main.inc.php)'; +print '
'; -$file = '/tmp/aaa'; -$f=fopen($file, 'r'); -if ($f) { - $s=fread($f, 4096); - print $s; - fclose($f); -} else { - print "Failed to open file ".$file."\n"; -} +//print 'a'.$_SESSION['disablemodules'].'b'; -exec('ls /dev/std*; sleep 1;', $out, $ret); -var_dump($ret); -var_dump($out); +print "\n
This page is visible. It means you are not locked by another page called in same session."; -exec('/usr/bin/clamdscan --fdpass filethatdoesnotexists.php', $out, $ret); -var_dump($ret); -var_dump($out); +//session_write_close(); From b3e9e5c4628fb992952806a038f2d7096f013be4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Nov 2021 21:37:43 +0100 Subject: [PATCH 0922/1231] Enhance test --- htdocs/public/test/test_exec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/test/test_exec.php b/htdocs/public/test/test_exec.php index 603671e893d..a25e860021c 100644 --- a/htdocs/public/test/test_exec.php +++ b/htdocs/public/test/test_exec.php @@ -76,7 +76,7 @@ if ($f) { print "Failed to open file ".$file."
\n"; } -exec('ls /dev/std*; sleep 1;', $out, $ret); +exec('cat /aaa; ls /dev/std*; sleep 1;', $out, $ret); print $ret."
\n"; print_r($out); From 01038b190da15fdc8d2f053c2fb08476c71c7234 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 24 Nov 2021 22:35:10 +0100 Subject: [PATCH 0923/1231] Better error report on id command that failed --- htdocs/admin/system/web.php | 7 ++++++- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/web.php b/htdocs/admin/system/web.php index 93af0097087..921fd839109 100644 --- a/htdocs/admin/system/web.php +++ b/htdocs/admin/system/web.php @@ -70,9 +70,14 @@ if ($labeluser && $labelgroup) { if (function_exists('exec')) { $arrayout = array(); $varout = 0; exec('id', $arrayout, $varout); + print ''.$langs->trans("WebUserGroup")." (real, 'id' command)"; if (empty($varout)) { // Test command is ok. Work only on Linux OS. - print ''.$langs->trans("WebUserGroup")." (real, 'id' command)".join(',', $arrayout)."\n"; + print join(',', $arrayout); + } else { + $langs->load("errors"); + print ''.$langs->trans("ErrorExecIdFailed").''; } + print "\n"; } print ''; print '