Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-7038

php_uname() function causes errors when disabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 3.0.1
    • 3.0.0
    • Other
    • None
    • PHP Environment:
      Database:

      There are some hosts that disable the usage of the php_uname(); function for security reasons.
      This will cause errors in the digest_md5(); and log_into_server(); functions in functions_messenger.php

      Patch: – SVN WC of 3.1 Trunk

      Index: functions_messenger.php
      ===================================================================
      --- functions_messenger.php	(revision 8415)
      +++ functions_messenger.php	(working copy)
      @@ -683,7 +683,7 @@
       				break;
       			}
       		}
      -	
      +
       		if (!sizeof($this->queue_data))
       		{
       			@unlink($this->cache_file);
      @@ -713,11 +713,11 @@
       		{
       			return;
       		}
      -		
      +
       		if (file_exists($this->cache_file))
       		{
       			include($this->cache_file);
      -			
      +
       			foreach ($this->queue_data as $object => $data_ary)
       			{
       				if (isset($this->data[$object]) && sizeof($this->data[$object]))
      @@ -1047,7 +1047,7 @@
       			$err_msg .= $message;
       		}
       	}
      -	
      +
       	/**
       	* Log into server and get possible auth codes if neccessary
       	*/
      @@ -1056,9 +1056,16 @@
       		global $user;
       
       		$err_msg = '';
      -		$local_host = php_uname('n');
      -		$local_host = (empty($local_host)) ? 'localhost' : $local_host;
       
      +		if (function_exists('php_uname'))
      +		{
      +			$local_host = php_uname('n');
      +		}
      +		else
      +		{
      +			$local_host = $user->host;
      +		}
      +
       		// If we are authenticating through pop-before-smtp, we
       		// have to login ones before we get authenticated
       		// NOTE: on some configurations the time between an update of the auth database takes so
      @@ -1109,7 +1116,7 @@
       				return false;
       			}
       
      -			// If EHLO fails, we try HELO			
      +			// If EHLO fails, we try HELO
       			$this->server_send("HELO {$local_host}");
       			if ($err_msg = $this->server_parse('250', __LINE__))
       			{
      @@ -1130,7 +1137,7 @@
       		{
       			return false;
       		}
      -		
      +
       		if (!isset($this->commands['AUTH']))
       		{
       			return (isset($user->lang['SMTP_NO_AUTH_SUPPORT'])) ? $user->lang['SMTP_NO_AUTH_SUPPORT'] : 'SMTP server does not support authentication';
      @@ -1291,7 +1298,7 @@
       		}
       
       		$md5_challenge = base64_decode($this->responses[0]);
      -		
      +
       		// Parse the md5 challenge - from AUTH_SASL (PEAR)
       		$tokens = array();
       		while (preg_match('/^([a-z-]+)=("[^"]+(?<!\\\)"|[^,]+)/i', $md5_challenge, $matches))
      @@ -1332,7 +1339,14 @@
       		// Realm
       		if (empty($tokens['realm']))
       		{
      -			$tokens['realm'] = php_uname('n');
      +			if (function_exists('php_uname'))
      +			{
      +				$tokens['realm'] = php_uname('n');
      +			}
      +			else
      +			{
      +				$tokens['realm'] = $user->host;
      +			}
       		}
       
       		// Maxbuf

      – some line changes above are removed spaces.

            Acyd Burn Meik Sievertsen [X] (Inactive)
            Highway of Life David Lewis [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: