Bug #25699

indexing of external files may be prevented by php's open_basedir restriction (Bug 18520 in core)

Added by Christian Hernmarck over 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Indexed Search
Target version:
-
Start date:
2011-04-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

See
http://forge.typo3.org/issues/18520

***
class.external_parser.php tries to check the existence with is_file(). This fails in my case because of an existing open-basedir-restriction in php.

The attached patch fixes this problem by disabling the check if an open_basedir restriction is in effect (which is already done this way if you have safe_mode on)
(issue imported from #M7969)

Related issues

Related to TYPO3 Core - Bug #44381: indexed_search FE Plugin doesn't show external urls in TYPO3 4.7.7ClosedTymoteusz Motylewski2013-01-08

Actions
Related to TYPO3 Core - Bug #18520: indexing of external files may be prevented by php's open_basedir restrictionClosed2008-03-31

Actions
Related to TYPO3 Core - Bug #64882: open_basedir restriction in effectClosed2015-02-05

Actions
#1

Updated by Christian Hernmarck over 10 years ago

What's going on with this issue?

what can I do to push this? In the core, bug 18520 has all patches for 4.3,4.4 and 4.5

I saw that in the new master branch someone (I'm new to git - could not see details..) worked on this file but instead of adding the open_basedir check (s)he kicked out the safemode check:

4.5 branch:

switch($extension) {
case 'pdf':
// PDF
if ($indexerConfig['pdftools']) {
$pdfPath = rtrim($indexerConfig['pdftools'], '/').'/';
if ($safeModeEnabled || (@is_file($pdfPath . 'pdftotext' . $exe) && @is_file($pdfPath . 'pdfinfo' . $exe))) {
$this->app['pdfinfo'] = $pdfPath.'pdfinfo'.$exe;
$this->app['pdftotext'] = $pdfPath.'pdftotext'.$exe;
// PDF mode:
$this->pdf_mode = t3lib_div::intInRange($indexerConfig['pdf_mode'],-100,100);
$extOK = TRUE;
} else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsNotFound'), $pdfPath), 3);
} else $this->pObj->log_setTSlogMessage($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsDisabled'), 1);
break;

new master branch:

switch($extension) {
case 'pdf':
// PDF
if ($indexerConfig['pdftools']) {
$pdfPath = rtrim($indexerConfig['pdftools'], '/').'/';
if (@is_file($pdfPath . 'pdftotext' . $exe) && @is_file($pdfPath . 'pdfinfo' . $exe)) {
$this->app['pdfinfo'] = $pdfPath.'pdfinfo'.$exe;
$this->app['pdftotext'] = $pdfPath.'pdftotext'.$exe;
// PDF mode:
$this->pdf_mode = t3lib_div::intInRange($indexerConfig['pdf_mode'],-100,100);
$extOK = TRUE;
} else $this->pObj->log_setTSlogMessage(sprintf($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsNotFound'), $pdfPath), 3);
} else $this->pObj->log_setTSlogMessage($this->sL('LLL:EXT:indexed_search/locallang.xml:pdfToolsDisabled'), 1);
break;

I'll do some tests but I think is_file won't return true if either safemode is enabled (ok this will be no more a problem with PHP6...) or open_basedir is set (and does not include the path to the file...)

is_file needs php access to the file (open_basedir) - exec does not....

/Ch

#2

Updated by Oliver Hader over 8 years ago

  • Target version set to 2222
#3

Updated by Oliver Hader over 8 years ago

  • Project changed from 1382 to TYPO3 Core
#4

Updated by Oliver Hader over 8 years ago

  • Category set to Indexed Search
#5

Updated by Oliver Hader over 8 years ago

  • Target version deleted (2222)
#6

Updated by Wouter Wolters almost 7 years ago

  • Status changed from New to Needs Feedback
  • TYPO3 Version set to 4.5
  • Is Regression set to No

Hi,

as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (6.2.9)?

#7

Updated by Christian Hernmarck almost 7 years ago

Yes - it does.

in Classes/FileContentParser.php we have this, as an example:

 if (@is_file(($pdfPath . 'pdftotext' . $exe)) && @is_file(($pdfPath . 'pdfinfo' . $exe))) {

this won't pass when open_basedir ist activated - with this one it works:

 if (ini_get('open_basedir') || (@is_file(($pdfPath . 'pdftotext' . $exe)) && @is_file(($pdfPath . 'pdfinfo' . $exe)))) {

php.ini:
open_basedir = "/var/www/virtual/<domain>:/usr/share/php:/var/www/webapps/:/usr/bin/"

I don't get an error (is_file... is not in allowed directory) but it's always false... even if file is there...)

#8

Updated by Christian Hernmarck almost 7 years ago

btw: 6.2.9 :-)

#9

Updated by Christian Hernmarck almost 7 years ago

Sorry guys
I was wrong.
is_file works with open_basedir

It works with 6.2.9 out of the box.
My fault...

#10

Updated by Alexander Opitz almost 7 years ago

So this issue and #18520 can be closed?

#11

Updated by Alexander Opitz over 6 years ago

  • Status changed from Needs Feedback to Closed

No feedback within the last 90 days => closing this issue.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Also available in: Atom PDF