Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-7038 now.

php_uname() function causes errors when disabled (fix completed in vcs)

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
Code: Select all
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.

Comments / History

Changed ticket status from "New" to "Reviewed"

Action performed by naderman (Development Team Leader) on Feb 27th 2008, 18:52

Posted by naderman (Development Team Leader) on Feb 27th 2008, 18:54

Should be fixed, as I can sort of understand the idea behind disabling php_uname() but the other method should only be a fall back as php_uname() is more likely correct.

Posted by Acyd Burn (Server Manager) on Feb 28th 2008, 10:26

Highway... is your editor having problems with spaces? ;)

Posted by Highway of Life (QA Team) on Feb 28th 2008, 18:23

Yes... it ATES THEM!! :lol:

Linked ticket with changeset: r8449

Action performed by Anonymous (I am too lazy to register) on Mar 18th 2008, 14:32

Assigned ticket to user "Acyd Burn"

Action performed by Acyd Burn (Server Manager) on Mar 18th 2008, 14:32

Changed ticket status from "Reviewed" to "Fix completed in SVN"

Action performed by Acyd Burn (Server Manager) on Mar 18th 2008, 14:32

Ticket details

Related SVN changesets