Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Aug 2012 20:40:37 +0200 (CEST)
From:      Martin Matuska <mm@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        wen@FreeBSD.org
Subject:   ports/170709: [PATCH] dns/pear-Net_DNS2: fix upstream bug #19569
Message-ID:  <20120817184037.10C469360@neo.vx.sk>
Resent-Message-ID: <201208171900.q7HJ0IdL086811@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         170709
>Category:       ports
>Synopsis:       [PATCH] dns/pear-Net_DNS2: fix upstream bug #19569
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 17 19:00:18 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Martin Matuska
>Release:        FreeBSD 9.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD neo.vx.sk 9.0-STABLE FreeBSD 9.0-STABLE #6 r237147M: Sat Jun 16 01:05:38 CEST
>Description:
Fix upstream bug #19569

References:
http://pear.php.net/bugs/bug.php?id=19569

Added file(s):
- files/patch-Net-DNS2-Socket-Streams.php

Port maintainer (wen@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99_6 (mode: change, diff: CVS)
>How-To-Repeat:
>Fix:

--- pear-Net_DNS2-1.2.2.patch begins here ---
Index: files/patch-Net-DNS2-Socket-Streams.php
===================================================================
RCS file: files/patch-Net-DNS2-Socket-Streams.php
diff -N files/patch-Net-DNS2-Socket-Streams.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-Net-DNS2-Socket-Streams.php	17 Aug 2012 18:39:40 -0000
@@ -0,0 +1,68 @@
+Index: Net/DNS2/Socket/Streams.php
+===================================================================
+--- Net/DNS2/Socket/Streams.php	(revision 164)
++++ Net/DNS2/Socket/Streams.php	(revision 165)
+@@ -329,27 +329,51 @@
+         //
+         // read the data from the socket
+         //
+-        $chunk = '';
+-        $chunk_size = $length;
+         $data = '';
+ 
+         //
+-        // loop so we make sure we read all the data
++        // the streams socket is weird for TCP sockets; it doesn't seem to always
++        // return all the data properly; but the looping code I added broke UDP
++        // packets- my fault- 
+         //
+-        while (1) {
++        // the sockets library works much better.
++        //
++        if ($this->type == SOCK_STREAM) {
+ 
+-            $chunk = fread($this->sock, $chunk_size);
+-            if ($chunk === false) {
++            $chunk = '';
++            $chunk_size = $length;
++
++            //
++            // loop so we make sure we read all the data
++            //
++            while (1) {
++
++                $chunk = fread($this->sock, $chunk_size);
++                if ($chunk === false) {
+             
+-                $this->last_error = 'failed on fread() for data';
+-                return false;
++                    $this->last_error = 'failed on fread() for data';
++                    return false;
++                }
++
++                $data .= $chunk;
++                $chunk_size -= strlen($chunk);
++
++                if (strlen($data) >= $length) {
++                    break;
++                }
+             }
+ 
+-            $data .= $chunk;
+-            $chunk_size -= strlen($chunk);
++        //
++        // if it's UDP, ti's a single fixed-size frame, and the streams library
++        // doesn't seem to have a problem reading it.
++        //
++        } else {
+ 
+-            if (strlen($data) >= $length) {
+-                break;
++            $data = fread($this->sock, $length);
++            if ($length === false) {
++            
++                $this->last_error = 'failed on fread() for data';
++                return false;
+             }
+         }
+         
--- pear-Net_DNS2-1.2.2.patch ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120817184037.10C469360>