php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23161 Net_Portscan::checkPort doesn't close socket
Submitted: 2003-04-11 03:56 UTC Modified: 2003-04-22 07:16 UTC
From: hasegawa at neo dot nectec dot or dot th Assigned:
Status: Closed Package: PEAR related
PHP Version: 4.3.0 OS: W2K
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hasegawa at neo dot nectec dot or dot th
New email:
PHP Version: OS:

 

 [2003-04-11 03:56 UTC] hasegawa at neo dot nectec dot or dot th
Followings are the source code of Net_Portscan::checkPort.
[[Copy from http://cvs.php.net/co.php/pear/Net_Portscan/Portscan.php?login=2&r=1.3]]
------------------
function checkPort($host, $port, $timeout = 30)
    $socket = @fsockopen($host, $port, $errorNumber, $errorString, $timeout);

    if (!$socket) {
        return NET_PORTSCAN_NO_SERVICE;
    }

    return NET_PORTSCAN_SERVICE_FOUND;
}
------------------

When fsockopen successfuly connect the host/port, it returns resource for socket.  But above code doesn't close socket.
When fsockopen returns resource of socket, the socket should be closed with fclose function.

//Hasegawa

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-22 07:16 UTC] mj@php.net
This bug has been fixed. You can grab the latest version (1.0.2) at http://pear.php.net/Net_Portscan.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Sep 19 15:00:02 2025 UTC