Commit 8dad727d authored by Franco Fichtner's avatar Franco Fichtner

plugins: protect against faulty updates

(cherry picked from commit 200bd3ee)
(cherry picked from commit 1464b111)
(cherry picked from commit 8ba7da8f)
parent 9f9313da
......@@ -30,9 +30,10 @@
* scan plugins for legacy system
* @return array
*/
function plugins_scan($search = '')
function plugins_scan()
{
$path = '/usr/local/etc/inc/plugins.inc.d/';
$clash = '/usr/local/etc/inc/';
$ext = '.inc';
$ret = array();
......@@ -47,7 +48,16 @@ function plugins_scan($search = '')
foreach ($plugins as $plugin) {
$name = preg_replace('/' . preg_quote($path, '/') . '/', '', $plugin);
$name = preg_replace('/' . preg_quote($ext, '/') . '/', '', $name);
if (!empty($search) && $search !== $name) {
if (file_exists($clash . $name . '.inc') || file_exists($clash . $name . '.class')) {
/*
* Congratulations, you found the reason why your plugin doesn't
* work! It seems that you're using a name that is already taken
* by the base system. Please change the name of your plugin.
*
* A traceable call stack requires unique prefixes, which is what
* will prevent this from working. Do not remove this check
* without discussing the consequences with the authors.
*/
continue;
}
$ret[$name] = $plugin;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment