summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-10-01 11:47:07 +0200
committerGitHub <noreply@github.com>2018-10-01 11:47:07 +0200
commit1034efd64078ae303ace86d01164d00351fc58e8 (patch)
treed5e922b313b85d75ae74626f4cc352c138ba9a86 /lib/private
parent240d919cefc3b9ca1d94fc10bdda604defe99c81 (diff)
parentd4dec43f8fec7430840e878b698a6c62e09fd915 (diff)
downloadnextcloud-server-1034efd64078ae303ace86d01164d00351fc58e8.tar.gz
nextcloud-server-1034efd64078ae303ace86d01164d00351fc58e8.zip
Merge pull request #11461 from nextcloud/feature/noid/drop-find-and-pass-additional-paths
Dont use find to lookup binaries
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/legacy/helper.php15
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php
index 8373c191dce..5a05e147c2b 100644
--- a/lib/private/legacy/helper.php
+++ b/lib/private/legacy/helper.php
@@ -505,20 +505,7 @@ class OC_Helper {
if (self::is_function_enabled('exec')) {
$exeSniffer = new ExecutableFinder();
// Returns null if nothing is found
- $result = $exeSniffer->find($program);
- if (empty($result)) {
- $paths = getenv('PATH');
- if (empty($paths)) {
- $paths = '/usr/local/bin /usr/bin /opt/bin /bin';
- } else {
- $paths = str_replace(':',' ',getenv('PATH'));
- }
- $command = 'find ' . $paths . ' -name ' . escapeshellarg($program) . ' 2> /dev/null';
- exec($command, $output, $returnCode);
- if (count($output) > 0) {
- $result = escapeshellcmd($output[0]);
- }
- }
+ $result = $exeSniffer->find($program, null, ['/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/opt/bin']);
}
// store the value for 5 minutes
$memcache->set($program, $result, 300);