ID: 24785
Updated by: [email]iliaa@php.net[/email]
Reported By: laudanp at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Sockets related
Operating System: Redhat 7.3
PHP Version: 4CVS-2003-07-23 (stable)
New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]

User indicated that expected behaviour is what's happening in the test
script, not a bug.


Previous Comments:
------------------------------------------------------------------------

[2003-07-24 12:57:42] laudanp at yahoo dot com

Good point. Prior to 4.3.x there was no need for "@" as the error
didn't show. After it, but prior to the CVS "fix", using "@" didn't
seem to matter. The error showed itself.

I just added the "@" to the fsockopen line and the Trojan scan works
without the error.

Amazing. So it's now resolved.

------------------------------------------------------------------------

[2003-07-24 03:45:33] [email]wez@php.net[/email]

Sounds like expected behaviour to me.
Why is this wrong?
If you want to suppress the warning messages generated by PHP, you can
use the @ operator.

------------------------------------------------------------------------

[2003-07-23 21:15:30] laudanp at yahoo dot com

Description:
------------
Please reference: [url]http://bugs.php.net/bug.php?id=21653[/url], as it is the
same for this bug report. I was asked to file a new one. The CVS
codebase I'm using is: php4-STABLE-200307031530.tar.gz. The following
line is where the error occurs in my script:

$handle = fsockopen($this-> targetIP, $index, $errno, $errstr, $this->
timeout);


You may see the script in action here:

[url]http://www.computercops.biz/modules.php?name=TCP_Scanner[/url]

or

[url]http://www.computercops.biz/modules.php?name=Trojan_TCP_Scan[/url]

I obtain that fsockopen error.

It was stated by wez in the above referenced bug report that he removed
a duplicate error message. I grabbed the latest cvs after that and it
still wasn't working.

Below is the code that I include in a parent PHP script. Its the
"core" though.

Reproduce code:
---------------
<?php
# COPYRIGHT PAUL LAUDANSKI / COMPUTERCOPS.BIZ

$trojans = array("21" => "Nerte 7.8.1",
"23" => "TruvaAti 1.2 beta"
);
flush();
while (list ($portno, $descno) = each ($trojans)) {
flush();
$fp = fsockopen($REMOTE_ADDR, $portno, $errno, $errstr,
1);
if(!$fp) {
echo "Connection Refused: ";
echo "Port $portno used by $descno.";
echo "<BR>";
} else {
echo "<FONT COLOR=red><B>ESTABLISHED
CONNECTION</b>: ";
echo "Possible $descno Trojan found on port
$portno.</FONT>";
echo "<BR>";
$start = time();
socket_set_timeout($fp, 5);
$ccspstrNumberFound++;
fclose($fp);
}
}
?>

Expected result:
----------------
Starting Trojan TCP Scan ...
Connection Refused: Port 21 used by Nerte 7.8.1.
Connection Refused: Port 23 used by TruvaAti 1.2 beta.

etc...



Actual result:
--------------
Starting Trojan TCP Scan ...

Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:21 in
/www/computercops/modules/Trojan_TCP_Scan/ccspTrojans.php on line 137
Connection Refused: Port 21 used by Nerte 7.8.1.

Warning: fsockopen(): unable to connect to xxx.xxx.xxx.xxx:23 in
/www/computercops/modules/Trojan_TCP_Scan/ccspTrojans.php on line 137
Connection Refused: Port 23 used by TruvaAti 1.2 beta.

etc...


------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=24785&edit=1[/url]