Source for file file_support.php

Documentation is available at file_support.php

  1. <?php
  2. /**
  3. * Test class for CURL file_support
  4. *
  5. * @package PhpSecInfo
  6. * @author Ed Finkler <coj@funkatron.com>
  7. */
  8.  
  9. /**
  10. * require the PhpSecInfo_Test_Curl class
  11. */
  12. require_once('PhpSecInfo/Test/Test_Curl.php');
  13.  
  14. /**
  15. * Test class for CURL file_support
  16. *
  17. * Checks for CURL file:// support; if this is installed, it can be used to bypass
  18. * safe_mode and open_basedir
  19. *
  20. * @todo I believe this hole was plugged in PHP 5.1.5 and 4.4.4(?). This test should be updated to take this into consideration (check the version and decide what to do)
  21. *
  22. * @package PhpSecInfo
  23. * @author Ed Finkler <coj@funkatron.com>
  24. */
  25. class PhpSecInfo_Test_Curl_File_Support extends PhpSecInfo_Test_Curl
  26. {
  27.  
  28. /**
  29. * This should be a <b>unique</b>, human-readable identifier for this test
  30. *
  31. * @var string
  32. */
  33. var $test_name = "file_support";
  34. /**
  35. * Checks to see if libcurl's "file://" support is enabled by examining the "protocols" array
  36. * in the info returned from curl_version()
  37. * @return integer
  38. *
  39. */
  40. function _execTest() {
  41. $curlinfo = curl_version();
  42.  
  43. if (!in_array('file', $curlinfo['protocols'])) {
  44. return PHPSECINFO_TEST_RESULT_OK;
  45. } else {
  46. return PHPSECINFO_TEST_RESULT_WARN;
  47. }
  48. }
  49. /**
  50. * Set the messages specific to this test
  51. *
  52. */
  53. function _setMessages() {
  54. parent::_setMessages();
  55. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_OK, 'en', "file:// support in CURL seems to be disabled");
  56. $this->setMessageForResult(PHPSECINFO_TEST_RESULT_WARN, 'en', "libcurl's file:// support is enabled. This can be used to bypass safe mode and open_basedir restrictions. libcurl should be re-compiled with file:// support disabled");
  57. }
  58. }

Documentation generated on Tue, 24 Oct 2006 10:53:34 -0400 by phpDocumentor 1.3.0RC3