lytboris                                 Fri, 13 Jan 2012 18:46:56 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=322214

Log:
merge from trunk:
Fixed bug #60585 (php build fails with USE flag snmp when IPv6 support is 
disabled
Fixed bug #60749 (SNMP module should not strip non-standard SNMP port from 
hostname

Bugs: https://bugs.php.net/60585 (Assigned) php build fails with USE flag snmp 
when IPv6 support is disabled
      https://bugs.php.net/60749 (Assigned) SNMP module should not strip 
non-standard SNMP port from hostname
      
Changed paths:
    U   php/php-src/branches/PHP_5_4/NEWS
    _U  php/php-src/branches/PHP_5_4/ext/snmp/
    U   php/php-src/branches/PHP_5_4/ext/snmp/snmp.c
    _U  php/php-src/branches/PHP_5_4/ext/snmp/tests/
    A + php/php-src/branches/PHP_5_4/ext/snmp/tests/bug60749.phpt
        (from php/php-src/trunk/ext/snmp/tests/bug60749.phpt:r322213)
    U   php/php-src/branches/PHP_5_4/ext/snmp/tests/ipv6.phpt

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2012-01-13 18:34:21 UTC (rev 322213)
+++ php/php-src/branches/PHP_5_4/NEWS   2012-01-13 18:46:56 UTC (rev 322214)
@@ -12,6 +12,12 @@
   . Fixed bug #53280 (segfaults if query column count less than param count).
     (Mariuz)

+- SNMP:
+  . Fixed bug #60585 (php build fails with USE flag snmp when IPv6 support
+    is disabled). (Boris Lytochkin)
+  . Fixed bug #60749 (SNMP module should not strip non-standard SNMP port
+    from hostname). (Boris Lytochkin)
+
 07 Jan 2012, PHP 5.4.0 RC5
 - Core:
   . Fixed bug #60613 (Segmentation fault with $cls->{expr}() syntax). (Dmitry)


Property changes on: php/php-src/branches/PHP_5_4/ext/snmp
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/php/php-src/trunk/ext/snmp:284726,311033-315236,315606,315608,315862,315924,316022,316029,316031
   + 
/php/php-src/trunk/ext/snmp:284726,311033-315236,315606,315608,315862,315924,316022,316029,316031,322213

Modified: php/php-src/branches/PHP_5_4/ext/snmp/snmp.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/snmp/snmp.c        2012-01-13 18:34:21 UTC 
(rev 322213)
+++ php/php-src/branches/PHP_5_4/ext/snmp/snmp.c        2012-01-13 18:46:56 UTC 
(rev 322214)
@@ -1171,11 +1171,11 @@
                        continue;
                }
 #else
-               if (res->sa_family != AF_INET) {
+               if ((*res)->sa_family != AF_INET) {
                        res++;
                        continue;
                }
-               strcat(pptr, inet_ntoa(res));
+               strcat(pptr, inet_ntoa(((struct 
sockaddr_in*)(*res))->sin_addr));
 #endif
                break;
        }
@@ -1188,6 +1188,12 @@
                There should be check for non-empty session->peername!
        */

+       /* put back non-standard SNMP port */
+       if (session->remote_port != SNMP_PORT) {
+               pptr = session->peername + strlen(session->peername);
+               sprintf(pptr, ":%d", session->remote_port);
+       }
+
        php_network_freeaddresses(psal);

        if (version == SNMP_VERSION_3) {


Property changes on: php/php-src/branches/PHP_5_4/ext/snmp/tests
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/php/php-src/trunk/ext/snmp/tests:284726,311033-315236,315386,315606,315608,315862,315916,315924,316022,316029,316031
   + 
/php/php-src/trunk/ext/snmp/tests:284726,311033-315236,315386,315606,315608,315862,315916,315924,316022,316029,316031,322213

Copied: php/php-src/branches/PHP_5_4/ext/snmp/tests/bug60749.phpt (from rev 
322213, php/php-src/trunk/ext/snmp/tests/bug60749.phpt)
===================================================================
--- php/php-src/branches/PHP_5_4/ext/snmp/tests/bug60749.phpt                   
        (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/snmp/tests/bug60749.phpt   2012-01-13 
18:46:56 UTC (rev 322214)
@@ -0,0 +1,28 @@
+--TEST--
+Bug #60749: SNMP module should not strip non-standard SNMP port from hostname
+--CREDITS--
+Boris Lytochkin
+--SKIPIF--
+<?php
+require_once(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+require_once(dirname(__FILE__).'/snmp_include.inc');
+
+$hostname = "php.net";
+$ip = gethostbyname($hostname);
+if (ip2long($ip) === FALSE) {
+       echo "Could not resolve $hostname properly!\n";
+       exit(1);
+}
+$port = 1161;
+$session = new SNMP(SNMP::VERSION_1, "$hostname:$port", $community, $timeout, 
$retries);
+$info = $session->info;
+if (strcmp($info["hostname"], "$ip:$port") !== 0) {
+       echo "'" . $info["hostname"] . "' != '$ip:$port'\n";
+}
+var_dump($session->close());
+?>
+--EXPECTF--
+bool(true)

Modified: php/php-src/branches/PHP_5_4/ext/snmp/tests/ipv6.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/snmp/tests/ipv6.phpt       2012-01-13 
18:34:21 UTC (rev 322213)
+++ php/php-src/branches/PHP_5_4/ext/snmp/tests/ipv6.phpt       2012-01-13 
18:46:56 UTC (rev 322214)
@@ -4,16 +4,17 @@
 Boris Lytochkin
 --SKIPIF--
 <?php
-       require_once(dirname(__FILE__).'/skipif.inc');
+require_once(dirname(__FILE__).'/skipif.inc');

-       if (!function_exists("inet_ntop")) die("skip no inet_ntop()");
+$packed = str_repeat(chr(0), 15) . chr(1);
+if (@inet_ntop($packed) === false) {
+       die("skip no IPv6 support");
+}
 ?>
 --FILE--
 <?php
 require_once(dirname(__FILE__).'/snmp_include.inc');

-$default_port = 161;
-
 //EXPECTF format is quickprint OFF
 snmp_set_quick_print(false);
 snmp_set_valueretrieval(SNMP_VALUE_PLAIN);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to