From ea475743178599f2f7fc0ad6e5d617a6d6a3137a Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 3 Mar 2018 13:42:17 -0600 Subject: [PATCH 1/2] X509: add methods to enable / disable URL fetching --- phpseclib/File/X509.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 74afa4be..34a9c585 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -328,6 +328,14 @@ class File_X509 */ var $recur_limit = 5; + /** + * URL fetch flag + * + * @var bool + * @access private + */ + var $disable_url_fetch = false; + /** * Default Constructor. * @@ -2161,6 +2169,10 @@ class File_X509 */ function _fetchURL($url) { + if ($this->disable_url_fetch) { + return false; + } + $parts = parse_url($url); $data = ''; switch ($parts['scheme']) { @@ -2472,6 +2484,26 @@ class File_X509 $this->recur_limit = $count; } + /** + * Prevents URIs from being automatically retrieved + * + * @access public + */ + function disableURLFetch() + { + $this->disable_url_fetch = true; + } + + /** + * Allows URIs to be automatically retrieved + * + * @access public + */ + function enableURLFetch() + { + $this->disable_url_fetch = false; + } + /** * Reformat public keys * From fc90c58f7f4e6c375a0dadfe5fad27e694f8c50f Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 3 Mar 2018 13:44:11 -0600 Subject: [PATCH 2/2] X509: update disable/enableURLFetch to work with 2.0 branch --- phpseclib/File/X509.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 6f004ff0..3298ccd0 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -319,7 +319,7 @@ class X509 * @var bool * @access private */ - var $disable_url_fetch = false; + static $disable_url_fetch = false; /** * Default Constructor. @@ -2129,7 +2129,7 @@ class X509 */ static function _fetchURL($url) { - if ($this->disable_url_fetch) { + if (self::$disable_url_fetch) { return false; } @@ -2446,9 +2446,9 @@ class X509 * * @access public */ - function disableURLFetch() + static function disableURLFetch() { - $this->disable_url_fetch = true; + self::$disable_url_fetch = true; } /** @@ -2456,9 +2456,9 @@ class X509 * * @access public */ - function enableURLFetch() + static function enableURLFetch() { - $this->disable_url_fetch = false; + self::$disable_url_fetch = false; } /**