Arrow 
larger font smaller font default font Fixed screen resolution Auto adjust screen size

Joomlapolis Forums  


Possible issue if exec() disabled
Date: 2006/05/14 02:12 By: plumbley Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 2
graphgraph
Hi - please excuse CB newbie if this is known issue - I've just installed CB today. Let me know if this is a proper bug and I should put on the tracker.

Issue: com_comprofiler may generate notices and warnings if PHP exec() is disabled (as is the case with e.g. my host, for security reasons).

My setup:
PHP 4.4.2 Apache 1.3.34 WinXP MySQL 4.1.18 (MySQL client libs 3.23.49)
php.ini includes:
* disable_functions shell_exec,exec,system,passthru,popen
* error_reporting 2047
Joomla 1.0.8
CB 1.0 Stable

To Reproduce:
(1) Login as administrator
(2) Go to the CB Configuration Manager
(.../administrator/index2.php?option=com_comprofiler&task=showconfig)

Results: Various notices and warnings starting with:
Notice: Undefined variable: output in c:program filesapache groupapachehtdocsjoomlaadministratorcomponentscom_comprofilerimgToolbox.class.php on line 626
Notice: Undefined variable: status in c:program filesapache groupapachehtdocsjoomlaadministratorcomponentscom_comprofilerimgToolbox.class.php on line 626
Warning: exec() has been disabled for security reasons in c:program filesapache groupapachehtdocsjoomlaadministratorcomponentscom_comprofilerimgToolbox.class.php on line 626
...

Here's the relevant bit from imgToolbox.class.php:
Code:

 function testIM(){    exec('convert -version'$output$status);    ... } function testNetPBM(){    exec('jpegtopnm -version 2>&1',  $output$status);    ... }


I guess this is looking to see what image software can be used. Sadly none since our host has blocked it

Other impacts: Cursory view of imgToolbox.class.php suggests it may rely on availability of exec() elsewhere, but perhaps only the ones at lines 626 and 634 really matter since the others will not be called of those fail.

Possible solution/workround: check ini_get(disable_functions) and give up on the tests immediately if it contains "exec". Here's what I did to fix it for me.
Code:

 diff imgToolbox.class.php imgToolbox.class.php.old 625,628d624 <     // Check if exec() is disabled, e.g. for security reasons <     function isExecDisabled(){ <         return in_array'exec'explode',',ini_get'disable_functions' ) ) ); <     } 630,632d625 <         if($this->isExecDisabled()){ <             return false;     // exec() is disabled, so give up <         } 641,643d633 <         if($this->isExecDisabled()){ <             return false;     // exec() is disabled, so give up <         }



I hope this is useful.

Best wishes,

Mark.
Click here to see the profile of this user The topic has been locked.

Re:Possible issue if exec() disabled
Date: 2006/06/21 05:12 By: Curros Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 2
graphgraph
Hi y have the same problem but y can´t find the directory where one is the file ini_get

Help PLEASE!!!
Click here to see the profile of this user The topic has been locked.

Re:Possible issue if exec() disabled
Date: 2006/06/21 15:58 By: beat Status: Admin  
Karma: 294  
Admin

Posts: 5992
graphgraph
plumbley wrote:
Hi - please excuse CB newbie if this is known issue - I've just installed CB today. Let me know if this is a proper bug and I should put on the tracker.

Issue: com_comprofiler may generate notices and warnings if PHP exec() is disabled (as is the case with e.g. my host, for security reasons).

My setup:
PHP 4.4.2 Apache 1.3.34 WinXP MySQL 4.1.18 (MySQL client libs 3.23.49)
php.ini includes:
* disable_functions shell_exec,exec,system,passthru,popen
* error_reporting 2047
Joomla 1.0.8
CB 1.0 Stable

To Reproduce:
(1) Login as administrator
(2) Go to the CB Configuration Manager
(.../administrator/index2.php?option=com_comprofiler&task=showconfig)

Results: Various notices and warnings starting with:
Notice: Undefined variable: output in c:program filesapache groupapachehtdocsjoomlaadministratorcomponentscom_comprofilerimgToolbox.class.php on line 626
Notice: Undefined variable: status in c:program filesapache groupapachehtdocsjoomlaadministratorcomponentscom_comprofilerimgToolbox.class.php on line 626
Warning: exec() has been disabled for security reasons in c:program filesapache groupapachehtdocsjoomlaadministratorcomponentscom_comprofilerimgToolbox.class.php on line 626
...

Here's the relevant bit from imgToolbox.class.php:
Code:

 function testIM(){    exec('convert -version'$output$status);    ... } function testNetPBM(){    exec('jpegtopnm -version 2>&1',  $output$status);    ... }


I guess this is looking to see what image software can be used. Sadly none since our host has blocked it

Other impacts: Cursory view of imgToolbox.class.php suggests it may rely on availability of exec() elsewhere, but perhaps only the ones at lines 626 and 634 really matter since the others will not be called of those fail.

Possible solution/workround: check ini_get(disable_functions) and give up on the tests immediately if it contains "exec". Here's what I did to fix it for me.
Code:

 diff imgToolbox.class.php imgToolbox.class.php.old 625,628d624 <     // Check if exec() is disabled, e.g. for security reasons <     function isExecDisabled(){ <         return in_array'exec'explode',',ini_get'disable_functions' ) ) ); <     } 630,632d625 <         if($this->isExecDisabled()){ <             return false;     // exec() is disabled, so give up <         } 641,643d633 <         if($this->isExecDisabled()){ <             return false;     // exec() is disabled, so give up <         }



I hope this is useful.

Best wishes,

Mark.


Cool. Thanks for the hint. Please log it with link to this thread at the bug tracker on forge:

http://forge.joomla.org/sf/tracker/do/listArtifacts/projects.cb/tracker.bugs

Thanks
Beat (beat)
Community Builder Team Member

Before posting on forums: Read all CB Articles | Specially the FAQ | Help us help you
CB links: Subscribe to CB documentation | Our templates | Paid Subscriptions | Get Hosting | Our Forge
Visit my CB Profile | Read my CB Blog

--
help us spend more time coding by helping others in this forum, many thanks
Click here to see the profile of this user The topic has been locked.

Re:Possible issue if exec() disabled
Date: 2006/08/08 23:10 By: olz Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 1
graphgraph
Hi!

It was not clearly for me which archive and that lines I have that to edit…

Sory may native language is portugues.

Thanks.
Click here to see the profile of this user The topic has been locked.

Re:Possible issue if exec() disabled
Date: 2006/10/05 04:19 By: dannorris Status: User  
Karma: 0  
Fresh Joomlapolitan

Posts: 5
graphgraph
hi mate, this sounds like what I need. However I am unsure where to paste your code that you have provided? and what to remove?

Thanks
Click here to see the profile of this user The topic has been locked.

CBSubs 1.0

CBSubs 1.0.3 released!

Find out more about the revolutionary new Joomla subscription system:

Info on CBSubs

CB 1.2.3 Documentation

Thank you bonus:

ProfileBook (+Blog) 1.2RC
ProfileGallery 1.2RC2
CB Privacy 1.0RC

What? Why? Where?

Click here for a yearly subscription: subscribe now

CB 1.2.3 Download

Community Builder 1.2.3
Stable and native for:
Joomla 1.5 & 1.0 & Mambo
(incl. CB 1.2.3 Installation pdf)
You need to be a registered member to download.

Full 180 pages updated
CB 1.2.3 documentation:
You need to be a CB doc subscriber to download.

CB Login